Skip Headers

Oracle® VM Server User's Guide Release 2.1 Part Number E10898-04 |
Home | Book List | Contents | Index | Contact Us

Previous | Next
| View PDF

# A Command-Line Tools

This Appendix contains references for the Oracle VM Server and Oracle VM Agent command-line tools. The command-line interfaces in this Appendix are:

- ovs-agent

- virt-install

- xm

- P2V

## ovs-agent

The ovs-agent command-line tool enables you to configure, and control Oracle VM Agent. Enter parameters to the ovs-agent command-line tool in the format

service ovs-agent {option}

If you shut down or restart the Oracle VM Agent on an HA-enabled Oracle VM Server on which guests are running you are prompted to:

- Migrate or Power Off the guest(s) using Oracle VM Manager. When the guests have been migrated or Powered Off, the Oracle VM Agent shuts down.

- Shut down the guest(s) and shut down Oracle VM Agent.

- Cancel the shutdown operation.

See Chapter 3, "Oracle VM Agent" for examples on using the ovs-agent command-line tool.

Options

start

  Starts Oracle VM Agent.

      # service ovs-agent start

stop

  Stops Oracle VM Agent.

      # service ovs-agent stop

restart

  Stops and restarts Oracle VM Agent.

      # service ovs-agent restart

status

  Displays information on the status of the Oracle VM Agent daemon.

      # service ovs-agent status

configure

  Starts the Oracle VM Agent interactive configuration script.

      # service ovs-agent configure

## virt-install

The virt-install command-line tool creates paravirtualized guests and hardware virtualized guests. virt-install can be used as an interactive shell, or all parameters can be given at the same time. Enter multiple parameters to the virt-install command-line tool in the format:

virt-install [option ...]

This section contains a brief explanation of some of the more common virt-install options. For full documentation, use the `virt-install -h` command.

Chapter 4, "Creating a Guest Virtual Machine" discusses using the virt-install tool.

Options

[-h | --help]

  Displays the virt-install command parameters and their purpose.

      # virt-install -h

[-nname | --name=name]

  Sets the name of the guest instance.

      # virt-install -nMyGuest

[-rRAM | --ram=RAM]

  Sets the memory to allocate for a guest instance in Megabytes.

      # virt-install --ram=256

[-uUUID | --uuid=UUID]

  Sets the UUID (Universally Unique Identifier) for the guest. If none is given, a random UUID is generated.

      # virt-install -u

[--vcpus=number]

  Sets the number of virtual CPUs to configure for the guest.

      # virt-install --vcpus=2

[-fdiskfile | --file=diskfile]

  Sets the file to use as the disk image.

      # virt-install --file=/home/myhome/myimage

[-sfilesize | --file-size=filesize]

  Sets the size of the disk image (if it does not exist) in Gigabytes.

      # virt-install -s2

[-nonsparse]

  Do not use sparse files for disks. This option may be significantly slower when creating guests.

[-mvalue | --mac=value]

  Sets the fixed MAC address for the guest; if none or RANDOM is given, a random address is used.

      # virt-install --mac=RANDOM

[-bvalue | --bridge=value]

  Sets the bridge to connect guest NIC to. If none is given, attempts to determine the default.

[--vnc]

  Use VNC (Virtual Network Computing) for graphics support.

      # virt-install --vnc

[--vncport=port]

  Sets the port to use for VNC connections.

      # virt-install --vncport=5900

[--sdl]

  Use SDL (Simple DirectMedia Layer) for graphics support.

      # virt-install --sdl

[--nographics]

  Do not use a graphical console for the guest.

      # virt-install --nographics

[--noautoconsole]

  Do not automatically connect to the guest console.

      # virt-install --noautoconsole

[-kvalue | --keymap=value]

  Set up keyboard mapping for the graphical console. If none is given, the keymap is automatically set to the local keymap.

      # virt-install --de

[--accelerate]

  Use kernel acceleration capabilities.

      # virt-install --accelerate

[--connect=URI]

  Connect to hypervisor with URI.

      # virt-install --connect=test:///default

[-v | --hvm]

  Sets the guest as being a fully virtualized guest.

      # virt-install -v

[-cCD-ROM | --CD-ROM=CD-ROM]

  Sets the file to use a virtual CD-ROM device for fully a virtualized guest.

[--os-type=type]

  Sets the operating system type for a fully virtualized guest. Possible values are `windows`, `unix`, `other`, and `linux`.

      # virt-install --os-type=windows

