Skip Headers
Oracle® VM Server User's Guide
Release 2.2

Part Number E15444-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

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

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:

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

block-attach {domain-id} {be-dev} {fe-dev} {mode} [bedomain-id]

Creates a new virtual block device. This triggers a hotplug event for the guest.

The domain-id parameter is the domain identifier.

The be-dev parameter is the device in the back-end domain (usually dom0) to be exported. Can be specified as a physical partition (phy:sda7), or as a file mounted as loopback (file://path/to/loop.iso).

The fe-dev parameter specifies how the device is presented to the guest domain. Can be specified as either a symbolic name, such as /dev/hdc for common devices, or by a device identifier, such as 0x1400 (/dev/hdc device identifier in hexadecimal).

The mode parameter sets the access mode for the device from the guest domain. Supported modes are w (read/write) or r (read-only).

The bedomain-id parameter is the back-end domain hosting the device. Defaults to dom0.

For example, to mount an ISO as a disk:

# xm block-attach 02 file://path/to/dsl-2.0RC2.iso /dev/hdc ro

This mounts the ISO as /dev/hdc in the guest domain as a read only device. This may not be detected as a CD-ROM by the guest, but mounting /dev/hdc gives you access to the ISO.

block-detach {domain-id} {device-id} [--force]

Detaches a virtual block devices from a domain.

The device-id parameters may be the symbolic name or the numeric device identifier given to the device by dom0. Run the xm block-list command to determine the device identifier.Detaching the device requires the co-operation of the domain. If the domain fails to release the device (perhaps because the domain is hung or is still using the device), the detach fails. The --force parameter forces the device to detach, but may cause IO errors in the domain.

# xm block-detach 02 51776
block-list {domain-id} [-l | --long]

Lists the virtual block devices for a domain.

# xm block-list 02 --long
console {domain-id}

Attaches to a domain's console.

# xm console 02
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 02
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 02
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
mem-max {domain-id} {MBs}

Allocates the maximum memory available to the domain in MBs. Overrides the maxmen setting in the configuration file.

# xm mem-max 02 2048
mem-set {domain-id} {MBs}

Allocates domain memory up to the value of the maxmen setting in the guest configuration file or the mem-max {domain-id} {MBs} setting. Overrides the memory setting in the guest configuration file.

# xm mem-set 02 1024
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 02 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 02
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 02
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 02 /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 02
top

Displays real time monitoring information of the host and domains.

# xm top
unpause {domain-id}

Unpauses a paused domain.

# xm unpause 02
vcpu-set {domain-id} {vCPUs}

Sets the number of virtual CPUs for the domain, up to the value of the vcpus setting in the guest configuration file.

# xm vcpu-set 02 8

You can set which virtual CPUs are used with the vcpu_avail parameter in the configuration file. See Section C.3, "Virtual CPU Configuration File Parameters".


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:

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 10, "Converting Hosts and Non-Oracle VM 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