Merge code from python-virtinst.git

As outlined here:

https://www.redhat.com/archives/virt-tools-list/2012-February/msg00040.html

For now this is just a direct import of the code from virtinst commit
dca5a4d6245f21d554f8853197a6a234bfc8e52c. History is not merged, so
please refer to original git for detailed commit histor:

http://git.fedorahosted.org/cgit/python-virtinst.git/
This commit is contained in:
Cole Robinson 2013-03-17 17:06:52 -04:00
parent 9d05583c26
commit 88603e4fad
344 changed files with 44264 additions and 0 deletions

222
man/virt-clone.pod Normal file
View File

@ -0,0 +1,222 @@
=pod
=head1 NAME
virt-clone - clone existing virtual machine images
=head1 SYNOPSIS
B<virt-clone> [OPTION]...
=head1 DESCRIPTION
B<virt-clone> is a command line tool for cloning existing virtual machine
images using the C<libvirt> hypervisor management library. It will copy
the disk images of any existing virtual machine, and define a new guest
with an identical virtual hardware configuration. Elements which require
uniqueness will be updated to avoid a clash between old and new guests.
By default, virt-clone will show an error if the necessary information to
clone the guest is not provided. The --auto-clone option will generate
all needed input, aside from the source guest to clone. An interactive mode
is available with the --prompt option, but this will only ask for the
minimum required options.
=head1 OPTIONS
Most options are not required. Minimum requirements are --original or
--original-xml (to specify the guest to clone), --name, and appropriate
storage options via -file.
=over 4
=item -h, --help
Show the help message and exit
=item --connect=URI
Connect to a non-default hypervisor. See L<virt-install(1)> for details
=back
=head2 General Options
General configuration parameters that apply to all guest clones.
=over 2
=item -o ORIGINAL_GUEST, --original=ORIGINAL_GUEST
Name of the original guest to be cloned. This guest must be shut off or paused
since it is not possible to safely clone active guests at this time.
=item --original-xml=ORIGINAL_XML
Libvirt guest xml file to use as the original guest. The guest does not need to
be defined on the libvirt connection. This takes the place of the
C<--original> parameter.
=item --auto-clone
Generate a new guest name, and paths for new storage.
An example or possible generated output:
Original name : MyVM
Generated clone name : MyVM-clone
Original disk path : /home/user/foobar.img
Generated disk path : /home/user/foobar-clone.img
If generated names collide with existing VMs or storage, a number is appended,
such as foobar-clone-1.img, or MyVM-clone-3.
=item -n NAME, --name=NAME
Name of the new guest virtual machine instance. This must be unique amongst
all guests known to the hypervisor connection, including those not
currently active.
=item -u UUID, --uuid=UUID
UUID for the guest; if none is given a random UUID will be generated. If you
specify UUID, you should use a 32-digit hexadecimal number. UUID are intended
to be unique across the entire data center, and indeed world. Bear this in
mind if manually specifying a UUID
=back
=head2 Storage Configuration
=over 2
=item -f DISKFILE, --file=DISKFILE
Path to the file, disk partition, or logical volume to use as the backing store
for the new guest's virtual disk. If the original guest has multiple disks,
this parameter must be repeated multiple times, once per disk in the original
virtual machine.
=item --force-copy=TARGET
Force cloning the passed disk target ('hdc', 'sda', etc.). By default,
C<virt-clone> will skip certain disks, such as those marked 'readonly' or
'shareable'.
=item --nonsparse
Fully allocate the new storage if the path being cloned is a sparse file.
See L<virt-install(1)> for more details on sparse vs. nonsparse.
=item --preserve-data
No storage is cloned: disk images specific by --file are preserved as is,
and referenced in the new clone XML. This is useful if you want to clone
a VM XML template, but not the storage contents.
=back
=head2 Networking Configuration
=over 2
=item -m MAC, --mac=MAC
Fixed MAC address for the guest; If this parameter is omitted, or the value
C<RANDOM> is specified a suitable address will be randomly generated. Addresses
are applied sequentially to the networks as they are listed in the original
guest XML.
=back
=head2 Miscellaneous Options
=over 2
=item --print-xml
Print the generated clone XML and exit without cloning.
=item --replace
Shutdown and remove any existing guest with the passed C<--name> before
cloning the original guest.
=item -d, --debug
Print debugging information to the terminal when running the install process.
The debugging information is also stored in C<$HOME/.virtinst/virt-clone.log>
even if this parameter is omitted.
=item --force
Prevent interactive prompts. If the intended prompt was a yes/no prompt, always
say yes. For any other prompts, the application will exit.
=item --prompt
Specifically enable prompting for required information. Default prompting
is off.
=back
=head1 EXAMPLES
Clone the guest called C<demo> on the default connection, auto generating
a new name and disk clone path.
# virt-clone \
--original demo \
--auto-clone
Clone the guest called C<demo> which has a single disk to copy
# virt-clone \
--original demo \
--name newdemo \
--file /var/lib/xen/images/newdemo.img
Clone a QEMU guest with multiple disks
# virt-clone \
--connect qemu:///system \
--original demo \
--name newdemo \
--file /var/lib/xen/images/newdemo.img \
--file /var/lib/xen/images/newdata.img
Clone a guest to a physical device which is at least as big as the
original guests disks. If the destination device is bigger, the
new guest can do a filesystem resize when it boots.
# virt-clone \
--connect qemu:///system \
--original demo \
--name newdemo \
--file /dev/HostVG/DemoVM \
--mac 52:54:00:34:11:54
=head1 AUTHOR
Written by Kazuki Mizushima, Cole Robinson, and a team of many other
contributors. See the AUTHORS file in the source distribution for the
complete list of credits.
=head1 BUGS
Please see http://virt-manager.org/page/BugReporting
=head1 COPYRIGHT
Copyright (C) Fujitsu Limited, and various contributors.
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License C<http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
=head1 SEE ALSO
C<virsh(1)>, C<virt-install(1)>, C<virt-manager(1)>, the project website C<http://virt-manager.org>
=cut

168
man/virt-convert.pod Normal file
View File