[--os-variant=variant]

  Sets the operating system variant for a fully virtualized guest, for example, `rhel5`, `win2k`, or `vista`. This parameter should be used with the `os-type` parameter.

  The following table lists the possible values available for `os-variant` for each `os-type` option.

  Possible values for os-type=windows | Possible values for os-type=unix | Possible values for os-type=other | Possible values for os-type=linux
  --- | --- | --- | ---
  win2k3 | solaris9 | netware6 | generic24
  win2k | solaris10 | generic | generic26
  vista | freebsd6 | netware4 | rhel2.1
  winxp | openbsd4 | msdos | fedora7_64
  |  | netware5 | el5_64
  |  |  | fedora6
  |  |  | fedora7
  |  |  | fedora5
  |  |  | centos5_64
  |  |  | generic26_64
  |  |  | centos5
  |  |  | sles10
  |  |  | sles10_64
  |  |  | el4_64
  |  |  | rhel4
  |  |  | rhel5
  |  |  | rhel4_64
  |  |  | rhel3
  |  |  | fedora6_64
  |  |  | rhel5_64
  |  |  | fedora5_64
  |  |  | el4
  |  |  | el5

  Note:

  Not all operating system variants are supported by Oracle for use with Oracle products, but are made available for your convenience.

      # virt-install --os-type=windows --os-variant=winxp

[--noapic]

  Disables APIC (Advanced Programmable Interrupt Controller) for a fully virtualized guest. Overrides the value set in `--os-type` and `--os-variant`.

[--arch=arch]

  Sets the CPU architecture to simulate.

      # virt-install --arch=x86

[-p | --paravirt]

  Sets the guest as being a paravirtualized guest.

[-llocation | --location=location]

  Sets the installation source for a paravirtualized guest, for example, nfs:host:/path, http://host/path, or ftp://host/path.

      # virt-install -lhttp://example.com/path

[--vif-type=type]

  Sets the virtual network interface type for hardware virtualized guests. The netfront driver is a paravirtualized driver which can be used with a paravirtualized guest, or with a hardware virtualized guest with the proper paravirtualized drivers installed. The ioemu driver is a hardware virtualized driver, and can only be used with a hardware virtualized guest. Both drivers contain the device emulation code to support hardware virtualized guests.

  For hardware virtualized guests, `type` can be either `ioemu` or `netfront`. The default is `ioemu`.

  You cannot use this parameter for paravirtualized guests. For paravirtualized guests, the default is `netfront` and cannot be changed.

      # virt-install --vif-type=ioemu

[[-xargs | --extra-args=args] ...]

  Any additional arguments to pass to the installer with a paravirtualized guest.

[-d | --debug]

  Prints debugging information.

## xm

The Oracle VM Server management command-line management tool xm, creates, destroys, manages and migrates guests.

This section contains a brief explanation of some of the more common xm commands. For full documentation, use the `xm help --long` command.

The xm command-line tool requires the xend daemon to be started.

Enter parameters to the xm command-line tool in the format:

xm [option] [argument]

See Chapter 5, "Domain Monitoring and Administration" for examples on using the xm command-line tool.

Options

console {domain-id}

  Attaches to a domain's console.

      # xm console mydomain

create [-c] {config-file [name=value ...]}

  Creates a domain based on the entries in the `config-file`.

  Entering the `-c` parameter attaches to the domain's console when the domain is created and started.

  You can also enter name value pairs to override variables in the `config-file` using the `name=value` parameter.

      # xm -c /home/myhome/myconfig

destroy {domain-id}

  Immediately terminates a domain.

      # xm destroy mydomain

dmesg [--clear]

  Displays message buffer logs similar in format to the equivalent to the dmesg command in the Linux kernel.

  The `--clear` parameter clears the message buffer.

help [--long] [option]

  Displays help on the xm command, and its options.

  The `--long` option displays full help on xm commands, grouped by function.

  Enter a command name as an option to the xm command to get help only on that command.

      # xm help --long create

info

  Displays information about the host computer.

      # xm info

list [--long | --label] [domain-id, ...]

  Displays information on all the running domains.

  The `--long` option displays full information on running domains.

  Enter the `domain-id` as an option to the xm command to get information on only that domain, or a set of domains.

      # xm list --long mydomain

log

  Displays logs similar in format to the equivalent for the Linux kernel. The log file is located at /var/log/xend.log.

      # xm log

migrate {domain-id} {host} [-l | --live] [-r=MB | --resource=MB]

  Migrates a domain to another computer.

  The `domain-id` parameter is the domain to migrate.

  The `host` parameter is the target computer.

  The `--live` parameter migrates the domain without shutting down the domain.

  The `--resource` parameter sets the maximum amount of Megabytes to be used.

      # xm migrate mydomain example.com --live

new [config-file] [option ...] [name-=value ...]

  Adds a domain to Oracle VM Server domain management.

  You can set domain creation parameters with a number of command-line options, a Python script (with the `--defconfig` parameter), or an SXP configuration file (the `--config` parameter).

  You can set configuration variables with `name=value` pairs, for example vmid=3 sets vmid to 3.

  The `config-file` parameter is the location of the domain configuration file.

  The `option` parameter is one or more of the following:

  [-h | --help]

  Displays help on the command.

  [--help-config]

  Prints the available configuration variables for the configuration script.

  [-q | --quiet]

  Quiet.

  [--path=path]

  Searches the location given in `path` for configuration scripts. The value of `path` is a colon-separated directory list.

  [-f=file | --defconfig=file]

  Uses the given Python configuration script. The script is loaded after arguments have been processed. Each command-line option sets a configuration variable named after its long option name, and these variables are placed in the environment of the script before it is loaded. Variables for options that may be repeated have list values. Other variables can be set using `name=value` on the command-line. After the script is loaded, values that were not set on the command-line are replaced by the values set in the script.

  [-F=file | --config=file]

  Sets the domain configuration to use SXP. SXP is the underlying configuration format used by Xen. SXP configurations can be hand-written or generated from Python configuration scripts, using the `--dryrun` option to print the configuration.

  [-n | --dryrun]

  Prints the resulting configuration in SXP, but does not create the domain.

  [-x | --xmldryrun]

  Prints the resulting configuration in XML, but does not create the domain.

  [-s | --skipdtd]

  Skips DTD checking and XML checks before domain creation. This option is experimental and may slow down the creation of domains.

  [-p | --paused]

  Leaves the domain paused after it is created.

  [-c | --console_autoconnect]

  Connects to the console after the domain is created.

      # xm new /home/myhome/myconfig

pause {domain-id}

  Pauses the execution of a domain.

      # xm pause mydomain

reboot [--all] [--wait] [domain-id]

  Reboots a domain.

  The `--all` parameter reboots all domains.

  The `--wait` parameter waits for the domain to reboot before returning control to the console.

      # xm reboot --wait mydomain

restore {statefile}

  Restores a domain from a saved state.

      # xm restore /home/myhome/statefile

save {domain-id} {statefile}

  Saves a domain state so it can be restored at a later date.

      # xm save mydomain /home/myhome/statefile

shutdown [-a] [-w] [domain-id]

  Shuts down a domain gracefully.

  The `-a` parameter shuts down all domains.

  The `-w` parameter waits for the domain to shut down before returning control to the console.

      # xm shutdown -w mydomain

top

  Displays real time monitoring information of the host and domains.

      # xm top

unpause {domain-id}

  Unpauses a paused domain.

      # xm unpause mydomain

## P2V

The Physical to Virtual (P2V) conversion utility enables you to convert a computer's operating system (Linux and Windows) and applications to an Oracle VM hardware virtualized guest image. The P2V utility is included on the Oracle VM Server CD. You can access the P2V utility by restarting a computer with the Oracle VM Server CD. The Oracle VM Server startup screen is displayed. At the `boot:` prompt, enter:

    linux p2v

You can use a P2V kickstart file to automate creation of hardware virtualized guest images from physical computers. This section discusses the options and parameters of the P2V kickstart file.

The P2V utility converts disks on the computer to virtual disk images. The virtual disk images are created as IDE disks (hda, hdb, hdc, hdd, and so on) on the guest, using the original disk names. When you use a P2V kickstart file, up to four disks are automatically deployed in the guest. Any extra disks are converted and added to the guest configuration file (vm.cfg), although they are not deployed. To deploy the additional disks in the guest, edit the guest configuration file, remove the comments from the disk entries, and map the additional disks to SCSI device names, for example, sda, sdb, and sdc. The boot disk must always be mapped to device hda. Any files on the guest which contain references to these devices must also be changed, for example, the /etc/fstab file may contain references to /dev/hda1, /dev/sda1, and so on.

When you use a P2V kickstart file, at least one network interface must use DHCP. This is required for the computer running the P2V utility to read the kickstart file over the network. The network configuration for this network interface cannot be modified from the kickstart file.

If you want the P2V utility's web server to listen using a network interface other than the one used to initiate the kickstart session, the network configuration (DHCP or static IP address) for that network interface can be specified in the kickstart file.