@ -0,0 +1,168 @@
=pod
=head1 NAME
virt-convert - convert virtual machines between formats
=head1 SYNOPSIS
B<virt-convert> [OPTION]... INPUT.VMX|INPUT-DIR [OUTPUT.XML|OUTPUT-DIR]
=head1 DESCRIPTION
B<virt-convert> is a command line tool for converting virtual machines
from one format to another. Pass in either a VM definition file (such
as VMWare vmx format) or a directory containing a VM. By default, a new
VM definition file, and converted disk images, will be placed in a new
output directory.
If an output directory is specified, it will be created if necessary,
and the output VM definition placed within, along with any disk images
as needed.
If an output VM definition file is specified, it will be created
alongside any disks in the same directory.
=head1 OPTIONS
Any of the options can be omitted, in which case B<virt-convert> will
use defaults when required. An input VM definition or containing directory
must be provided. By default, an output directory is generated based upon
the name of the VM. The default input format is VMWare vmx, and the
default output format is a libvirt "image" XML definition
(see L<virt-image(5)>).
=over 4
=item -h, --help
Show the help message and exit
=back
=head2 Conversion Options
=over 2
=item -i format
Input format. Currently, C<vmx>, C<virt-image>, and C<ovf> are supported.
=item -o format
Output format. Currently, C<vmx> and C<virt-image> are supported.
=item -D format
Output disk format, or C<none> if no conversion should be performed. See
L<qemu-img(1)>.
=back
=head2 Virtualization Type options
Options to override the default virtualization type choices.
=over 2
=item -v, --hvm Create a fully virtualized guest image
Convert machine to a hvm/qemu based image (this is the default if paravirt
is not specified)
=item -p, --paravirt Create a paravirtualized guest image
Convert machine to a paravirt xen based image
=back
=head2 General Options
General configuration parameters that apply to all types of guest installs.
=over 2
=item -a ARCH, --arch=ARCH
Architecture of the virtual machine (i686, x86_64, ppc). Defaults to
that of the host machine.
=item --os-type=OS_TYPE
Optimize the guest configuration for a type of operating system (ex. 'linux',
'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
optimally supported mouse drivers, virtio, and generally accommodate other
operating system quirks. See L<virt-install(1)> for valid values.
=item --os-variant=OS_VARIANT
Further optimize the guest configuration for a specific operating system
variant (ex. 'fedora8', 'winxp'). This parameter is optional, and does not
require an C<--os-type> to be specified. See L<virt-install(1)> for valid
values.
=item --noapic
Override the OS type / variant to disables the APIC setting for fully
virtualized guest.
=item --noacpi
Override the OS type / variant to disables the ACPI setting for fully
virtualized guest.
=back
=head2 Miscellaneous Options
=over 2
=item -q, --quiet
Avoid verbose output.
=item -d, --debug
Print debugging information
=item --dry-run
Proceed through the conversion process, but don't convert disks or actually
write any converted files.
=back
=head1 EXAMPLES
Convert a paravirt guest from C<image.vmx>:
# virt-convert --arch=i686 --paravirt image.vmx
Convert a 64-bit hvm guest:
# virt-convert --arch=x86_64 vmx-appliance/ hvm-appliance/
=head1 AUTHOR
Written by Joey Boggs, John Levon, and Cole Robinson
See the AUTHORS file in the source distribution for the complete list
of credits.
=head1 BUGS
Please see http://virt-manager.org/page/BugReporting
=head1 COPYRIGHT
Copyright (C) 2006-2012 Red Hat, Inc, and various contributors.
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License C<http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
=head1 SEE ALSO
L<virt-image(5)>, the project website C<http://virt-manager.org>
=cut

247
man/virt-image-xml.pod Normal file
View File

@ -0,0 +1,247 @@
=pod
=head1 NAME
virt-image - Format of the virtual image XML descriptor
=head1 DESCRIPTION
L<virt-image(1)> relies on an XML descriptor to create virtual machines from
virtual machine images. In general, a virtual machine image consists of the
XML descriptor (usually in a file F<image.xml>) and a number of files for
the virtual machine's disks.
In the following explanation of the structure of the image descriptor,
mandatory XML elements are marked as B<element>, whereas optional elements
are marked as I<element>.
All file names in the image descriptor are relative to the location of the
descriptor itself. Generally, disk files are either kept in the same
directory as the image descriptor, or in a subdirectory.
=head1 HOST MATCHING
The image descriptor contains information on the requirements a guest has
on the host platform through one or more the F</image/domain/boot>
descriptors (see section L</BOOT>). The image can only be used if at least
one of the boot descriptors is suitable for the host platform; a boot
descriptor is suitable if:
=over 4
=item *
The CPU architecture of the boot descriptor, given by the
F<boot/guest/arch> element, is supported by the host
=item *
The host supports a guest with the features requested in the
F<boot/guest/features> element, such as providing an APIC, or having ACPI
turned off
=back
If a suitable boot descriptor is found, the guest is created and booted
according to the information about booting the OS from the F<boot/os>
element and with the disks specified in the F<boot/drive> element. If more
than one suitable boot descriptor is found, one of them is chosen based on
a heuristic, generally preferring paravirtualized guests over full
virtualized ones, though this is an implementation detail of the tool
creating the virtual machine.
=head1 STRUCTURE
The image descriptor consists of three sections, all contained in the
toplevel B<image> element:
=over 4
=item General metadata about the image
A number of elements like I<label>, B<name>, and I<description> that give
some simple information about the image. The B<name> must be a string
suitable as a name for the virtual machine, the I<label> is a short
human-readable string suitable for display in graphical UI's, and the
I<description> should be a longer, free-form description of the purpose of
the image. The B<name> is mandatory.
=item Virtual machine attributes
The B<domain> element contains instructions on how to boot the image, and
device attributes such as the number of virtual CPU's and the size of the
memory. (see section L</DOMAIN>)
=item Storage layout
The B<storage> element lists the files to back the virtual machine's disks
and some information about their format and use. (see section L</STORAGE>)
=back
=head1 DOMAIN
The B<domain> element contains one or more B<boot> descriptors (see section
L</BOOT>) and a B<devices> element. The B<Devices> element lists the
recommended number of virtual CPU's in the B<vcpu> element and the
recommended amount of memory in kB in the B<memory> element. It also
indicates whether the virtual machine should have a network interface
through the I<interface> element and whether the virtual machine has a
graphical interface through the I<graphics> element.
=head2 BOOT
Each B<boot> descriptor details how the virtual machine should be started
on a certain hypervisor. The B<type> attribute of the B<boot> element,
which can either be C<xen> or C<hvm>, depending on whether the boot
descriptor is for a paravirtualized Xen(tm) guest or a fully-virtualized
guest.
The B<boot> element contains three subelements:
=over 4
=item The platform requirements of the guest
The platform requirements, contained in the B<guest> element, consist of
the B<arch> element and the I<features> element. The B<arch> element
indicates the CPU architecture the guest expects, e.g. C<i686>, C<x86_64>,
or C<ppc>.
The I<features> element indicates whether certain platform features should
be on or off. Currently, the platform features are I<pae>, I<acpi>, and
I<apic>. They can be turned on or off by giving a I<state> attribute of
either C<on> or C<off>. When a feature is mentioned in the I<features>
element, it defaults to C<on>.
=item The details of booting the image's operating system
The B<os> element for fully-virtualized C<hvm> guests contains a B<loader>
element whose B<dev> attribute indicates whether to boot off a hard disk
(C<dev='hd'>) or off a CD-ROM (C<dev='cdrom'>)
For paravirtualized guests, the B<os> element either contains a
C<< <loader>pygrub</loader> >> element, indicating that the guest should be
booted with F<pygrub>, or B<kernel>, I<initrd> and I<cmdline> elements. The
contents of the B<kernel> and I<initrd> elements are the names of the
kernel and initrd files, whereas the I<cmdline> element contains the
command line that should be passed to the kernel on boot.
=item The mapping of disk files as devices into the guest
The mapping of disk files into the guest is performed by a list of B<drive>
elements inside the B<boot> element. Each B<drive> element references the
name of a disk file from the L</STORAGE> section through its B<disk>
attribute and can optionally specify as what device that disk file should
appear in the guest through its I<target> attribute. If the I<target> is
omitted, device names are assigned in the order in which the B<drive>
elements appear, skipping already assigned devices.
=back
=head1 STORAGE
The B<storage> element lists the disk image files that are part of the
virtual machine image in a list of one or more B<disk> elements. Each
B<disk> element can contain the following attributes:
=over 4
=item *
the B<file> attribute giving the name of the disk file
=item *
an optional I<id> attribute. The name given with that attribute is used to
reference the disk from the B<drive> element of a B<boot> descriptor. If
the I<id> attribute is missing, it defaults to the B<file> attribute.
=item *
the B<use> attribute indicating whether the disk file is a C<system>,
C<user>, or C<scratch> disk. The B<use> attribute differentiates disk files
so that an update based on replacing disk files can replace C<system>
disks, but leave C<user> disks untouched.
Generally, C<system> disks contain application code, C<user> disks contain
the application's data, and C<scratch> disks contain temporary state that
can be erased between runs of the guest.
The virtual machine image must contain files for all C<system> disks, and
may contain files for the C<user> and C<scratch> disks. If the latter are
not part of the image, they are initialized as empty files when a guest is
created, with the size given by the I<size> attribute.
=item *
the I<size> attribute giving the size of the disk in MB.
=item *
the I<format> attribute giving the format of the disk file. Currently, this
can be one of: C<raw> C<iso>, C<qcow>, C<qcow2>, or C<vmdk>.
=back
=head1 EXAMPLE
The image descriptor below can be used to create a virtual machine running
the System Rescue CD (C<http://www.sysresccd.org/>) Besides the descriptor,
you only need the ISO image from the System Rescue CD website.
<?xml version="1.0" encoding="UTF-8"?>
<image>
<name>sysresccd</name>
<domain>
<boot type="hvm">
<guest>
<arch>i686</arch>
</guest>
<os>
<loader dev="cdrom"/>
</os>
<drive disk="root.raw" target="hda"/>
<drive disk="sysresc"/>
</boot>
<devices>
<vcpu>1</vcpu>
<memory>262144</memory>
<interface/>
<graphics/>
</devices>
</domain>
<storage>
<disk file="root.raw" use="scratch" size="100" format="raw"/>
<disk id="sysresc" file="isos/systemrescuecd.iso"
use="system" format="iso"/>
</storage>
</image>
To create a virtual machine, save the above XML in F<image.xml> and run:
# virt-image --vnc image.xml
=head1 AUTHOR
Written by David Lutterkort. See the AUTHORS file in the source distribution
for the complete list of credits.
=head1 BUGS
Please see C<http://virt-manager.org/page/BugReporting>
=head1 COPYRIGHT
Copyright (C) 2006-2012 Red Hat, Inc, and various contributors.
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License C<http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
=head1 SEE ALSO
L<virt-image(1)>, L<virt-install(1)>, the project website
C<http://virt-manager.org>, the Relax-NG grammar for image XML C<image.rng>
=cut

251
man/virt-image.pod Normal file
View File

@ -0,0 +1,251 @@
=pod
=head1 NAME
virt-image - create virtual machines from an image descriptor
=head1 SYNOPSIS
B<virt-image> [OPTION]... IMAGE.XML
=head1 DESCRIPTION
B<virt-image> is a command line tool for creating virtual machines from an
XML image descriptor C<IMAGE.XML> (L<virt-image(5)>). Most attributes of
the virtual machine are taken from the XML descriptor (e.g., where the
files to back the virtual machine's disks are and how to map them into the
guest), though certain information must be added on the command line, such
as the name of the guest.
The XML descriptor defines most attributes of the guest, making it possible
to bundle and distribute it together with the files backing the guest's
disks.
=head1 OPTIONS
Most options can be omitted, in which case B<virt-image> will use defaults
from the XML descriptor. When defaults are taken from the XML descriptor,
they are indicated below as a path. --name is the only required command
line option.
=over 4
=item -h, --help
Show the help message and exit
=item --connect=URI
Connect to a non-default hypervisor. See L<virt-install(1)> for details
=back
=head2 General Options
General configuration parameters that apply to all types of guest installs.
=over 2
=item -n NAME, --name=NAME
Name of the guest instance
=item -r MEMORY, --ram=MEMORY
Memory to allocate for guest instance in megabytes. Defaults to
C</image/devices/memory> in the XML descriptor.
=item -u UUID, --uuid=UUID
UUID for the guest; if none is given a random UUID will be generated. If
you specify UUID, you should use a 32-digit hexadecimal number.
=item --vcpus=VCPUS
Number of vcpus to configure for your guest. Defaults to
C</image/devices/vcpu> in the XML descriptor. This option can also be
used to set CPU topology, please see L<virt-install(1)> for more info.
=item --cpuset
Set which physical cpus the guest can use. Please see L<virt-install(1)> for
more info.
=item --cpu
Configure the CPU and CPU features exposed to the guest. Please see
L<virt-install(1)> for more info.
=item --check-cpu
Check that vcpus do not exceed physical CPUs and warn if they do.
=item --os-type=OS_TYPE
Optimize the guest configuration for a type of operating system (ex. 'linux',
'windows'). This will attempt to pick the most suitable ACPI & APIC settings,
optimally supported mouse drivers, virtio, and generally accommodate other
operating system quirks. See L<virt-install(1)> for valid values.
=item --os-variant=OS_VARIANT
Further optimize the guest configuration for a specific operating system
variant (ex. 'fedora8', 'winxp'). This parameter is optional, and does not
require an C<--os-type> to be specified. See L<virt-install(1)> for valid
values.
=back
=head2 Full Virtualization specific options
Parameters specific only to fully virtualized guest installs.
=over 2
=item --noapic
Force disable APIC for the guest.
=item --noacpi
Force disable ACPI for the guest.
=back
=head2 Networking Configuration
=over 2
=item -w NETWORK, --network=NETWORK
Connect the guest to the host network. See L<virt-install(1)> for details
=item -m MAC, --mac=MAC
This is deprecated in favor of C<--network ...,mac=MAC,...>
=item -b BRIDGE, --bridge=BRIDGE
This is deprecated in favor of C<--network bridge=BRIDGE>
=back
=head2 Graphics Configuration
If no graphics option is specified, C<virt-image> will default to
'--graphics vnc' if the DISPLAY environment variable is set, otherwise
'--graphics none' is used.
=over 2
=item --graphics TYPE,opt1=arg1,opt2=arg2,...
Specifies the graphical display configuration. This does not configure any
virtual hardware, just how the guest's graphical display can be accessed.
See L<virt-install(1)> for details usage info.
=item --vnc
This option is deprecated in favor of C<--graphics vnc,...>
=item --vncport=VNCPORT
This option is deprecated in favor of C<--graphics vnc,port=PORT,...>
=item --vnclisten=VNCLISTEN
This option is deprecated in favor of C<--graphics vnc,listen=LISTEN,...>
=item -k KEYMAP, --keymap=KEYMAP
This option is deprecated in favor of C<--graphics vnc,keymap=KEYMAP,...>
=item --sdl
This option is deprecated in favor of C<--graphics sdl,...>
=item --nographics
This option is deprecated in favor of C<--graphics none>
=back
=head2 Miscellaneous Options
=over 2
=item -p, --print
Print the libvirt XML, but do not start the guest.
=item --boot=BOOT
The zero-based index of the boot record to use. The XML descriptor can
contain multiple C</image/domain/boot> elements for use on different
hypervisors. By default, the one that is most appropriate for the current
hypervisor is selected.
=item --replace
Shutdown and remove any existing guest with the passed C<--name> before
installing from the image.
=item --noreboot
Prevent the domain automatically booting after importing the image.
=item --skip-checksum
Do not check disk images against checksums (if they are listed in the
image xml).
=item -d, --debug
Print debugging information.
=back
=head1 EXAMPLES
Create and start a guest called C<example> with a VNC console from
C<image.xml>:
# virt-image --name example --vnc image.xml
Print the libvirt XML for a guest called C<example> without graphics, but
do not create or start a virtual machine:
# virt-image --print --name example --nographics image.xml
=head1 AUTHOR
Written by David Lutterkort and Cole Robinson. See the AUTHORS file in
the source distribution for the complete list of credits.
=head1 BUGS
Please see http://virt-manager.org/page/BugReporting
=head1 COPYRIGHT
Copyright (C) 2006-2012 Red Hat, Inc, and various contributors.
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License C<http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
=head1 SEE ALSO
L<virt-image(5)>, L<virt-install(1)>, the project website
C<http://virt-manager.org>
=cut

1432
man/virt-install.pod Normal file

File diff suppressed because it is too large Load Diff

1371
man/virt-install.pod.in Normal file

File diff suppressed because it is too large Load Diff

55
tests/__init__.py Normal file
View File

@ -0,0 +1,55 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
import logging
import os
import virtinst
import utils
# Force certain helpers to return consistent values
virtinst._util.is_blktap_capable = lambda: False
virtinst._util.default_bridge2 = lambda ignore1: ["bridge", "eth0"]
virtinst.Guest._open_uri = lambda ignore1, ignore2: None
# Setup logging
rootLogger = logging.getLogger()
for handler in rootLogger.handlers:
rootLogger.removeHandler(handler)
logging.basicConfig(level=logging.DEBUG,
format="%(levelname)-8s %(message)s")
if utils.get_debug():
rootLogger.setLevel(logging.DEBUG)
else:
rootLogger.setLevel(logging.ERROR)
# Have imports down here so they get the benefit of logging setup etc.
import capabilities
import clitest
import clonetest
import image
import interface
import nodedev
import storage
import support
import urltest
import validation
import virtconvtest
import xmlconfig
import xmlparse

View File

@ -0,0 +1,82 @@
<capabilities>
<host>
<cpu>
<arch>i686</arch>
</cpu>
</host>
<guest>
<os_type>hvm</os_type>
<arch name="i686">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu</emulator>
<domain type="qemu"/>
<machine>pc</machine>
<machine>isapc</machine>
<domain type="kvm">
<emulator>/usr/bin/qemu-kvm</emulator>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="x86_64">
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<domain type="qemu"/>
<machine>pc</machine>
<machine>isapc</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="mips">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mips</emulator>
<domain type="qemu"/>
<machine>mips</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="mipsel">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mipsel</emulator>
<domain type="qemu"/>
<machine>mips</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="sparc">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<domain type="qemu"/>
<machine>sun4m</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="ppc">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<domain type="qemu"/>
<machine>g3bw</machine>
<machine>mac99</machine>
<machine>prep</machine>
</arch>
</guest>
</capabilities>

View File

@ -0,0 +1,42 @@
<capabilities>
<host>
<uuid>97e80381-494f-11cb-8e0e-cbc168f7d753</uuid>
<cpu>
<arch>x86_64</arch>
</cpu>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>exe</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<domain type='lxc'>
</domain>
</arch>
</guest>
<guest>
<os_type>exe</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<domain type='lxc'>
</domain>
</arch>
</guest>
</capabilities>

View File

@ -0,0 +1,75 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
</cpu>
<secmodel>
<model>selinux</model>
<doi>0</doi>
</secmodel>
</host>
<guest>
<os_type>hvm</os_type>
<arch name="x86_64">
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<domain type="qemu"/>
<machine>pc</machine>
<machine>isapc</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="i686">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu</emulator>
<domain type="qemu"/>
<machine>pc</machine>
<machine>isapc</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="mips">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mips</emulator>
<domain type="qemu"/>
<machine>mips</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="mipsel">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mipsel</emulator>
<domain type="qemu"/>
<machine>mips</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="sparc">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<domain type="qemu"/>
<machine>sun4m</machine>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="ppc">
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<domain type="qemu"/>
<machine>g3bw</machine>
<machine>mac99</machine>
<machine>prep</machine>
</arch>
</guest>
</capabilities>

View File

@ -0,0 +1,57 @@
<capabilities>
<host>
<cpu>
<arch>i686</arch>
<features>
<pae/>
<nonpae/>
</features>
</cpu>
<topology>
<cells num='2'>
<cell id='0'>
<cpus num='8'>
<cpu id='0'/>
<cpu id='2'/>
<cpu id='4'/>
<cpu id='6'/>
<cpu id='8'/>
<cpu id='10'/>
<cpu id='12'/>
<cpu id='14'/>
</cpus>
</cell>
<cell id='1'>
<cpus num='8'>
<cpu id='1'/>
<cpu id='3'/>
<cpu id='5'/>
<cpu id='7'/>
<cpu id='9'/>
<cpu id='11'/>
<cpu id='13'/>
<cpu id='15'/>
</cpus>
</cell>
</cells>
</topology>
<secmodel>
<model>testSecurity</model>
<doi></doi>
</secmodel>
</host>
<guest>
<os_type>linux</os_type>
<arch name="i686">
<wordsize>32</wordsize>
<domain type="test"/>
</arch>
<features>
<pae/>
<nonpae/>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,61 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<features>
<vmx/>
</features>
</cpu>
</host>
<guest>
<os_type>xen</os_type>
<arch name="x86_64">
<wordsize>64</wordsize>
<domain type="xen"></domain>
</arch>
<features>
</features>
</guest>
<guest>
<os_type>xen</os_type>
<arch name="i686">
<wordsize>32</wordsize>
<domain type="xen"></domain>
</arch>
<features>
<pae/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="i686">
<wordsize>32</wordsize>
<domain type="xen"></domain>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<machine>pc</machine>
<machine>isapc</machine>
<loader>/usr/lib/xen/boot/hvmloader</loader>
</arch>
<features>
<pae/>
<nonpae/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name="x86_64">
<wordsize>64</wordsize>
<domain type="xen"></domain>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<machine>pc</machine>
<machine>isapc</machine>
<loader>/usr/lib/xen/boot/hvmloader</loader>
</arch>
<features>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,556 @@
<cpus>
<arch name='x86'>
<!-- vendor definitions -->
<vendor name='Intel' string='GenuineIntel'/>
<vendor name='AMD' string='AuthenticAMD'/>
<!-- standard features, EDX -->
<feature name='fpu'> <!-- CPUID_FP87 -->
<cpuid function='0x00000001' edx='0x00000001'/>
</feature>
<feature name='vme'> <!-- CPUID_VME -->
<cpuid function='0x00000001' edx='0x00000002'/>
</feature>
<feature name='de'> <!-- CPUID_DE -->
<cpuid function='0x00000001' edx='0x00000004'/>
</feature>
<feature name='pse'> <!-- CPUID_PSE -->
<cpuid function='0x00000001' edx='0x00000008'/>
</feature>
<feature name='tsc'> <!-- CPUID_TSC -->
<cpuid function='0x00000001' edx='0x00000010'/>
</feature>
<feature name='msr'> <!-- CPUID_MSR -->
<cpuid function='0x00000001' edx='0x00000020'/>
</feature>
<feature name='pae'> <!-- CPUID_PAE -->
<cpuid function='0x00000001' edx='0x00000040'/>
</feature>
<feature name='mce'> <!-- CPUID_MCE -->
<cpuid function='0x00000001' edx='0x00000080'/>
</feature>
<feature name='cx8'> <!-- CPUID_CX8 -->
<cpuid function='0x00000001' edx='0x00000100'/>
</feature>
<feature name='apic'> <!-- CPUID_APIC -->
<cpuid function='0x00000001' edx='0x00000200'/>
</feature>
<feature name='sep'> <!-- CPUID_SEP -->
<cpuid function='0x00000001' edx='0x00000800'/>
</feature>
<feature name='mtrr'> <!-- CPUID_MTRR -->
<cpuid function='0x00000001' edx='0x00001000'/>
</feature>
<feature name='pge'> <!-- CPUID_PGE -->
<cpuid function='0x00000001' edx='0x00002000'/>
</feature>
<feature name='mca'> <!-- CPUID_MCA -->
<cpuid function='0x00000001' edx='0x00004000'/>
</feature>
<feature name='cmov'> <!-- CPUID_CMOV -->
<cpuid function='0x00000001' edx='0x00008000'/>
</feature>
<feature name='pat'> <!-- CPUID_PAT -->
<cpuid function='0x00000001' edx='0x00010000'/>
</feature>
<feature name='pse36'> <!-- CPUID_PSE36 -->
<cpuid function='0x00000001' edx='0x00020000'/>
</feature>
<feature name='pn'> <!-- CPUID_PN -->
<cpuid function='0x00000001' edx='0x00040000'/>
</feature>
<feature name='clflush'> <!-- CPUID_CLFLUSH -->
<cpuid function='0x00000001' edx='0x00080000'/>
</feature>
<feature name='ds'> <!-- CPUID_DTS -->
<cpuid function='0x00000001' edx='0x00200000'/>
</feature>
<feature name='acpi'> <!-- CPUID_ACPI -->
<cpuid function='0x00000001' edx='0x00400000'/>
</feature>
<feature name='mmx'> <!-- CPUID_MMX -->
<cpuid function='0x00000001' edx='0x00800000'/>
</feature>
<feature name='fxsr'> <!-- CPUID_FXSR -->
<cpuid function='0x00000001' edx='0x01000000'/>
</feature>
<feature name='sse'> <!-- CPUID_SSE -->
<cpuid function='0x00000001' edx='0x02000000'/>
</feature>
<feature name='sse2'> <!-- CPUID_SSE2 -->
<cpuid function='0x00000001' edx='0x04000000'/>
</feature>
<feature name='ss'> <!-- CPUID_SS -->
<cpuid function='0x00000001' edx='0x08000000'/>
</feature>
<feature name='ht'> <!-- CPUID_HT -->
<cpuid function='0x00000001' edx='0x10000000'/>
</feature>
<feature name='tm'> <!-- CPUID_TM -->
<cpuid function='0x00000001' edx='0x20000000'/>
</feature>
<feature name='ia64'> <!-- CPUID_IA64 -->
<cpuid function='0x00000001' edx='0x40000000'/>
</feature>
<feature name='pbe'> <!-- CPUID_PBE -->
<cpuid function='0x00000001' edx='0x80000000'/>
</feature>
<!-- standard features, ECX -->
<feature name='pni'> <!-- CPUID_EXT_SSE3 -->
<cpuid function='0x00000001' ecx='0x00000001'/>
</feature>
<feature name='monitor'> <!-- CPUID_EXT_MONITOR -->
<cpuid function='0x00000001' ecx='0x00000008'/>
</feature>
<feature name='ds_cpl'> <!-- CPUID_EXT_DSCPL -->
<cpuid function='0x00000001' ecx='0x00000010'/>
</feature>
<feature name='vmx'> <!-- CPUID_EXT_VMX -->
<cpuid function='0x00000001' ecx='0x00000020'/>
</feature>
<feature name='est'> <!-- CPUID_EXT_EST -->
<cpuid function='0x00000001' ecx='0x00000080'/>
</feature>
<feature name='tm2'> <!-- CPUID_EXT_TM2 -->
<cpuid function='0x00000001' ecx='0x00000100'/>
</feature>
<feature name='ssse3'> <!-- CPUID_EXT_SSSE3 -->
<cpuid function='0x00000001' ecx='0x00000200'/>
</feature>
<feature name='cid'> <!-- CPUID_EXT_CID -->
<cpuid function='0x00000001' ecx='0x00000400'/>
</feature>
<feature name='cx16'> <!-- CPUID_EXT_CX16 -->
<cpuid function='0x00000001' ecx='0x00002000'/>
</feature>
<feature name='xtpr'> <!-- CPUID_EXT_XTPR -->
<cpuid function='0x00000001' ecx='0x00004000'/>
</feature>
<feature name='dca'> <!-- CPUID_EXT_DCA -->
<cpuid function='0x00000001' ecx='0x00040000'/>
</feature>
<feature name='sse4.1'> <!-- CPUID_EXT_SSE41 -->
<cpuid function='0x00000001' ecx='0x00080000'/>
</feature>
<feature name='sse4.2'> <!-- CPUID_EXT_SSE42 -->
<cpuid function='0x00000001' ecx='0x00100000'/>
</feature>
<feature name='x2apic'> <!-- CPUID_EXT_X2APIC -->
<cpuid function='0x00000001' ecx='0x00200000'/>
</feature>
<feature name='popcnt'> <!-- CPUID_EXT_POPCNT -->
<cpuid function='0x00000001' ecx='0x00800000'/>
</feature>
<feature name='hypervisor'> <!-- CPUID_EXT_HYPERVISOR -->
<cpuid function='0x00000001' ecx='0x80000000'/>
</feature>
<!-- extended features, EDX -->
<feature name='syscall'> <!-- CPUID_EXT2_SYSCALL -->
<cpuid function='0x80000001' edx='0x00000800'/>
</feature>
<feature name='nx'> <!-- CPUID_EXT2_NX -->
<cpuid function='0x80000001' edx='0x00100000'/>
</feature>
<feature name='mmxext'> <!-- CPUID_EXT2_MMXEXT -->
<cpuid function='0x80000001' edx='0x00400000'/>
</feature>
<feature name='fxsr_opt'> <!-- CPUID_EXT2_FFXSR -->
<cpuid function='0x80000001' edx='0x02000000'/>
</feature>
<feature name='pdpe1gb'> <!-- CPUID_EXT2_PDPE1GB -->
<cpuid function='0x80000001' edx='0x04000000'/>
</feature>
<feature name='rdtscp'> <!-- CPUID_EXT2_RDTSCP -->
<cpuid function='0x80000001' edx='0x08000000'/>
</feature>
<feature name='lm'> <!-- CPUID_EXT2_LM -->
<cpuid function='0x80000001' edx='0x20000000'/>
</feature>
<feature name='3dnowext'> <!-- CPUID_EXT2_3DNOWEXT -->
<cpuid function='0x80000001' edx='0x40000000'/>
</feature>
<feature name='3dnow'> <!-- CPUID_EXT2_3DNOW -->
<cpuid function='0x80000001' edx='0x80000000'/>
</feature>
<!-- extended features, ECX -->
<feature name='lahf_lm'> <!-- CPUID_EXT3_LAHF_LM -->
<cpuid function='0x80000001' ecx='0x00000001'/>
</feature>
<feature name='cmp_legacy'> <!-- CPUID_EXT3_CMP_LEG -->
<cpuid function='0x80000001' ecx='0x00000002'/>
</feature>
<feature name='svm'> <!-- CPUID_EXT3_SVM -->
<cpuid function='0x80000001' ecx='0x00000004'/>
</feature>
<feature name='extapic'> <!-- CPUID_EXT3_EXTAPIC -->
<cpuid function='0x80000001' ecx='0x00000008'/>
</feature>
<feature name='cr8legacy'> <!-- CPUID_EXT3_CR8LEG -->
<cpuid function='0x80000001' ecx='0x00000010'/>
</feature>
<feature name='abm'> <!-- CPUID_EXT3_ABM -->
<cpuid function='0x80000001' ecx='0x00000020'/>
</feature>
<feature name='sse4a'> <!-- CPUID_EXT3_SSE4A -->
<cpuid function='0x80000001' ecx='0x00000040'/>
</feature>
<feature name='misalignsse'> <!-- CPUID_EXT3_MISALIGNSSE -->
<cpuid function='0x80000001' ecx='0x00000080'/>
</feature>
<feature name='3dnowprefetch'> <!-- CPUID_EXT3_3DNOWPREFETCH -->
<cpuid function='0x80000001' ecx='0x00000100'/>
</feature>
<feature name='osvw'> <!-- CPUID_EXT3_OSVW -->
<cpuid function='0x80000001' ecx='0x00000200'/>
</feature>
<feature name='skinit'> <!-- CPUID_EXT3_SKINIT -->
<cpuid function='0x80000001' ecx='0x00001000'/>
</feature>
<feature name='wdt'>
<cpuid function='0x80000001' ecx='0x00002000'/>
</feature>
<!-- models -->
<model name='486'>
<feature name='fpu'/>
<feature name='vme'/>
<feature name='pse'/>
</model>
<model name='pentium'>
<model name='486'/>
<feature name='de'/>
<feature name='tsc'/>
<feature name='msr'/>
<feature name='mce'/>
<feature name='cx8'/>
<feature name='mmx'/>
</model>
<model name='pentium2'>
<model name='pentium'/>
<feature name='pae'/>
<feature name='sep'/>
<feature name='mtrr'/>
<feature name='pge'/>
<feature name='mca'/>
<feature name='cmov'/>
<feature name='pat'/>
<feature name='pse36'/>
<feature name='fxsr'/>
</model>
<model name='pentium3'>
<model name='pentium2'/>
<feature name='sse'/>
</model>
<model name='pentiumpro'>
<feature name='fpu'/>
<feature name='de'/>
<feature name='pse'/>
<feature name='tsc'/>
<feature name='msr'/>
<feature name='mce'/>
<feature name='cx8'/>
<feature name='pge'/>
<feature name='cmov'/>
<feature name='pat'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='sse'/>
<feature name='sse2'/>
<feature name='pae'/>
<feature name='sep'/>
<feature name='apic'/>
</model>
<model name='qemu32'>
<model name='pentiumpro'/>
<feature name='pni'/>
</model>
<model name='coreduo'>
<model name='pentiumpro'/>
<feature name='vme'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pni'/>
<feature name='monitor'/>
<feature name='nx'/>
</model>
<model name='qemu64'>
<model name='pentiumpro'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='svm'/>
</model>
<model name='core2duo'>
<model name='pentiumpro'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='vme'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='monitor'/>
<feature name='ssse3'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
</model>
<model name='phenom'>
<model name='pentiumpro'/>
<vendor name='AMD'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='monitor'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='3dnow'/>
<feature name='3dnowext'/>
<feature name='mmxext'/>
<feature name='fxsr_opt'/>
<feature name='svm'/>
</model>
<model name='athlon'>
<model name='pentiumpro'/>
<vendor name='AMD'/>
<feature name='pse36'/>
<feature name='vme'/>
<feature name='mtrr'/>
<feature name='mmxext'/>
<feature name='3dnow'/>
<feature name='3dnowext'/>
</model>
<model name='n270'>
<model name='pentiumpro'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='vme'/>
<feature name='monitor'/>
<feature name='pni'/>
<feature name='ssse3'/>
<feature name='nx'/>
</model>
<model name='Conroe'>
<vendor name='Intel'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='pat'/>
<feature name='cmov'/>
<feature name='pge'/>
<feature name='sep'/>
<feature name='apic'/>
<feature name='cx8'/>
<feature name='mce'/>
<feature name='pae'/>
<feature name='msr'/>
<feature name='tsc'/>
<feature name='pse'/>
<feature name='de'/>
<feature name='fpu'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='ssse3'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='lahf_lm'/>
</model>
<model name='Penryn'>
<vendor name='Intel'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='pat'/>
<feature name='cmov'/>
<feature name='pge'/>
<feature name='sep'/>
<feature name='apic'/>
<feature name='cx8'/>
<feature name='mce'/>
<feature name='pae'/>
<feature name='msr'/>
<feature name='tsc'/>
<feature name='pse'/>
<feature name='de'/>
<feature name='fpu'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='cx16'/>
<feature name='ssse3'/>
<feature name='sse4.1'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='lahf_lm'/>
</model>
<model name='Nehalem'>
<vendor name='Intel'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='pat'/>
<feature name='cmov'/>
<feature name='pge'/>
<feature name='sep'/>
<feature name='apic'/>
<feature name='cx8'/>
<feature name='mce'/>
<feature name='pae'/>
<feature name='msr'/>
<feature name='tsc'/>
<feature name='pse'/>
<feature name='de'/>
<feature name='fpu'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='cx16'/>
<feature name='ssse3'/>
<feature name='sse4.1'/>
<feature name='sse4.2'/>
<feature name='popcnt'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='lahf_lm'/>
</model>
<model name='Opteron_G1'>
<vendor name='AMD'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='pat'/>
<feature name='cmov'/>
<feature name='pge'/>
<feature name='sep'/>
<feature name='apic'/>
<feature name='cx8'/>
<feature name='mce'/>
<feature name='pae'/>
<feature name='msr'/>
<feature name='tsc'/>
<feature name='pse'/>
<feature name='de'/>
<feature name='fpu'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
</model>
<model name='Opteron_G2'>
<vendor name='AMD'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='pat'/>
<feature name='cmov'/>
<feature name='pge'/>
<feature name='sep'/>
<feature name='apic'/>
<feature name='cx8'/>
<feature name='mce'/>
<feature name='pae'/>
<feature name='msr'/>
<feature name='tsc'/>
<feature name='pse'/>
<feature name='de'/>
<feature name='fpu'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='cx16'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='rdtscp'/>
<feature name='svm'/>
<feature name='lahf_lm'/>
</model>
<model name='Opteron_G3'>
<vendor name='AMD'/>
<feature name='sse2'/>
<feature name='sse'/>
<feature name='fxsr'/>
<feature name='mmx'/>
<feature name='pat'/>
<feature name='cmov'/>
<feature name='pge'/>
<feature name='sep'/>
<feature name='apic'/>
<feature name='cx8'/>
<feature name='mce'/>
<feature name='pae'/>
<feature name='msr'/>
<feature name='tsc'/>
<feature name='pse'/>
<feature name='de'/>
<feature name='fpu'/>
<feature name='mtrr'/>
<feature name='clflush'/>
<feature name='mca'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='cx16'/>
<feature name='monitor'/>
<feature name='popcnt'/>
<feature name='lm'/>
<feature name='syscall'/>
<feature name='nx'/>
<feature name='rdtscp'/>
<feature name='svm'/>
<feature name='sse4a'/>
<feature name='abm'/>
<feature name='misalignsse'/>
<feature name='lahf_lm'/>
</model>
</arch>
</cpus>

View File

@ -0,0 +1,14 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<features>
<pae/>
</features>
</cpu>
</host>
</capabilities>

View File

@ -0,0 +1,240 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<model>core2duo</model>
<vendor>Intel</vendor>
<topology sockets='7' cores='5' threads='3'/>
<feature name='lahf_lm'/>
<feature name='xtpr'/>
<feature name='cx16'/>
<feature name='tm2'/>
<feature name='est'/>
<feature name='vmx'/>
<feature name='ds_cpl'/>
<feature name='pbe'/>
<feature name='tm'/>
<feature name='ht'/>
<feature name='ss'/>
<feature name='acpi'/>
<feature name='ds'/>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>tcp</uri_transport>
</uri_transports>
</migration_features>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
<secmodel>
<model>qemuStacked</model>
<doi></doi>
</secmodel>
</host>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
<domain type='kvm'>
<emulator>/usr/bin/qemu-kvm</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
</domain>
</arch>
<features>
<cpuselection/>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
<domain type='kvm'>
<emulator>/usr/bin/qemu-kvm</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
</domain>
</arch>
<features>
<cpuselection/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='arm'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-arm</emulator>
<machine>integratorcp</machine>
<machine>syborg</machine>
<machine>musicpal</machine>
<machine>mainstone</machine>
<machine>n800</machine>
<machine>n810</machine>
<machine>cheetah</machine>
<machine>sx1</machine>
<machine>sx1-v1</machine>
<machine>tosa</machine>
<machine>akita</machine>
<machine>spitz</machine>
<machine>borzoi</machine>
<machine>terrier</machine>
<machine>connex</machine>
<machine>verdex</machine>
<machine>lm3s811evb</machine>
<machine>lm3s6965evb</machine>
<machine>realview-eb</machine>
<machine>realview-eb-mpcore</machine>
<machine>realview-pb-a8</machine>
<machine>realview-pbx-a9</machine>
<machine>versatilepb</machine>
<machine>versatileab</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='mips'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mips</emulator>
<machine>malta</machine>
<machine>mipssim</machine>
<machine>magnum</machine>
<machine>pica61</machine>
<machine>mips</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='mipsel'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mipsel</emulator>
<machine>malta</machine>
<machine>mipssim</machine>
<machine>magnum</machine>
<machine>pica61</machine>
<machine>mips</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='sparc'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<machine>SS-5</machine>
<machine>SS-10</machine>
<machine>SS-600MP</machine>
<machine>SS-20</machine>
<machine>Voyager</machine>
<machine>LX</machine>
<machine>SS-4</machine>
<machine>SPARCClassic</machine>
<machine>SPARCbook</machine>
<machine>SS-1000</machine>
<machine>SS-2000</machine>
<machine>SS-2</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='ppc'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<machine>g3beige</machine>
<machine>mpc8544ds</machine>
<machine>bamboo</machine>
<machine>ref405ep</machine>
<machine>taihu</machine>
<machine>mac99</machine>
<machine>prep</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>xen</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/xenner</emulator>
<machine>xenner</machine>
<domain type='kvm'>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>xen</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/xenner</emulator>
<machine>xenner</machine>
<domain type='kvm'>
</domain>
</arch>
<features>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,191 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<model>core2duo</model>
<topology sockets='1' cores='2' threads='1'/>
<feature name='lahf_lm'/>
<feature name='xtpr'/>
<feature name='cx16'/>
<feature name='tm2'/>
<feature name='est'/>
<feature name='vmx'/>
<feature name='ds_cpl'/>
<feature name='pbe'/>
<feature name='tm'/>
<feature name='ht'/>
<feature name='ss'/>
<feature name='acpi'/>
<feature name='ds'/>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>tcp</uri_transport>
</uri_transports>
</migration_features>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
<secmodel>
<model>qemuStacked</model>
<doi></doi>
</secmodel>
</host>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
</arch>
<features>
<cpuselection/>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
</arch>
<features>
<cpuselection/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='arm'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-arm</emulator>
<machine>integratorcp</machine>
<machine>syborg</machine>
<machine>musicpal</machine>
<machine>mainstone</machine>
<machine>n800</machine>
<machine>n810</machine>
<machine>cheetah</machine>
<machine>sx1</machine>
<machine>sx1-v1</machine>
<machine>tosa</machine>
<machine>akita</machine>
<machine>spitz</machine>
<machine>borzoi</machine>
<machine>terrier</machine>
<machine>connex</machine>
<machine>verdex</machine>
<machine>lm3s811evb</machine>
<machine>lm3s6965evb</machine>
<machine>realview-eb</machine>
<machine>realview-eb-mpcore</machine>
<machine>realview-pb-a8</machine>
<machine>realview-pbx-a9</machine>
<machine>versatilepb</machine>
<machine>versatileab</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='mips'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mips</emulator>
<machine>malta</machine>
<machine>mipssim</machine>
<machine>magnum</machine>
<machine>pica61</machine>
<machine>mips</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='mipsel'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-mipsel</emulator>
<machine>malta</machine>
<machine>mipssim</machine>
<machine>magnum</machine>
<machine>pica61</machine>
<machine>mips</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='sparc'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<machine>SS-5</machine>
<machine>SS-10</machine>
<machine>SS-600MP</machine>
<machine>SS-20</machine>
<machine>Voyager</machine>
<machine>LX</machine>
<machine>SS-4</machine>
<machine>SPARCClassic</machine>
<machine>SPARCbook</machine>
<machine>SS-1000</machine>
<machine>SS-2000</machine>
<machine>SS-2</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='ppc'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu-system-ppc</emulator>
<machine>g3beige</machine>
<machine>mpc8544ds</machine>
<machine>bamboo</machine>
<machine>ref405ep</machine>
<machine>taihu</machine>
<machine>mac99</machine>
<machine>prep</machine>
<domain type='qemu'>
</domain>
</arch>
</guest>
</capabilities>

View File

@ -0,0 +1,61 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
</cpu>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/libexec/qemu-kvm</emulator>
<machine>pc</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
<domain type='kvm'>
<emulator>/usr/libexec/qemu-kvm</emulator>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/libexec/qemu-kvm</emulator>
<machine>pc</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
<domain type='kvm'>
<emulator>/usr/libexec/qemu-kvm</emulator>
</domain>
</arch>
<features>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,89 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<features>
<vmx/>
</features>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>xenmigr</uri_transport>
</uri_transports>
</migration_features>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>xen</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
</guest>
<guest>
<os_type>xen</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
<features>
<pae/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<machine>xenfv</machine>
<domain type='xen'>
</domain>
</arch>
<features>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='yes'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<machine>xenfv</machine>
<domain type='xen'>
</domain>
</arch>
<features>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='yes'/>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,55 @@
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<features>
<svm/>
</features>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>xenmigr</uri_transport>
</uri_transports>
</migration_features>
<topology>
<cells num='1'>
<cell id='0'>
<cpus num='2'>
<cpu id='0'/>
<cpu id='1'/>
</cpus>
</cell>
</cells>
</topology>
</host>
<guest>
<os_type>xen</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
</guest>
<guest>
<os_type>xen</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
<features>
<pae/>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,42 @@
<capabilities>
<host>
<cpu>
<arch>ia64</arch>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>xenmigr</uri_transport>
</uri_transports>
</migration_features>
</host>
<guest>
<os_type>xen</os_type>
<arch name='ia64'>
<wordsize>64</wordsize>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<machine>xenpv</machine>
<domain type='xen'>
</domain>
</arch>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='ia64'>
<wordsize>64</wordsize>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<machine>xenfv</machine>
<domain type='xen'>
</domain>
</arch>
<features>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='yes'/>
</features>
</guest>
</capabilities>

264
tests/capabilities.py Normal file
View File

@ -0,0 +1,264 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
import os.path
import unittest
import virtinst.CapabilitiesParser as capabilities
def build_host_feature_dict(feature_list):
fdict = {}
for f in feature_list:
fdict[f] = capabilities.FEATURE_ON
return fdict
class TestCapabilities(unittest.TestCase):
def _compareGuest(self, (arch, os_type, domains, features), guest):
self.assertEqual(arch, guest.arch)
self.assertEqual(os_type, guest.os_type)
self.assertEqual(len(domains), len(guest.domains))
for n in range(len(domains)):
self.assertEqual(domains[n][0], guest.domains[n].hypervisor_type)
self.assertEqual(domains[n][1], guest.domains[n].emulator)
self.assertEqual(domains[n][2], guest.domains[n].machines)
for n in features:
self.assertEqual(features[n], guest.features[n])
def _buildCaps(self, filename):
path = os.path.join("tests/capabilities-xml", filename)
xml = file(path).read()
return capabilities.parse(xml)
def _testCapabilities(self, path, (host_arch, host_features), guests,
secmodel=None):
caps = self._buildCaps(path)
if host_arch:
self.assertEqual(host_arch, caps.host.arch)
for n in host_features:
self.assertEqual(host_features[n], caps.host.features[n])
if secmodel:
self.assertEqual(secmodel[0], caps.host.secmodel.model)
self.assertEqual(secmodel[1], caps.host.secmodel.doi)
map(self._compareGuest, guests, caps.guests)
def testCapabilities1(self):
host = ( 'x86_64', {'vmx': capabilities.FEATURE_ON})
guests = [
( 'x86_64', 'xen',
[['xen', None, []]], {} ),
( 'i686', 'xen',
[['xen', None, []]], { 'pae': capabilities.FEATURE_ON } ),
( 'i686', 'hvm',
[['xen', "/usr/lib64/xen/bin/qemu-dm", ['pc', 'isapc']]], { 'pae': capabilities.FEATURE_ON | capabilities.FEATURE_OFF } ),
( 'x86_64', 'hvm',
[['xen', "/usr/lib64/xen/bin/qemu-dm", ['pc', 'isapc']]], {} )
]
self._testCapabilities("capabilities-xen.xml", host, guests)
def testCapabilities2(self):
host = ( 'x86_64', {})
secmodel = ('selinux', '0')
guests = [
( 'x86_64', 'hvm',
[['qemu', '/usr/bin/qemu-system-x86_64', ['pc', 'isapc']]], {} ),
( 'i686', 'hvm',
[['qemu', '/usr/bin/qemu', ['pc', 'isapc']]], {} ),
( 'mips', 'hvm',
[['qemu', '/usr/bin/qemu-system-mips', ['mips']]], {} ),
( 'mipsel', 'hvm',
[['qemu', '/usr/bin/qemu-system-mipsel', ['mips']]], {} ),
( 'sparc', 'hvm',
[['qemu', '/usr/bin/qemu-system-sparc', ['sun4m']]], {} ),
( 'ppc', 'hvm',
[['qemu', '/usr/bin/qemu-system-ppc',
['g3bw', 'mac99', 'prep']]], {} ),
]
self._testCapabilities("capabilities-qemu.xml", host, guests, secmodel)
def testCapabilities3(self):
host = ( 'i686', {})
guests = [
( 'i686', 'hvm',
[['qemu', '/usr/bin/qemu', ['pc', 'isapc']],
['kvm', '/usr/bin/qemu-kvm', ['pc', 'isapc']]], {} ),
( 'x86_64', 'hvm',
[['qemu', '/usr/bin/qemu-system-x86_64', ['pc', 'isapc']]], {} ),
( 'mips', 'hvm',
[['qemu', '/usr/bin/qemu-system-mips', ['mips']]], {} ),
( 'mipsel', 'hvm',
[['qemu', '/usr/bin/qemu-system-mipsel', ['mips']]], {} ),
( 'sparc', 'hvm',
[['qemu', '/usr/bin/qemu-system-sparc', ['sun4m']]], {} ),
( 'ppc', 'hvm',
[['qemu', '/usr/bin/qemu-system-ppc',
['g3bw', 'mac99', 'prep']]], {} ),
]
self._testCapabilities("capabilities-kvm.xml", host, guests)
def testCapabilities4(self):
host = ( 'i686',
{ 'pae': capabilities.FEATURE_ON | capabilities.FEATURE_OFF })
guests = [
( 'i686', 'linux',
[['test', None, []]],
{ 'pae': capabilities.FEATURE_ON | capabilities.FEATURE_OFF } ),
]
self._testCapabilities("capabilities-test.xml", host, guests)
def testCapsLXC(self):
guests = [
("x86_64", "exe", [["lxc", "/usr/libexec/libvirt_lxc", []]], {}),
("i686", "exe", [["lxc", "/usr/libexec/libvirt_lxc", []]], {}),
]
self._testCapabilities("capabilities-lxc.xml",
(None, None), guests)
def testCapsTopology(self):
filename = "capabilities-test.xml"
caps = self._buildCaps(filename)
self.assertTrue(bool(caps.host.topology))
self.assertTrue(len(caps.host.topology.cells) == 2)
self.assertTrue(len(caps.host.topology.cells[0].cpus) == 8)
self.assertTrue(len(caps.host.topology.cells[0].cpus) == 8)
def testCapsCPUFeaturesOldSyntax(self):
filename = "rhel5.4-xen-caps-virt-enabled.xml"
host_feature_list = ["vmx"]
feature_dict = build_host_feature_dict(host_feature_list)
caps = self._buildCaps(filename)
for f in feature_dict.keys():
self.assertEquals(caps.host.features[f], feature_dict[f])
def testCapsCPUFeaturesOldSyntaxSVM(self):
filename = "rhel5.4-xen-caps.xml"
host_feature_list = ["svm"]
feature_dict = build_host_feature_dict(host_feature_list)
caps = self._buildCaps(filename)
for f in feature_dict.keys():
self.assertEquals(caps.host.features[f], feature_dict[f])
def testCapsCPUFeaturesNewSyntax(self):
filename = "libvirt-0.7.6-qemu-caps.xml"
host_feature_list = ['lahf_lm', 'xtpr', 'cx16', 'tm2', 'est', 'vmx',
'ds_cpl', 'pbe', 'tm', 'ht', 'ss', 'acpi', 'ds']
feature_dict = build_host_feature_dict(host_feature_list)
caps = self._buildCaps(filename)
for f in feature_dict.keys():
self.assertEquals(caps.host.features[f], feature_dict[f])
self.assertEquals(caps.host.cpu.model, "core2duo")
self.assertEquals(caps.host.cpu.vendor, "Intel")
self.assertEquals(caps.host.cpu.threads, "3")
self.assertEquals(caps.host.cpu.cores, "5")
self.assertEquals(caps.host.cpu.sockets, "7")
def testCapsUtilFuncs(self):
new_caps = self._buildCaps("libvirt-0.7.6-qemu-caps.xml")
new_caps_no_kvm = self._buildCaps(
"libvirt-0.7.6-qemu-no-kvmcaps.xml")
empty_caps = self._buildCaps("empty-caps.xml")
rhel_xen_enable_hvm_caps = self._buildCaps(
"rhel5.4-xen-caps-virt-enabled.xml")
rhel_xen_caps = self._buildCaps("rhel5.4-xen-caps.xml")
rhel_kvm_caps = self._buildCaps("rhel5.4-kvm-caps.xml")
def test_utils(caps, no_guests, is_hvm, is_kvm, is_bios_disable,
is_xenner):
self.assertEquals(caps.no_install_options(), no_guests)
self.assertEquals(caps.hw_virt_supported(), is_hvm)
self.assertEquals(caps.is_kvm_available(), is_kvm)
self.assertEquals(caps.is_bios_virt_disabled(), is_bios_disable)
self.assertEquals(caps.is_xenner_available(), is_xenner)
test_utils(new_caps, False, True, True, False, True)
test_utils(empty_caps, True, False, False, False, False)
test_utils(rhel_xen_enable_hvm_caps, False, True, False, False, False)
test_utils(rhel_xen_caps, False, True, False, True, False)
test_utils(rhel_kvm_caps, False, True, True, False, False)
test_utils(new_caps_no_kvm, False, True, False, False, False)
def testCPUMap(self):
caps = self._buildCaps("libvirt-0.7.6-qemu-caps.xml")
cpu_64 = caps.get_cpu_values("x86_64")
cpu_32 = caps.get_cpu_values("i486")
cpu_random = caps.get_cpu_values("mips")
def test_cpu_map(cpumap, vendors, features, cpus):
cpunames = sorted(map(lambda c: c.model, cpumap.cpus),
key=str.lower)
for v in vendors:
self.assertTrue(v in cpumap.vendors)
for f in features:
self.assertTrue(f in cpumap.features)
for c in cpus:
self.assertTrue(c in cpunames)
def test_single_cpu(cpumap, model, vendor, features):
cpu = cpumap.get_cpu(model)
self.assertEquals(cpu.vendor, vendor)
self.assertEquals(cpu.features, features)
self.assertEquals(cpu_64, cpu_32)
x86_vendors = ["AMD", "Intel"]
x86_features = [
'3dnow', '3dnowext', '3dnowprefetch', 'abm', 'acpi', 'apic',
'cid', 'clflush', 'cmov', 'cmp_legacy', 'cr8legacy', 'cx16',
'cx8', 'dca', 'de', 'ds', 'ds_cpl', 'est', 'extapic', 'fpu',
'fxsr', 'fxsr_opt', 'ht', 'hypervisor', 'ia64', 'lahf_lm', 'lm',
'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'msr',
'mtrr', 'nx', 'osvw', 'pae', 'pat', 'pbe', 'pdpe1gb', 'pge', 'pn',
'pni', 'popcnt', 'pse', 'pse36', 'rdtscp', 'sep', 'skinit', 'ss',
'sse', 'sse2', 'sse4.1', 'sse4.2', 'sse4a', 'ssse3', 'svm',
'syscall', 'tm', 'tm2', 'tsc', 'vme', 'vmx', 'wdt', 'x2apic',
'xtpr']
x86_cpunames = [
'486', 'athlon', 'Conroe', 'core2duo', 'coreduo', 'n270',
'Nehalem', 'Opteron_G1', 'Opteron_G2', 'Opteron_G3', 'Penryn',
'pentium', 'pentium2', 'pentium3', 'pentiumpro', 'phenom',
'qemu32', 'qemu64']
test_cpu_map(cpu_64, x86_vendors, x86_features, x86_cpunames)
test_cpu_map(cpu_random, [], [], [])
athlon_features = [
'3dnow', '3dnowext', 'apic', 'cmov', 'cx8', 'de', 'fpu', 'fxsr',
'mce', 'mmx', 'mmxext', 'msr', 'mtrr', 'pae', 'pat', 'pge', 'pse',
'pse36', 'sep', 'sse', 'sse2', 'tsc', 'vme']
test_single_cpu(cpu_64, "athlon", "AMD", athlon_features)
if __name__ == "__main__":
unittest.main()

View File

@ -0,0 +1,25 @@
<domain type='test' id='1'>
<name>origtest</name>
<uuid>db69fa1f-eef0-e567-3c20-3ef16f10376b</uuid>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<target dev='hda' bus='ide'/>
<source file='/default-pool/default-vol'/>
</disk>
<disk type='file' device='floppy'>
<target dev='fda' bus='fdc'/>
<readonly/>
</disk>
</devices>
</domain>

View File

@ -0,0 +1,36 @@
<domain type='test'>
<name>test-clone-noexist</name>
<currentMemory>204800</currentMemory>
<memory>409600</memory>
<uuid>abcd5678-1234-1234-1234-12345678FFFF</uuid>
<os>
<type arch='i686'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<vcpu>5</vcpu>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<source dev='/i/really/dont/exist'/>
<target dev='sda' bus='scsi'/>
</disk>
<interface type='network'>
<source network='default'/>
<model type='e1000'/>
</interface>
<interface type='user'>
<mac address='22:11:11:11:11:11'/>
</interface>
<parallel type='file'>
<source path='/tmp/foo.log'/>
</parallel>
</devices>
</domain>

View File

@ -0,0 +1,34 @@
<domain type='test' id='1'>
<name>origtest</name>
<uuid>db69fa1f-eef0-e567-3c20-3ef16f10376b</uuid>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<target dev='hda' bus='ide'/>
<source file='/tmp/__virtinst_cli_exist1.img'/>
</disk>
<disk type='file' device='disk'>
<target dev='hdb' bus='ide'/>
<source file='/tmp/__virtinst_cli_exist2.img'/>
</disk>
<disk type='file' device='cdrom'>
<target dev='hdc' bus='ide'/>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<readonly/>
</disk>
<disk type='file' device='floppy'>
<target dev='fda' bus='fdc'/>
<readonly/>
</disk>
</devices>
</domain>

View File

@ -0,0 +1,68 @@
<domain type="test" id="3">
<name>test-for-clone1</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory unit="KiB">409600</memory>
<currentMemory unit="KiB">204800</currentMemory>
<vcpu placement="static">5</vcpu>
<os>
<type arch="i686">hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="block" device="disk">
<source dev="/disk-pool/diskvol1-clone"/>
<target dev="sda" bus="scsi"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
<driver name="qemu" type="raw"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sdb" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="1"/>
</disk>
<disk type="block" device="disk">
<source dev="/default-pool/collidevol1.img"/>
<target dev="sdc" bus="scsi"/>
<readonly/>
<address type="drive" controller="0" bus="0" target="0" unit="2"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<target dev="sdd" bus="scsi"/>
<address type="drive" controller="0" bus="0" target="0" unit="3"/>
<source file="/default-pool/default-vol-clone"/>
</disk>
<disk type="block" device="disk">
<source dev="/default-pool/sharevol.img"/>
<target dev="sdx" bus="scsi"/>
<shareable/>
<address type="drive" controller="3" bus="0" target="0" unit="2"/>
</disk>
<controller type="scsi" index="0"/>
<controller type="scsi" index="1"/>
<controller type="scsi" index="2"/>
<controller type="scsi" index="3"/>
<interface type="network">
<mac address="00:11:22:33:44:55"/>
<source network="default"/>
<model type="e1000"/>
</interface>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
</interface>
<parallel type="file">
<source path="/tmp/foo.log"/>
<target port="0"/>
</parallel>
</devices>
</domain>

View File

@ -0,0 +1,36 @@
<domain type="test" id="2">
<name>newvm</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory unit="KiB">409600</memory>
<currentMemory unit="KiB">204800</currentMemory>
<vcpu placement="static">5</vcpu>
<os>
<type arch="i686">hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="disk">
<target dev="hda" bus="ide"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
<source file="/default-pool/newvm.img"/>
</disk>
<controller type="ide" index="0"/>
<interface type="user">
<mac address="00:11:22:33:44:55"/>
</interface>
<parallel type="file">
<source path="/tmp/foo.log"/>
<target port="0"/>
</parallel>
</devices>
</domain>

View File

@ -0,0 +1,5 @@
Generating output in 'virt-image' format to /tmp/__virtinst_tests__virtconv-outdir/
Converting disk 'root.raw' to type raw...
Converting disk 'scratch.raw' to type raw...
Converting disk 'data.raw' to type raw...
Done.

View File

@ -0,0 +1,52 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu cpuset='0,2,4,6,8,10,12,14'>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='network'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<console type='pty'/>
</devices>
</domain>
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu cpuset='0,2,4,6,8,10,12,14'>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='network'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,21 @@
<domain type='lxc'>
<name>foolxc</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>exe</type>
<init>/bin/sh</init>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,25 @@
<domain type='lxc'>
<name>foolxc</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>exe</type>
<init>/sbin/init</init>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem>
<source dir='/source'/>
<target dir='/'/>
</filesystem>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,32 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>7</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<pae/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst__cli_root.raw'/>
<target dev='xvda' bus='xen'/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst__cli_scratch.raw'/>
<target dev='xvdc' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='vga'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,35 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>7</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst__cli_root.raw'/>
<target dev='hda' bus='ide'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
<model type='e1000'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,28 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>7</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<pae/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst__cli_root.raw'/>
<target dev='xvda' bus='xen'/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst__cli_scratch.raw'/>
<target dev='xvdc' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
</devices>
</domain>

View File

@ -0,0 +1,110 @@
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<kernel>./virtinst-vmlinuz.</kernel>
<initrd>./virtinst-initrd.img.</initrd>
<cmdline>method=tests/cli-test-xml/faketree console=ttyS0</cmdline>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<cpu match='exact'>
<model>core2duo</model>
<vendor>Intel</vendor>
<feature policy='require' name='pbe'/>
<feature policy='require' name='tm2'/>
<feature policy='require' name='est'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='ds'/>
<feature policy='require' name='lahf_lm'/>
<feature policy='require' name='tm'/>
<feature policy='require' name='cx16'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='ds_cpl'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='acpi'/>
</cpu>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='vnc' port='-1'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<cpu match='exact'>
<model>core2duo</model>
<vendor>Intel</vendor>
<feature policy='require' name='pbe'/>
<feature policy='require' name='tm2'/>
<feature policy='require' name='est'/>
<feature policy='require' name='ss'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='ds'/>
<feature policy='require' name='lahf_lm'/>
<feature policy='require' name='tm'/>
<feature policy='require' name='cx16'/>
<feature policy='require' name='vmx'/>
<feature policy='require' name='ds_cpl'/>
<feature policy='require' name='xtpr'/>
<feature policy='require' name='acpi'/>
</cpu>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='vnc' port='-1'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,35 @@
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='fd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'/>
<console type='pty'/>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
<video>
<model type='qxl'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,130 @@
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="localtime"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='vnc' port='-1'/>
<console type='pty'/>
<sound model='ich6'/>
<video>
<model type='vga'/>
</video>
</devices>
</domain>
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="localtime"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='vnc' port='-1'/>
<console type='pty'/>
<sound model='ich6'/>
<video>
<model type='vga'/>
</video>
</devices>
</domain>
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="localtime"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu'/>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='vnc' port='-1'/>
<console type='pty'/>
<sound model='ich6'/>
<video>
<model type='vga'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,25 @@
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,21 @@
<domain type='lxc'>
<name>foolxc</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>exe</type>
<init>/usr/bin/httpd</init>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,165 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<numatune>
<memory mode='preferred' nodeset='1-3,5'/>
</numatune>
<os>
<type arch='i686'>hvm</type>
<loader>/foo/bar</loader>
<boot dev='network'/>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type='file' device='disk'>
<driver cache='writeback' io='threads'/>
<source file='/default-pool/UPPER'/>
<target dev='hda' bus='ide'/>
<shareable/>
<serial>WD-WMAP9A966149</serial>
</disk>
<disk type='file' device='disk'>
<driver error_policy='enospace'/>
<source file='/tmp/__virtinst_cli_new1.img'/>
<target dev='hdb' bus='ide'/>
<readonly/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sda' bus='sata'/>
<readonly/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0' bus='0' slot='4' function='7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0' bus='0' slot='4' function='0'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0' bus='0' slot='4' function='1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0' bus='0' slot='4' function='2'/>
</controller>
<filesystem accessmode='squash'>
<source dir='/source'/>
<target dir='/target'/>
</filesystem>
<interface type='user'>
<mac address='12:34:56:78:11:22'/>
</interface>
<interface type='bridge'>
<source bridge='foobar'/>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
</interface>
<input type='mouse' bus='ps2'/>
<serial type='tcp'>
<source mode='bind' host='127.0.0.1' service='2222'/>
<protocol type='telnet'/>
</serial>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
<smartcard mode='passthrough' type='spicevmc'>
</smartcard>
</devices>
<seclabel type='static' model='testSecurity' relabel='yes'>
<label>system_u:object_r:svirt_image_t:s0:c100,c200</label>
</seclabel>
</domain>
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<numatune>
<memory mode='preferred' nodeset='1-3,5'/>
</numatune>
<os>
<type arch='i686'>hvm</type>
<loader>/foo/bar</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type='file' device='disk'>
<driver cache='writeback' io='threads'/>
<source file='/default-pool/UPPER'/>
<target dev='hda' bus='ide'/>
<shareable/>
<serial>WD-WMAP9A966149</serial>
</disk>
<disk type='file' device='disk'>
<driver error_policy='enospace'/>
<source file='/tmp/__virtinst_cli_new1.img'/>
<target dev='hdb' bus='ide'/>
<readonly/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sda' bus='sata'/>
<readonly/>
</disk>
<controller type='usb' index='0' model='ich9-ehci1'>
<address type='pci' domain='0' bus='0' slot='4' function='7'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci1'>
<master startport='0'/>
<address type='pci' domain='0' bus='0' slot='4' function='0'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci2'>
<master startport='2'/>
<address type='pci' domain='0' bus='0' slot='4' function='1'/>
</controller>
<controller type='usb' index='0' model='ich9-uhci3'>
<master startport='4'/>
<address type='pci' domain='0' bus='0' slot='4' function='2'/>
</controller>
<filesystem accessmode='squash'>
<source dir='/source'/>
<target dir='/target'/>
</filesystem>
<interface type='user'>
<mac address='12:34:56:78:11:22'/>
</interface>
<interface type='bridge'>
<source bridge='foobar'/>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
</interface>
<input type='mouse' bus='ps2'/>
<serial type='tcp'>
<source mode='bind' host='127.0.0.1' service='2222'/>
<protocol type='telnet'/>
</serial>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
<smartcard mode='passthrough' type='spicevmc'>
</smartcard>
</devices>
<seclabel type='static' model='testSecurity' relabel='yes'>
<label>system_u:object_r:svirt_image_t:s0:c100,c200</label>
</seclabel>
</domain>

View File

@ -0,0 +1,4 @@
ERROR
--disk storage must be specified (override with --nodisks)
An install method must be specified
(--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)

View File

@ -0,0 +1,28 @@
<domain type='kvm'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='network'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
<model type='virtio'/>
</interface>
<input type='tablet' bus='usb'/>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,34 @@
<domain type='qemu'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<cpu match='exact'>
<model>Penryn</model>
</cpu>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='vnc' port='-1'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,31 @@
<domain type='qemu'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='sparc' machine='SS-20'>hvm</type>
<boot dev='fd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<interface type='network'>
<source network='default'/>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<graphics type='sdl' display=':3.4' xauth='/tmp/.Xauthority'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

View File

@ -0,0 +1,52 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='network'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<console type='pty'/>
</devices>
</domain>
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='network'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,115 @@
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>4</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<cpu>
<topology sockets='1' cores='4' threads='1'/>
</cpu>
<clock offset="localtime"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<console type='pty'/>
</devices>
</domain>
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>4</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<cpu>
<topology sockets='1' cores='4' threads='1'/>
</cpu>
<clock offset="localtime"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<console type='pty'/>
</devices>
</domain>
<domain type='test'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>4</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<cpu>
<topology sockets='1' cores='4' threads='1'/>
</cpu>
<clock offset="localtime"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/tmp/__virtinst_cli_exist2.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='tablet' bus='usb'/>
<console type='pty'/>
</devices>
</domain>

View File

@ -0,0 +1,28 @@
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,41 @@
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/><pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,28 @@
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,72 @@
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='ia64'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<kernel>./virtinst-vmlinuz.</kernel>
<initrd>./virtinst-initrd.img.</initrd>
<cmdline>method=tests/cli-test-xml/faketree</cmdline>
</os>
<features>
<acpi/><apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='ia64'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<console type='pty'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,61 @@
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='ia64'>linux</type>
<kernel>./virtinst-vmlinuz.</kernel>
<initrd>./virtinst-initrd.img.</initrd>
<cmdline>method=tests/cli-test-xml/faketree</cmdline>
</os>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,61 @@
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>linux</type>
<kernel>./virtinst-vmlinuz.</kernel>
<initrd>./virtinst-initrd.img.</initrd>
<cmdline>method=tests/cli-test-xml/faketree</cmdline>
</os>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>
<domain type='xen'>
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='file' device='disk'>
<source file='/tmp/__virtinst_cli_exist1.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='user'>
<mac address='00:11:22:33:44:55'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>

View File

@ -0,0 +1,28 @@
[general]
family = Fedora
timestamp = 1329856240.07
variant = Fedora
version = 17
packagedir =
arch = x86_64
[stage2]
mainimage = LiveOS/squashfs.img
[images-x86_64]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
boot.iso = images/boot.iso
[images-xen]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
[checksums]
images/boot.iso = sha256:a3c57709481b7bdc5fab8d5bd4a58aadbbf92df6cfe4bfafdebb280bf3de4a68
images/macboot.img = sha256:1022a1750882d731c27e096e5541a961290356d2faae8533757172454b59b64f
images/efiboot.img = sha256:7a8214df0627ee0116eb32c8462a0a71bc2f31b1e4a7a6d1fea497eae330d66b
images/pxeboot/initrd.img = sha256:dfb445af75d8a5e1f2ac1a021caf3854f96b6bbea249a3b37ea7929bdcad10a8
images/pxeboot/vmlinuz = sha256:dba59f0711ec8a2ef6b8981be15286ee2ea4d9b9e4d66eec0bb27b0518d463a5
repodata/repomd.xml = sha256:26f1267b3cce890db94129993e722f0fbe760361d0096b1399328ecd2c210d74

View File

@ -0,0 +1 @@
testiso

View File

@ -0,0 +1 @@
testinitrd

View File

@ -0,0 +1 @@
testvmlinuz

View File

@ -0,0 +1 @@
testinitrd

View File

@ -0,0 +1 @@
testvmlinuz

View File

@ -0,0 +1,56 @@
[addon-ClusteredStorage]
repository = ClusteredStorage
name = Clustered Storage
identity = ClusteredStorage/ClusteredStorage.cert
[images-x86_64]
initrd = images/pxeboot/initrd.img
boot.iso = images/boot.iso
kernel = images/pxeboot/vmlinuz
[general]
family = Red Hat Enterprise Linux
timestamp = 1279616972.112428
variant = Server
totaldiscs = 1
version = 6.0
discnum = 1
packagedir = Packages
variants = Server
arch = x86_64
[addon-LargeFileSystem]
repository = LargeFileSystem
name = Large Filesystem Support
identity = LargeFileSystem/LargeFileSystem.cert
[addon-LoadBalance]
repository = LoadBalance
name = Load Balance
identity = LoadBalance/LoadBalance.cert
[images-xen]
initrd = images/pxeboot/initrd.img
kernel = images/pxeboot/vmlinuz
[variant-Server]
addons = ClusteredStorage,HighAvailability,LargeFileSystem,LoadBalance
repository = Server/repodata
identity = Server/Server.cert
[addon-HighAvailability]
repository = HighAvailability
name = High Availability
identity = HighAvailability/HighAvailability.cert
[checksums]
images/pxeboot/initrd.img = sha256:40fda5e693f1f446623a6d94e0f89d7ec8963f096bf1613a6e0d22ae3efbee04
images/efiboot.img = sha256:ab891e10ad69408659bb710a1469b08db681cad96ef4b61635a32c2ffc711aa4
images/boot.iso = sha256:56e92c567fee183f83f30d1d001b4237ff27de74803f0ced827ec461e51b9608
images/pxeboot/vmlinuz = sha256:4bea4f88b26302d4cf095ef1fe6a0f0c064f2131b7d1b6460f30d03d08905336
images/install.img = sha256:4eb68c16b34da7165e23715a3bc5250edc7cc0bc1d3d04b0f3131724481390fa
images/efidisk.img = sha256:15faa40fe22e9797b2bd76c065e1f258848d007e901ff315aa44c4637b74024e
[stage2]
mainimage = images/install.img

View File

@ -0,0 +1 @@
testiso

View File

@ -0,0 +1 @@
testinitrd

View File

@ -0,0 +1 @@
testvmlinuz

View File

@ -0,0 +1 @@
testinitrd

View File

@ -0,0 +1 @@
testvmlinuz

View File

@ -0,0 +1 @@
testiso

View File

@ -0,0 +1 @@
testinitrd

View File

@ -0,0 +1 @@
testvmlinuz

View File

@ -0,0 +1,37 @@
<image>
<label>A simple test image</label>
<domain>
<boot type='xen'>
<guest>
<os_type>xen</os_type>
<arch>i686</arch>
<features><pae/></features>
</guest>
<os>
<loader>pygrub</loader>
</os>
<drive disk="/tmp/__virtinst__cli_root.raw" target="xvda"/>
<drive disk="/tmp/__virtinst__cli_scratch.raw" target="xvdc"/>
</boot>
<boot type="hvm">
<guest>
<arch>i686</arch>
<features><pae/></features>
</guest>
<os>
<type>hvm</type>
<loader dev="hd"/>
</os>
<drive disk="/tmp/__virtinst__cli_root.raw" target="hda"/>
</boot>
<devices>
<vcpu>7</vcpu>
<memory>262144</memory>
<interface/>
</devices>
</domain>
<storage>
<disk file="/tmp/__virtinst__cli_root.raw" format="raw" size="4096" use="system"/>
<disk file="/tmp/__virtinst__cli_scratch.raw" format="raw" size='100' use='scratch'/>
</storage>
</image>

View File

@ -0,0 +1,38 @@
<image>
<label>A simple test image</label>
<domain>
<boot type='xen'>
<guest>
<os_type>xen</os_type>
<arch>i686</arch>
<features><pae/></features>
</guest>
<os>
<loader>pygrub</loader>
</os>
<drive disk="/tmp/__virtinst__cli_root.raw" target="xvda"/>
<drive disk="/tmp/__virtinst__cli_scratch.raw" target="xvdc"/>
</boot>
<boot type="hvm">
<guest>
<arch>i686</arch>
<features><pae/></features>
</guest>
<os>
<type>hvm</type>
<loader dev="hd"/>
</os>
<drive disk="/tmp/__virtinst__cli_root.raw" target="hda"/>
</boot>
<devices>
<vcpu>7</vcpu>
<memory>262144</memory>
<interface/>
<graphics/>
</devices>
</domain>
<storage>
<disk file="/tmp/__virtinst__cli_root.raw" format="raw" size="4096" use="system"/>
<disk file="/tmp/__virtinst__cli_scratch.raw" format="raw" size='100' use='scratch'/>
</storage>
</image>

View File

@ -0,0 +1,48 @@
<image>
<name>test-image</name>
<label>A simple test image</label>
<domain>
<boot type='xen'>
<guest>
<os_type>xen</os_type>
<arch>i386</arch>
<features><pae/></features>
</guest>
<os>
<loader>pygrub</loader>
</os>
<drive disk="root.raw" target="xvda"/>
<drive disk="data.raw" target="xvdb"/>
<drive disk="scratch.raw" target="xvdc"/>
</boot>
<boot type="hvm">
<guest>
<arch>i686</arch>
<features><pae/></features>
</guest>
<os>
<type>hvm</type>
<loader dev="hd"/>
</os>
<drive disk="root.raw" target="hda"/>
<drive disk="data.raw" target="hdb"/>
<drive disk="scratch.raw" target="hdd"/>
</boot>
<devices>
<vcpu>7</vcpu>
<memory>262144</memory>
<interface/>
<graphics/>
</devices>
</domain>
<storage>
<disk file="disk.img"/>
<disk size="4096" use="system">
<partition file="boot.img"/>
<partition file="root.img"/>
</disk>
<disk file="root.raw" format="raw" size="4096" use="system"/>
<disk file="data.raw" format="raw" size='2048' use="data"/>
<disk file="scratch.raw" format="raw" size='100' use='scratch'/>
</storage>
</image>

View File

View File

View File

@ -0,0 +1,62 @@
#!/usr/bin/vmplayer
# Generated by setup.py
# http://virt-manager.org/
# This is a Workstation 5 or 5.5 config file and can be used with Player
config.version = "8"
virtualHW.version = "4"
guestOS = "other"
displayName = "test-image"
annotation = "None"
guestinfo.vmware.product.long = "test-image"
guestinfo.vmware.product.url = "http://virt-manager.org/"
guestinfo.vmware.product.class = "virtual machine"
numvcpus = "7"
memsize = "256"
MemAllowAutoScaleDown = "FALSE"
MemTrimRate = "-1"
uuid.action = "create"
tools.remindInstall = "TRUE"
hints.hideAll = "TRUE"
tools.syncTime = "TRUE"
serial0.present = "FALSE"
serial1.present = "FALSE"
parallel0.present = "FALSE"
logging = "TRUE"
log.fileName = "test-image.log"
log.append = "TRUE"
log.keepOld = "3"
isolation.tools.hgfs.disable = "FALSE"
isolation.tools.dnd.disable = "FALSE"
isolation.tools.copy.enable = "TRUE"
isolation.tools.paste.enabled = "TRUE"
floppy0.present = "FALSE"
# IDE disk
ide0:0.present = "TRUE"
ide0:0.fileName = "root.raw"
ide0:0.mode = "persistent"
ide0:0.startConnected = "TRUE"
ide0:0.writeThrough = "TRUE"
# IDE disk
ide0:1.present = "TRUE"
ide0:1.fileName = "data.raw"
ide0:1.mode = "persistent"
ide0:1.startConnected = "TRUE"
ide0:1.writeThrough = "TRUE"
# IDE disk
ide1:0.present = "TRUE"
ide1:0.fileName = "scratch.raw"
ide1:0.mode = "persistent"
ide1:0.startConnected = "TRUE"
ide1:0.writeThrough = "TRUE"
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
ethernet0.addressType = "generated"
ethernet0.generatedAddressOffset = "0"
ethernet0.autoDetect = "TRUE"

1440
tests/clitest.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/default-pool/testvol1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<source file='/default-pool/testvol2.img'/>
<target dev='hdb' bus='ide'/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,39 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<target dev="hda" bus="ide"/>
<source file="/cross-pool/new1.img"/>
</disk>
<disk type="file" device="disk">
<target dev="hdb" bus="ide"/>
<source file="/cross-pool/new2.img"/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

View File

@ -0,0 +1,46 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='floppy'>
<target dev='fdb' bus='fdc'/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sda' bus='scsi'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test2.img'/>
<target dev='sdb' bus='scsi'/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,46 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="block" device="disk">
<target dev="hda" bus="ide"/>
<source dev="/dev/loop0"/>
</disk>
<disk type="file" device="floppy">
<target dev="fdb" bus="fdc"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<disk type="file" device="disk">
<target dev="sdb" bus="scsi"/>
<source file="/tmp/clone2.img"/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

View File

@ -0,0 +1,46 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='floppy'>
<target dev='fdb' bus='fdc'/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sda' bus='scsi'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test2.img'/>
<target dev='sdb' bus='scsi'/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,46 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="block" device="disk">
<target dev="hda" bus="ide"/>
<source dev="/dev/loop0"/>
</disk>
<disk type="block" device="floppy">
<target dev="fdb" bus="fdc"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<disk type="file" device="disk">
<target dev="sdb" bus="scsi"/>
<source file="/tmp/clone2.img"/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

View File

@ -0,0 +1,29 @@
<domain type='xen'>
<name>test-full-clone</name>
<currentMemory>204800</currentMemory>
<memory>409600</memory>
<uuid>abcd5678-aaaa-1234-1234-12345678FFFF</uuid>
<os>
<type arch='i686'>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<features>
<acpi/><apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<vcpu>5</vcpu>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<source dev='/full-pool/testvol1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<interface type='user'>
<mac address='22:11:11:11:11:11'/>
</interface>
</devices>
</domain>

View File

@ -0,0 +1,42 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='block' device='disk'>
<source dev='/dev/loop0'/>
<target dev='hdb' bus='ide'/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
<target dev='vnet0'/>
</interface>
<interface type='bridge'>
<mac address='52:54:00:6c:bb:ca'/>
<source bridge='br0'/>
<target dev='my_manual_dev'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
<graphics type='vnc' port='5905'/>
</devices>
</domain>

View File

@ -0,0 +1,40 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="block" device="disk">
<target dev="hda" bus="ide"/>
<source dev="/dev/loop0"/>
</disk>
<disk type="file" device="disk">
<target dev="hdb" bus="ide"/>
<source file="/tmp/clone2.img"/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="bridge">
<mac address="22:23:45:67:89:01"/>
<source bridge="br0"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
<graphics type="vnc" port="-1"/>
</devices>
</domain>

View File

@ -0,0 +1,39 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/default-pool/testvol1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='block' device='disk'>
<source dev='/disk-pool/diskvol1'/>
<target dev='hdb' bus='ide'/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,39 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<target dev="hda" bus="ide"/>
<source file="/default-pool/new1.img"/>
</disk>
<disk type="block" device="disk">
<source dev="/disk-pool/new2.img"/>
<target dev="hdb" bus="ide"/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

View File

@ -0,0 +1,43 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hda' bus='ide'/>
<readonly/>
</disk>
<disk type='file' device='floppy'>
<target dev='fdb' bus='fdc'/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sda' bus='scsi'/>
<readonly/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,43 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<source file="/tmp/virtinst-test1.img"/>
<target dev="hda" bus="ide"/>
<readonly/>
</disk>
<disk type="file" device="floppy">
<target dev="fdb" bus="fdc"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

View File

@ -0,0 +1,18 @@
<domain type='test'>
<name>clone-orig</name>
<uuid>19618dc6-7895-956d-6056-8ebcd8061234</uuid>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='i686'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
</devices>
</domain>

View File

@ -0,0 +1,17 @@
<domain type="test">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>8388608</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="hd"/>
</os>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
</devices>
</domain>

View File

@ -0,0 +1,54 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hdb' bus='ide'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test2.img'/>
<target dev='sda' bus='scsi'/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sdb' bus='scsi'/>
<readonly/>
</disk>
<disk type='file' device='cdrom'>
<source file='/tmp/virtinst-test2.img'/>
<target dev='sdc' bus='scsi'/>
<readonly/>
<shareable/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,54 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="block" device="disk">
<target dev="hda" bus="ide"/>
<source dev="/dev/loop0"/>
</disk>
<disk type="file" device="disk">
<source file="/tmp/virtinst-test1.img"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<disk type="file" device="disk">
<target dev="sda" bus="scsi"/>
<source file="/tmp/clone2.img"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sdb" bus="scsi"/>
<readonly/>
</disk>
<disk type="file" device="cdrom">
<source file="/tmp/virtinst-test2.img"/>
<target dev="sdc" bus="scsi"/>
<readonly/>
<shareable/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

View File

@ -0,0 +1,46 @@
<domain type='kvm'>
<name>clone-orig</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test1.img'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='floppy'>
<target dev='fdb' bus='fdc'/>
</disk>
<disk type='block' device='cdrom'>
<target dev='sda' bus='scsi'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<source file='/tmp/virtinst-test2.img'/>
<target dev='sdb' bus='scsi'/>
</disk>
<interface type='network'>
<mac address='52:54:00:6c:a0:cb'/>
<source network='test1'/>
</interface>
<interface type='network'>
<mac address='52:54:00:6c:bb:ca'/>
<source network='test2'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/>
</devices>
</domain>

View File

@ -0,0 +1,46 @@
<domain type="kvm">
<name>clone-new</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>262144</memory>
<currentMemory>262144</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="i686" machine="pc">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<source file="/tmp/virtinst-test1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<disk type="file" device="floppy">
<target dev="fdb" bus="fdc"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<disk type="block" device="disk">
<target dev="sdb" bus="scsi"/>
<source dev="/dev/loop0"/>
</disk>
<interface type="network">
<mac address="22:23:45:67:89:00"/>
<source network="test1"/>
</interface>
<interface type="network">
<mac address="22:23:45:67:89:01"/>
<source network="test2"/>
</interface>
<input type="mouse" bus="ps2"/>
<graphics type="vnc" port="-1" autoport="yes" listen="127.0.0.1"/>
</devices>
</domain>

220
tests/clonetest.py Normal file
View File

@ -0,0 +1,220 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
import unittest
import os
import logging
import utils
from virtinst import CloneManager
CloneDesign = CloneManager.CloneDesign
ORIG_NAME = "clone-orig"
CLONE_NAME = "clone-new"
# Create some files to use as test images
FILE1 = "/tmp/virtinst-test1.img"
FILE2 = "/tmp/virtinst-test2.img"
P1_VOL1 = "/default-pool/testvol1.img"
P1_VOL2 = "/default-pool/testvol2.img"
P2_VOL1 = "/cross-pool/testvol1.img"
P2_VOL2 = "/cross-pool/testvol2.img"
POOL1 = "/default-pool"
POOL2 = "/cross-pool"
DISKPOOL = "/disk-pool"
local_files = [ FILE1, FILE2]
clonexml_dir = os.path.join(os.getcwd(), "tests/clone-xml")
clone_files = []
for tmpf in os.listdir(clonexml_dir):
black_list = [ "managed-storage", "cross-pool", "force", "skip",
"fullpool"]
if tmpf.endswith("-out.xml"):
tmpf = tmpf[0:(len(tmpf) - len("-out.xml"))]
if tmpf not in clone_files and tmpf not in black_list:
clone_files.append(tmpf)
conn = utils.open_testdriver()
class TestClone(unittest.TestCase):
def setUp(self):
for f in local_files:
os.system("touch %s" % f)
def tearDown(self):
for f in local_files:
os.unlink(f)
def _clone_helper(self, filebase, disks=None, force_list=None,
skip_list=None, compare=True, useconn=None):
"""Helper for comparing clone input/output from 2 xml files"""
infile = os.path.join(clonexml_dir, filebase + "-in.xml")
in_content = utils.read_file(infile)
cloneobj = CloneDesign(conn=useconn or conn)
cloneobj.original_xml = in_content
for force in force_list or []:
cloneobj.force_target = force
for skip in skip_list or []:
cloneobj.skip_target = skip
cloneobj = self._default_clone_values(cloneobj, disks)
if compare:
self._clone_compare(cloneobj, filebase)
self._clone_define(filebase)
else:
cloneobj.setup()
def _default_clone_values(self, cloneobj, disks=None):
"""Sets default values for the cloned VM."""
cloneobj.clone_name = "clone-new"
cloneobj.clone_uuid = "12345678-1234-1234-1234-123456789012"
cloneobj.clone_mac = "22:23:45:67:89:00"
cloneobj.clone_mac = "22:23:45:67:89:01"
if disks != None:
for disk in disks:
cloneobj.clone_devices = disk
else:
cloneobj.clone_devices = "/dev/loop0"
cloneobj.clone_devices = "/tmp/clone2.img"
cloneobj.clone_devices = "/tmp/clone3.img"
cloneobj.clone_devices = "/tmp/clone4.img"
cloneobj.clone_devices = "/tmp/clone5.img"
cloneobj.clone_devices = None
return cloneobj
def _clone_compare(self, cloneobj, outbase):
"""Helps compare output from passed clone instance with an xml file"""
outfile = os.path.join(clonexml_dir, outbase + "-out.xml")
cloneobj.setup()
utils.diff_compare(cloneobj.clone_xml, outfile)
def _clone_define(self, filebase):
"""Take the valid output xml and attempt to define it on the
connection to ensure we don't get any errors"""
outfile = os.path.join(clonexml_dir, filebase + "-out.xml")
outxml = utils.read_file(outfile)
utils.test_create(conn, outxml)
# Skip this test, since libvirt can add new XML elements to the defined
# XML (<video>) that make roundtrip a pain
def notestCloneGuestLookup(self):
"""Test using a vm name lookup for cloning"""
for base in clone_files:
infile = os.path.join(clonexml_dir, base + "-in.xml")
vm = None
try:
vm = conn.defineXML(utils.read_file(infile))
cloneobj = CloneDesign(conn=conn)
cloneobj.original_guest = ORIG_NAME
cloneobj = self._default_clone_values(cloneobj)
self._clone_compare(cloneobj, base)
finally:
if vm:
vm.undefine()
def testCloneFromFile(self):
"""Test using files for input and output"""
for base in clone_files:
self._clone_helper(base)
def testRemoteNoStorage(self):
"""Test remote clone where VM has no storage that needs cloning"""
useconn = utils.open_test_remote()
for base in [ "nostorage", "noclone-storage" ] :
self._clone_helper(base, disks=[], useconn=useconn)
def testRemoteWithStorage(self):
"""
Test remote clone with storage needing cloning. Should fail,
since libvirt has no storage clone api.
"""
useconn = utils.open_test_remote()
for base in [ "general-cfg" ] :
try:
self._clone_helper(base,
disks=["%s/1.img" % POOL1,
"%s/2.img" % POOL1],
useconn=useconn)
# We shouldn't succeed, so test fails
raise AssertionError("Remote clone with storage passed "
"when it shouldn't.")
except (ValueError, RuntimeError), e:
# Exception expected
logging.debug("Received expected exception: %s", str(e))
def testCloneStorage(self):
base = "managed-storage"
self._clone_helper(base, ["%s/new1.img" % POOL1,
"%s/new2.img" % DISKPOOL])
def testCloneStorageCrossPool(self):
base = "cross-pool"
self._clone_helper(base, ["%s/new1.img" % POOL2,
"%s/new2.img" % POOL2])
def testCloneStorageForce(self):
base = "force"
self._clone_helper(base,
disks=["/dev/loop0", None, "/tmp/clone2.img"],
force_list=["hda", "fdb", "sdb"])
def testCloneStorageSkip(self):
base = "skip"
self._clone_helper(base,
disks=["/dev/loop0", None, "/tmp/clone2.img"],
skip_list=["hda", "fdb"])
def testCloneFullPool(self):
base = "fullpool"
try:
self._clone_helper(base, disks=["/full-pool/test.img"],
compare=False)
except Exception:
return
raise AssertionError("Expected exception, but none raised.")
def testCloneManagedToUnmanaged(self):
base = "managed-storage"
# We are trying to clone from a pool (/default-pool) to unmanaged
# storage. For this case, the cloning needs to fail back to manual
# operation (no libvirt calls), but since /default-pool doesn't exist,
# this should fail.
try:
self._clone_helper(base, ["/tmp/new1.img", "/tmp/new2.img"])
raise AssertionError("Managed to unmanaged succeeded, expected "
"failure.")
except (ValueError, RuntimeError), e:
logging.debug("Received expected exception: %s", str(e))

Some files were not shown because too many files have changed in this diff Show More