A number of screens may be displayed prior to the P2V utility starting with a kickstart file. You can suppress these screens to fully automate the P2V utility. Prior to the P2V utility starting, you may see up to four screens:

- P2V Network Configuration screen

- Language selection screen

- Keyboard selection screen

- Installation source screen

The following sections give examples on how to suppress these screens.

Suppressing the P2V Network Configuration Screen

To suppress the P2V Network Configuration screen, supply the ethernet device on the command line, for example:

    linux p2v ks=http://example.com/ks.cfg ksdevice=eth0

Suppressing the Language Selection Screen

To suppress the Language selection screen, supply the language kickstart parameter, for example:

    lang en_US.UTF-8

Suppressing the Keyboard Selection Screen

To suppress the Keyboard selection screen, supply the keyboard kickstart parameter, for example:

    keyboard us

Suppressing the Installation Source Screen

To suppress the Installation source screen, supply the source kickstart parameter, for example:

    cdrom

Example P2V Kickstart File

An example P2V kickstart file follows:

    p2v
    cdrom
    lang en_US.UTF-8
    keyboard us
    target --ovmmanager
    network --device eth0 --bootproto dhcp
    diskimage --device /dev/sda --type IDE
    vm_options --name myGuest --mem 1024 --vcpus 1 --consolepasswd mypassword

For more examples and information on using P2V kickstart files, see "Converting a Linux or Windows Host" in Chapter 8, "Converting Hosts and VMware Virtual Machines".

Options

The following parameters are accepted in a P2V kickstart file.

p2v

  Indicates the kickstart file is intended to automate a P2V conversion. This parameter is required in order to perform an automated P2V conversion and should be supplied at the Oracle VM Server `boot:` prompt instead of `install`, `update`, or `rescue`. It accepts no parameters.

target [option]

  Sets the end destination for the guest image.

  The `option` parameter can only contain the following:

  --ovmmanager

  Sets the P2V utility to operate in HTTPS server mode to transfer the guest image to a running instance of Oracle VM Manager.

diskimage [option...]

  Denotes a disk to be included in the guest image. The P2V utility uses device mapper-based snapshotting to copy the disk as a system-*.img file on the target computer. There may be multiple `diskimage` directives in a P2V kickstart file, each resulting in a disk image in the guest image. The `--device` parameter must always be used with the `diskimage` directive to indicate which device should be imaged.

  The `option` parameter is one or more of the following:

  --device path

  The device to image. `path` must be the full path to the device. For example:

      diskimage --device /dev/sda

  --type [IDE | SCSI | LVM | MDRAID]

  Sets the type of disk. Must be one of `IDE`, `SCSI`, `LVM`, or `MDRAID`. Devices /dev/hda, /dev/hdb, /dev/hdc, and /dev/hdd should be `IDE`. Devices /dev/sd[a-zz] should be `SCSI`. A logical volume should be `LVM`. Devices /dev/md[a-zz] should be `MDRAID`. For example:

      diskimage --device /dev/hda --type IDE

network [option...]

  Configures network information for the computer.

  The `option` parameter is one or more of the following:

  --bootproto [dhcp | bootp | static]

  Sets the method by which the network configuration is determined. Must be `dhcp`, `bootp`, or `static`. The default is `dhcp`. `bootp` and `dhcp` are treated as the same.

  `dhcp` uses a DHCP server to obtain the networking configuration, for example:

      network --bootproto dhcp

  `static` requires all the necessary networking information. As the name implies, this information is static and is used during and after the installation. The entry for static networking is more complex, as you must include all network configuration information on one line. You must specify the IP address, netmask, gateway, and nameserver, for example:

      network --bootproto static --ip 10.0.2.15 --netmask 255.255.255.0 --gateway 10.0.2.254 --nameserver 10.0.2.1

  The `static` method has the following restrictions:

  - All static networking configuration information must be specified on one line; you cannot wrap lines using a backslash.

  - You can only specify one nameserver.

  --ip ipaddress

  The IP address for the computer.

  --gateway ipaddress

  The IP address for the default gateway.

  --nameserver ipaddress

  The IP address for the primary nameserver.

  --netmask netmask

  The netmask for the computer.

vm_options [option...]

  Sets the configuration options for the guest.

  --name name

  The name of the guest.

  --mem size

  The memory allocation for the guest in Mb.

  --vcpus number

  The number of VCPUs for the guest.

  --consolepasswd password

  The console password for the guest. For example:

      vm_options --name myGuest --mem 1024 --vcpus 1 --consolepasswd mypassword