Compare commits

..

No commits in common. "21af0030843ca2fab75e06019b788fdef5687b15" and "ca7d1bd5eeacc7a19179a54cf25c1ffbfbd69edf" have entirely different histories.

143 changed files with 3052 additions and 2969 deletions

View File

@ -1386,7 +1386,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/vir(file|event)\.c|src/libvirt-stream\.c|tests/(vir.+mock\.c|commandhelper\.c|qemusecuritymock\.c)|tools/nss/libvirt_nss_(leases|macs)\.c)|tools/virt-qemu-qmp-proxy$$)
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
((^tests/(nodedevmdevctl|viracpi|virhostcpu|virpcitest|virstoragetest|qemunbdkit|virshtest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)|\.bin)
((^tests/(nodedevmdevctl|viracpi|virhostcpu|virpcitest|virstoragetest|qemunbdkit)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)|\.bin)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
(^(src/(util/(vircommand|virdaemon)|lxc/lxc_controller)|tests/testutils)\.c$$)
@ -1437,7 +1437,7 @@ exclude_file_name_regexp--sc_require_config_h_first = \
^(examples/|tools/virsh-edit\.c$$|tests/virmockstathelpers\.c$$|scripts/rpcgen/tests/test_demo\.c$$)
exclude_file_name_regexp--sc_trailing_blank = \
/sysinfodata/.*\.data|/virhostcpudata/.*\.cpuinfo|tests/virshtestdata/.*$$
/sysinfodata/.*\.data|/virhostcpudata/.*\.cpuinfo$$
exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(scripts/apibuild.py|tests/virt-aa-helper-test|docs/js/.*\.js)$$
@ -1466,7 +1466,7 @@ exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
exclude_file_name_regexp--sc_prohibit_empty_first_line = \
^tests/vmwareverdata/fusion-5.0.3.txt|scripts/rpcgen/tests/demo\.c|^tests/virshtestdata/.*$$
^tests/vmwareverdata/fusion-5.0.3.txt|scripts/rpcgen/tests/demo\.c$$
exclude_file_name_regexp--sc_prohibit_useless_translation = \
^tests/virpolkittest.c

View File

@ -4390,14 +4390,6 @@ or:
starting the guest or hot-plugging the device and
``virNodeDeviceReAttach`` (or ``virsh nodedev-reattach``) after hot-unplug
or stopping the guest.
:since:`Since 10.3.0` an optional ``display`` attribute may be used to
enable using a vgpu device as a display device for the guest. Supported
values are either ``on`` or ``off`` (default). There is also an optional
``ramfb`` attribute with values of either ``on`` or ``off`` (default).
When enabled, the ``ramfb`` attribute provides a memory framebuffer device
to the guest. This framebuffer allows the vgpu to be used as a boot display
before the gpu driver is loaded within the guest. ``ramfb`` requires the
``display`` attribute to be set to ``on``.
``scsi``
For SCSI devices, user is responsible to make sure the device is not used
by host. If supported by the hypervisor and OS, the optional ``sgio`` (

View File

@ -326,6 +326,8 @@ Will change current directory to *directory*. The default directory
for the ``cd`` command is the home directory or, if there is no *HOME*
variable in the environment, the root directory.
This command is only available in interactive mode.
pwd
---
@ -7671,11 +7673,9 @@ If *--parent* is specified, add a column to the output table giving
the name of the parent of each snapshot. If *--roots* is specified,
the list will be filtered to just snapshots that have no parents.
If *--tree* is specified, the output will be in a tree format, listing
just snapshot names. These three options are mutually exclusive.
If *--name* is specified only the snapshot name is printed optionally
followed by a tab-separated name of the parent snapshot if *--parent* is used
as well. This option is mutually exclusive with *--tree*.
just snapshot names. These three options are mutually exclusive. If
*--name* is specified only the snapshot name is printed. This option is
mutually exclusive with *--tree*.
If *--from* is provided, filter the list to snapshots which are
children of the given ``snapshot``; or if *--current* is provided,
@ -7989,11 +7989,8 @@ the name of the parent of each checkpoint. If *--roots* is
specified, the list will be filtered to just checkpoints that have no
parents. If *--tree* is specified, the output will be in a tree
format, listing just checkpoint names. These three options are
mutually exclusive.
If *--name* is specified only the checkpoint name is printed optionally
followed by a tab-separated name of the parent checkpoint if *--parent* is used
as well. This option is mutually exclusive with *--tree*.
mutually exclusive. If *--name* is specified only the checkpoint name
is printed. This option is mutually exclusive with *--tree*.
If *--from* is provided, filter the list to checkpoints which are
children of the given ``checkpoint``. When used in isolation or with

View File

@ -6306,16 +6306,6 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
VIR_XML_PROP_NONE,
&mdevsrc->ramfb) < 0)
return -1;
} else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (virXMLPropTristateSwitch(node, "display",
VIR_XML_PROP_NONE,
&pcisrc->display) < 0)
return -1;
if (virXMLPropTristateSwitch(node, "ramfb",
VIR_XML_PROP_NONE,
&pcisrc->ramfb) < 0)
return -1;
}
switch (def->source.subsys.type) {
@ -26261,7 +26251,6 @@ virDomainHostdevDefFormat(virBuffer *buf,
const char *mode = virDomainHostdevModeTypeToString(def->mode);
virDomainHostdevSubsysSCSI *scsisrc = &def->source.subsys.u.scsi;
virDomainHostdevSubsysMediatedDev *mdevsrc = &def->source.subsys.u.mdev;
virDomainHostdevSubsysPCI *pcisrc = &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIVHost *scsihostsrc = &def->source.subsys.u.scsi_host;
const char *type;
@ -26330,14 +26319,7 @@ virDomainHostdevDefFormat(virBuffer *buf,
virBufferAsprintf(buf, " ramfb='%s'",
virTristateSwitchTypeToString(mdevsrc->ramfb));
}
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (pcisrc->display != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(buf, " display='%s'",
virTristateSwitchTypeToString(pcisrc->display));
if (pcisrc->ramfb != VIR_TRISTATE_SWITCH_ABSENT)
virBufferAsprintf(buf, " ramfb='%s'",
virTristateSwitchTypeToString(pcisrc->ramfb));
}
}
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);

View File

@ -236,8 +236,6 @@ struct _virDomainHostdevSubsysUSB {
struct _virDomainHostdevSubsysPCI {
virPCIDeviceAddress addr; /* host address */
virDeviceHostdevPCIDriverInfo driver;
virTristateSwitch display;
virTristateSwitch ramfb;
virBitmap *origstates;
};

View File

@ -1291,20 +1291,15 @@ virDomainDefHostdevValidate(const virDomainDef *def)
}
}
if (dev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
virTristateSwitch *ramfbsetting = NULL;
if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)
ramfbsetting = &dev->source.subsys.u.mdev.ramfb;
else if (dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
ramfbsetting = &dev->source.subsys.u.pci.ramfb;
if (ramfbsetting && *ramfbsetting == VIR_TRISTATE_SWITCH_ON) {
if (ramfbEnabled) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only one vgpu device can have 'ramfb' enabled"));
return -1;
}
ramfbEnabled = true;
if (dev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
dev->source.subsys.u.mdev.ramfb == VIR_TRISTATE_SWITCH_ON) {
if (ramfbEnabled) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only one vgpu device can have 'ramfb' enabled"));
return -1;
}
ramfbEnabled = true;
}
}

View File

@ -6267,7 +6267,6 @@
<ref name="pciaddress"/>
</element>
</element>
<ref name="hostdevsubsysvfiodisplay"/>
</interleave>
</define>
@ -6387,19 +6386,6 @@
</element>
</define>
<define name="hostdevsubsysvfiodisplay">
<optional>
<attribute name="ramfb">
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="display">
<ref name="virOnOff"/>
</attribute>
</optional>
</define>
<define name="hostdevsubsysmdev">
<attribute name="type">
<value>mdev</value>
@ -6411,7 +6397,16 @@
<value>vfio-ap</value>
</choice>
</attribute>
<ref name="hostdevsubsysvfiodisplay"/>
<optional>
<attribute name="ramfb">
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="display">
<ref name="virOnOff"/>
</attribute>
</optional>
<element name="source">
<ref name="mdevaddress"/>
</element>

View File

@ -654,11 +654,6 @@ foreach daemon : virt_daemons
install_dir: sbindir,
install_rpath: libvirt_rpath,
)
# libvirtd_prog is needed by the test suite
if daemon['name'] == 'libvirtd'
libvirtd_prog = bin
endif
endforeach

View File

@ -4735,16 +4735,10 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
virDomainNetTeamingInfo *teaming;
g_autofree char *host = virPCIDeviceAddressAsString(&pcisrc->addr);
const char *failover_pair_id = NULL;
const char *driver = NULL;
/* caller has to assign proper passthrough driver name */
switch (pcisrc->driver.name) {
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
/* ramfb support requires the nohotplug variant */
if (pcisrc->ramfb == VIR_TRISTATE_SWITCH_ON)
driver = "vfio-pci-nohotplug";
else
driver = "vfio-pci";
break;
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
@ -4768,13 +4762,11 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
failover_pair_id = teaming->persistent;
if (virJSONValueObjectAdd(&props,
"s:driver", driver,
"s:driver", "vfio-pci",
"s:host", host,
"s:id", dev->info->alias,
"p:bootindex", dev->info->effectiveBootIndex,
"S:failover_pair_id", failover_pair_id,
"S:display", qemuOnOffAuto(pcisrc->display),
"B:ramfb", pcisrc->ramfb,
NULL) < 0)
return NULL;

View File

@ -2639,8 +2639,6 @@ typedef struct _qemuSnapshotDeleteExternalData {
virDomainSnapshotDiskDef *snapDisk; /* snapshot disk definition */
virDomainDiskDef *domDisk; /* VM disk definition */
virStorageSource *diskSrc; /* source of disk we are deleting */
virStorageSource *diskSrcMetadata; /* copy of diskSrc to be used when updating
metadata because diskSrc is freed */
virDomainMomentObj *parentSnap;
virDomainDiskDef *parentDomDisk; /* disk definition from snapshot metadata */
virStorageSource *parentDiskSrc; /* backing disk source of the @diskSrc */
@ -2659,7 +2657,6 @@ qemuSnapshotDeleteExternalDataFree(qemuSnapshotDeleteExternalData *data)
if (!data)
return;
virObjectUnref(data->diskSrcMetadata);
virObjectUnref(data->job);
g_slist_free_full(data->disksWithBacking, g_free);
@ -2896,8 +2893,6 @@ qemuSnapshotDeleteExternalPrepareData(virDomainObj *vm,
if (!data->diskSrc)
return -1;
data->diskSrcMetadata = virStorageSourceCopy(data->diskSrc, false);
if (!virStorageSourceIsSameLocation(data->diskSrc, snapDiskSrc)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("VM disk source and snapshot disk source are not the same"));
@ -3054,7 +3049,6 @@ typedef struct _qemuSnapshotUpdateDisksData qemuSnapshotUpdateDisksData;
struct _qemuSnapshotUpdateDisksData {
virDomainMomentObj *snap;
virDomainObj *vm;
GSList *externalData;
int error;
};
@ -3084,8 +3078,7 @@ static int
qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
virDomainDef *def,
virDomainDef *parentDef,
virDomainSnapshotDiskDef *snapDisk,
virStorageSource *diskSrc)
virDomainSnapshotDiskDef *snapDisk)
{
virDomainDiskDef *disk = NULL;
@ -3098,7 +3091,7 @@ qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
if (!(parentDisk = qemuDomainDiskByName(parentDef, snapDisk->name)))
return -1;
if (virStorageSourceIsSameLocation(diskSrc, disk->src)) {
if (virStorageSourceIsSameLocation(snapDisk->src, disk->src)) {
virObjectUnref(disk->src);
disk->src = virStorageSourceCopy(parentDisk->src, false);
}
@ -3109,7 +3102,7 @@ qemuSnapshotUpdateDisksSingle(virDomainMomentObj *snap,
virStorageSource *next = disk->src->backingStore;
while (next) {
if (virStorageSourceIsSameLocation(diskSrc, next)) {
if (virStorageSourceIsSameLocation(snapDisk->src, next)) {
cur->backingStore = next->backingStore;
next->backingStore = NULL;
virObjectUnref(next);
@ -3135,15 +3128,17 @@ qemuSnapshotDeleteUpdateDisks(void *payload,
qemuDomainObjPrivate *priv = data->vm->privateData;
virQEMUDriver *driver = priv->driver;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
GSList *cur = NULL;
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(data->snap);
ssize_t i;
for (cur = data->externalData; cur; cur = g_slist_next(cur)) {
qemuSnapshotDeleteExternalData *curdata = cur->data;
for (i = 0; i < snapdef->ndisks; i++) {
virDomainSnapshotDiskDef *snapDisk = &(snapdef->disks[i]);
if (snapDisk->snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NO)
continue;
if (qemuSnapshotUpdateDisksSingle(snap, snap->def->dom,
data->snap->def->dom,
curdata->snapDisk,
curdata->diskSrcMetadata) < 0) {
data->snap->def->dom, snapDisk) < 0) {
data->error = -1;
}
@ -3154,8 +3149,7 @@ qemuSnapshotDeleteUpdateDisks(void *payload,
dom = data->snap->def->dom;
if (qemuSnapshotUpdateDisksSingle(snap, snap->def->inactiveDom,
dom, curdata->snapDisk,
curdata->diskSrcMetadata) < 0) {
dom, snapDisk) < 0) {
data->error = -1;
}
}
@ -3519,7 +3513,6 @@ qemuSnapshotDeleteUpdateParent(virDomainObj *vm,
static int
qemuSnapshotDiscardMetadata(virDomainObj *vm,
virDomainMomentObj *snap,
GSList *externalData,
bool update_parent)
{
qemuDomainObjPrivate *priv = vm->privateData;
@ -3544,17 +3537,14 @@ qemuSnapshotDiscardMetadata(virDomainObj *vm,
if (rep.err < 0)
ret = -1;
if (virDomainSnapshotIsExternal(snap)) {
data.snap = snap;
data.vm = vm;
data.externalData = externalData;
data.error = 0;
virDomainMomentForEachDescendant(snap,
qemuSnapshotDeleteUpdateDisks,
&data);
if (data.error < 0)
ret = -1;
}
data.snap = snap;
data.vm = vm;
data.error = 0;
virDomainMomentForEachDescendant(snap,
qemuSnapshotDeleteUpdateDisks,
&data);
if (data.error < 0)
ret = -1;
virDomainMomentMoveChildren(snap, snap->parent);
}
@ -3651,7 +3641,7 @@ qemuSnapshotDiscardImpl(virQEMUDriver *driver,
}
}
if (qemuSnapshotDiscardMetadata(vm, snap, externalData, update_parent) < 0)
if (qemuSnapshotDiscardMetadata(vm, snap, update_parent) < 0)
return -1;
return 0;

View File

@ -2478,14 +2478,6 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
_("Write filtering of PCI device configuration space is not supported by qemu"));
return -1;
}
if (hostdev->source.subsys.u.pci.display == VIR_TRISTATE_SWITCH_ON) {
if (def->ngraphics == 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("graphics device is needed for attribute value 'display=on' in <hostdev>"));
return -1;
}
}
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:

16
tests/libvirtd-fail Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# Ensure that libvirt fails when given nonexistent --config=FILE
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/src/libvirtd --version
fi
fail=0
$abs_top_builddir/src/libvirtd --config=no-such-conf --timeout=5 2> log
RET=$?
test "$RET" != "0" && exit 0 || exit 1

38
tests/libvirtd-pool Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
# Get coverage of virsh pool-define-as XML formatting
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
pwd=$(pwd) || fail=1
$abs_top_builddir/tools/virsh --connect test:///default \
pool-define-as --print-xml \
P dir src-host /src/path /src/dev S /target-path \
1>out 2>&1
cat <<EOF > pool-list-exp
<pool type='dir'>
<name>P</name>
<source>
<host name='src-host'/>
<dir path='/src/path'/>
<device path='/src/dev'/>
<name>S</name>
</source>
<target>
<path>/target-path</path>
</target>
</pool>
EOF
compare pool-list-exp out || fail=1
exit $fail

View File

@ -619,20 +619,6 @@ test(
suite: 'script',
)
# vsh based client self-test, which can be run directly from meson
test('virsh self-test',
virsh_prog,
args: [ '-q', '-c', 'test:///default', 'self-test' ],
suite: 'bin',
)
if conf.has('WITH_REMOTE')
test('virt-admin self-test',
virt_admin_prog,
args: [ '-q', 'self-test' ],
suite: 'bin',
)
endif
# helpers:
# each entry is a dictionary with following items:
@ -701,15 +687,26 @@ endforeach
test_scripts = []
if conf.has('WITH_LIBVIRTD')
test('libvirtd fail with missing config',
libvirtd_prog,
args: [ '--config=no-such-conf', '--timeout=5' ],
should_fail: true,
suite: 'bin',
)
test_scripts += [
'libvirtd-fail',
'libvirtd-pool',
'virsh-auth',
'virsh-checkpoint',
'virsh-cpuset',
'virsh-define-dev-segfault',
'virsh-int-overflow',
'virsh-optparse',
'virsh-output',
'virsh-read-bufsiz',
'virsh-read-non-seekable',
'virsh-schedinfo',
'virsh-self-test',
'virsh-snapshot',
'virsh-start',
'virsh-undefine',
'virsh-uriprecedence',
'virsh-vcpupin',
'virt-admin-self-test',
]
if conf.has('WITH_SECDRIVER_APPARMOR')

View File

@ -1,46 +0,0 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-D \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-D/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-D/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-D/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=D,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-D/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,pcspk-audiodev=audio1,acpi=on \
-accel kvm \
-cpu qemu64 \
-m size=262144k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":268435456}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev pty,id=charserial1 \
-device '{"driver":"isa-serial","chardev":"charserial1","id":"serial1","index":1}' \
-chardev pty,id=charserial2 \
-device '{"driver":"isa-serial","chardev":"charserial2","id":"serial2","index":2}' \
-chardev pty,id=charparallel0 \
-device '{"driver":"isa-parallel","chardev":"charparallel0","id":"parallel0"}' \
-chardev pty,id=charparallel1 \
-device '{"driver":"isa-parallel","chardev":"charparallel1","id":"parallel1"}' \
-chardev pty,id=charparallel2 \
-device '{"driver":"isa-parallel","chardev":"charparallel2","id":"parallel2"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-device '{"driver":"ES1370","id":"sound1","audiodev":"audio1","bus":"pci.0","addr":"0x2"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x3"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on

View File

@ -1,65 +0,0 @@
<domain type='kvm'>
<name>D</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='piix3-uhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<serial type='pty'>
<target type='isa-serial' port='1'>
<model name='isa-serial'/>
</target>
</serial>
<serial type='pty'>
<target type='isa-serial' port='2'>
<model name='isa-serial'/>
</target>
</serial>
<parallel type='pty'>
<target port='0'/>
</parallel>
<parallel type='pty'>
<target port='1'/>
</parallel>
<parallel type='pty'>
<target port='2'/>
</parallel>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<sound model='pcspk'/>
<sound model='es1370'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</sound>
<audio id='1' type='none'/>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</memballoon>
</devices>
</domain>

View File

@ -1 +0,0 @@
invalid argument: Failed to parse bitmap 'aaa'

View File

@ -1,12 +0,0 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<vcpu cpuset='aaa'>2</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
</os>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
</devices>
</domain>

View File

@ -1,33 +0,0 @@
LC_ALL=C \
PATH=/bin \
HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=QEMUGuest2,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest2/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=off \
-accel tcg \
-cpu qemu64 \
-m size=219136k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-vnc 127.0.0.1:0,audiodev=audio1 \
-device '{"driver":"vfio-pci-nohotplug","host":"0000:06:12.5","id":"hostdev0","display":"on","ramfb":true,"bus":"pci.0","addr":"0x2"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on

View File

@ -1,44 +0,0 @@
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0' model='piix3-uhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'>
<listen type='address'/>
</graphics>
<audio id='1' type='none'/>
<video>
<model type='none'/>
</video>
<hostdev mode='subsystem' type='pci' managed='no' display='on' ramfb='on'>
<source>
<address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</hostdev>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -1,33 +0,0 @@
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>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>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<controller type='usb' index='0'>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
</controller>
<graphics type='vnc'/>
<hostdev mode='subsystem' type='pci' display='on' ramfb='on'>
<source>
<address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
</source>
</hostdev>
<video>
<model type='none'/>
</video>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -1799,7 +1799,6 @@ mymain(void)
DO_TEST_CAPS_LATEST("console-compat");
DO_TEST_CAPS_LATEST("console-compat-auto");
DO_TEST_CAPS_LATEST("console-compat-crash");
DO_TEST_CAPS_LATEST("serial-vc-chardev");
DO_TEST_CAPS_LATEST("serial-pty-chardev");
@ -2076,7 +2075,6 @@ mymain(void)
DO_TEST_CAPS_LATEST("hostdev-pci-address");
DO_TEST_CAPS_LATEST("hostdev-pci-address-device");
DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-pci-duplicate");
DO_TEST_CAPS_LATEST("hostdev-pci-display-ramfb");
DO_TEST_CAPS_LATEST("hostdev-vfio");
DO_TEST_CAPS_LATEST("hostdev-vfio-multidomain");
DO_TEST_CAPS_LATEST("hostdev-mdev-precreated");
@ -2289,7 +2287,6 @@ mymain(void)
DO_TEST_CAPS_LATEST("cputune-numatune");
DO_TEST_CAPS_LATEST("vcpu-placement-static");
DO_TEST_CAPS_LATEST("cputune-cpuset-big-id");
DO_TEST_CAPS_LATEST_PARSE_ERROR("cpuset-invalid");
DO_TEST_CAPS_LATEST_PARSE_ERROR("numatune-memory-invalid-nodeset");
DO_TEST_CAPS_VER("numatune-memnode", "5.2.0");

280
tests/test-lib.sh Normal file
View File

@ -0,0 +1,280 @@
# test-lib.sh: source this file; set up for tests
# Copyright (C) 2008-2013, 2016 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see
# <http://www.gnu.org/licenses/>.
#
# Based on an idea from GNU coreutils
_scriptdir="$(unset CDPATH; cd $(dirname $0) && pwd)"
test -z "$abs_srcdir" && abs_srcdir=$_scriptdir
test -z "$abs_builddir" && abs_builddir=$_scriptdir
test -z "$abs_top_srcdir" && abs_top_srcdir=$_scriptdir/..
test -z "$abs_top_builddir" && abs_top_builddir=$_scriptdir/..
test -z "$LC_ALL" && LC_ALL=C
# Skip this test if the shell lacks support for functions.
unset function_test
eval 'function_test() { return 11; }; function_test'
if test $? != 11; then
echo "$0: /bin/sh lacks support for functions; skipping this test." 1>&2
(exit 77); exit 77
fi
test_intro()
{
name=$1
if test "$verbose" = "0" ; then
echo "TEST: $name"
printf " "
fi
}
test_skip_case()
{
counter=$1
name=$2
reason=$3
if test "$verbose" = "0" ; then
mod=`expr \( $counter + 40 - 1 \) % 40`
if test "$counter" != 1 && test "$mod" = 0 ; then
printf " %-3d\n" `expr $counter - 1`
printf " "
fi
printf "_"
else
printf "%3d) %-60s ... SKIP\n" "$counter" "$name"
printf " case skipped: %s\n" "$reason"
fi
}
test_result()
{
counter=$1
name=$2
status=$3
if test "$verbose" = "0" ; then
mod=`expr \( $counter + 40 - 1 \) % 40`
if test "$counter" != 1 && test "$mod" = 0 ; then
printf " %-3d\n" `expr $counter - 1`
printf " "
fi
if test "$status" = "0" ; then
printf "."
else
printf "!"
fi
else
if test "$status" = "0" ; then
printf "%3d) %-60s ... OK\n" "$counter" "$name"
else
printf "%3d) %-60s ... FAILED\n" "$counter" "$name"
fi
fi
}
test_final()
{
counter=$1
status=$2
if test "$verbose" = "0" ; then
len=`expr 39 - \( \( $counter - 1 \) % 40 \)`
printf "%${len}s" ""
if test "$status" = "0" ; then
printf " %-3d OK\n" $counter
else
printf " %-3d FAILED\n" $counter
fi
fi
}
skip_test_()
{
echo "$0: skipping test: $@" 1>&2
(exit 77); exit 77
}
require_acl_()
{
getfacl --version < /dev/null > /dev/null 2>&1 \
&& setfacl --version < /dev/null > /dev/null 2>&1 \
|| skip_test_ "This test requires getfacl and setfacl."
id -u bin > /dev/null 2>&1 \
|| skip_test_ "This test requires a local user named bin."
}
require_ulimit_()
{
ulimit_works=yes
# Expect to be able to exec a program in 10MB of virtual memory,
# but not in 20KB. I chose "date". It must not be a shell built-in
# function, so you can't use echo, printf, true, etc.
# Of course, in coreutils, I could use $top_builddir/src/true,
# but this should be able to work for other projects, too.
( ulimit -v 10000; date ) > /dev/null 2>&1 || ulimit_works=no
( ulimit -v 20; date ) > /dev/null 2>&1 && ulimit_works=no
test $ulimit_works = no \
&& skip_test_ "this shell lacks ulimit support"
}
require_readable_root_()
{
test -r / || skip_test_ "/ is not readable"
}
# Skip the current test if strace is not available or doesn't work.
require_strace_()
{
strace -V < /dev/null > /dev/null 2>&1 ||
skip_test_ 'no strace program'
strace -qe unlink echo > /dev/null 2>&1 ||
skip_test_ 'strace does not work'
}
require_built_()
{
skip_=no
for i in "$@"; do
case " $built_programs " in
*" $i "*) ;;
*) echo "$i: not built" 1>&2; skip_=yes ;;
esac
done
test $skip_ = yes && skip_test_ "required program(s) not built"
}
uid_is_privileged_()
{
# Make sure id -u succeeds.
my_uid=$(id -u) \
|| { echo "$0: cannot run \`id -u'" 1>&2; return 1; }
# Make sure it gives valid output.
case $my_uid in
0) ;;
*[!0-9]*)
echo "$0: invalid output (\`$my_uid') from \`id -u'" 1>&2
return 1 ;;
*) return 1 ;;
esac
}
skip_if_()
{
case $1 in
root) skip_test_ must be run as root ;;
non-root) skip_test_ must be run as non-root ;;
*) ;; # FIXME?
esac
}
require_selinux_()
{
case `ls -Zd .` in
'? .'|'unlabeled .')
skip_test_ "this system (or maybe just" \
"the current file system) lacks SELinux support"
;;
esac
}
test_expensive()
{
if test "$VIR_TEST_EXPENSIVE" != 1; then
skip_test_ '
This test is very expensive, so it is disabled by default.
To change the default, configure with: meson -Dexpensive_tests=enabled
'
fi
}
require_root_() { uid_is_privileged_ || skip_test_ "must be run as root"; }
skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; }
framework_failure() { error_ 'failure in testing framework'; }
mkfifo_or_skip_()
{
test $# = 1 || framework_failure
if ! mkfifo "$1"; then
# Make an exception of this case -- usually we interpret framework-creation
# failure as a test failure. However, in this case, when running on a SunOS
# system using a disk NFS mounted from OpenBSD, the above fails like this:
# mkfifo: cannot make fifo `fifo-10558': Not owner
skip_test_ 'NOTICE: unable to create test prerequisites'
fi
}
# Create mock XDG files/directories to avoid permission problems.
# As it points inside $test_dir_, it is automatically cleaned.
mock_xdg_()
{
export XDG_CONFIG_HOME="$t_/.config"
export XDG_CACHE_HOME="$t_/.cache"
export XDG_RUNTIME_HOME="$XDG_CACHE_HOME"
mkdir -p "$XDG_CONFIG_HOME/libvirt" "$XDG_CONFIG_HOME/virsh"
mkdir -p "$XDG_CACHE_HOME/libvirt" "$XDG_CACHE_HOME/virsh"
mkdir -p "$XDG_RUNTIME_HOME/libvirt" "$XDG_RUNTIME_HOME/virsh"
}
test_dir_=$(pwd)
this_test_() { echo "./$0" | sed 's,.*/,,'; }
this_test=$(this_test_)
verbose=0
if test -n "$VIR_TEST_DEBUG" || test -n "$VIR_TEST_VERBOSE" ; then
verbose=1
fi
debug() { :; }
if test "$VIR_TEST_DEBUG" = "2"; then
debug() { echo "$@"; }
fi
# This is a stub function that is run upon trap (upon regular exit and
# interrupt). Override it with a per-test function, e.g., to unmount
# a partition, or to undo any other global state changes.
cleanup_() { :; }
t_=$("mktemp" "-d" "$test_dir_/lv-$this_test.XXXXXXXXXX") \
|| error_ "failed to create temporary directory in $test_dir_"
# Run each test from within a temporary sub-directory named after the
# test itself, and arrange to remove it upon exception or normal exit.
trap 'st=$?; cleanup_; d='"$t_"';
cd '"$test_dir_"' && chmod -R u+rwx "$d" && rm -rf "$d" && exit $st' 0
trap '(exit $?); exit $?' 1 2 13 15
cd "$t_" || error_ "failed to cd to $t_"
if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
compare() { diff -u "$@"; }
elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
compare() { cmp -s "$@"; }
else
compare() { cmp "$@"; }
fi
# Local Variables:
# indent-tabs-mode: nil
# End:

178
tests/virsh-checkpoint Executable file
View File

@ -0,0 +1,178 @@
#!/bin/sh
# simple testing of checkpoint APIs on test driver
# Copyright (C) 2019 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
test_expensive
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
mock_xdg_ || framework_failure
# The test driver loses states between restarts, so we perform a script
# with some convenient markers for later post-processing of output.
$abs_top_builddir/tools/virsh --connect test:///default >out 2>err '
# Create a series of checkpoints, with names that intentionally sort
# differently by topology than by name. For now, it is not possible
# to create fanout without hacking through redefines.
checkpoint-create-as test c1
checkpoint-create-as test c1
checkpoint-create-as test c3
checkpoint-create-as test c2
# snapshots cannot be created while checkpoints exist
echo --err marker
snapshot-create-as test s1
echo --err marker
# Checking tree view (siblings sorted alphabetically)
checkpoint-list test --tree
# Demonstrate list filtering
checkpoint-list test --roots
checkpoint-list test --leaves
checkpoint-list test --parent --no-leaves
checkpoint-list test --from c3
checkpoint-list test --from c1 --descendants --name
# Now the tree is linear, so we have an unambiguous topological order
checkpoint-list test --name
checkpoint-list test --name --topological
# Capture some XML for later redefine
checkpoint-delete test c1
echo "<!--MarkerA-->"
checkpoint-dumpxml test c3
echo "<!--MarkerB-->"
checkpoint-dumpxml test c2
echo "<!--MarkerC-->"
# Deleting current checkpoint moves current up to remaining parent
checkpoint-delete test --children-only c3
checkpoint-list test --leaves --name
checkpoint-delete test --children c3
checkpoint-list test --leaves --name
# All done
' || fail=1
# First part is expected output, --tree results in trailing spaces,
# and checkpoint-list produces timestamps
sed 's/ *$//; s/[0-9-]\{10\} [0-9:.]* .[0-9]\{4\}/TIMESTAMP/;
/MarkerA/,/MarkerC/d' < out > out.cooked || fail=1
# Second part holds domain checkpoint XMLs
sed -n '/MarkerA/,/MarkerB/p' < out > c3.xml || fail=1
sed -n '/MarkerB/,/MarkerC/p' < out > c2.xml || fail=1
cat <<\EOF > exp || fail=1
Domain checkpoint c1 created
Domain checkpoint c3 created
Domain checkpoint c2 created
c1
|
+- c3
|
+- c2
Name Creation Time
-----------------------------------
c1 TIMESTAMP
Name Creation Time
-----------------------------------
c2 TIMESTAMP
Name Creation Time Parent
--------------------------------------------
c1 TIMESTAMP
c3 TIMESTAMP c1
Name Creation Time
-----------------------------------
c2 TIMESTAMP
c2
c3
c1
c2
c3
c1
c3
c2
Domain checkpoint c1 deleted
Domain checkpoint c3 children deleted
c3
Domain checkpoint c3 deleted
EOF
compare exp out.cooked || fail=1
cat <<EOF > exp || fail=1
error: operation failed: domain moment c1 already exists
error: marker
error: Operation not supported: cannot create snapshot while checkpoint exists
error: marker
EOF
compare exp err || fail=1
# Restore state with redefine
$abs_top_builddir/tools/virsh -c test:///default >out 2>err '
# Redefine must be in topological order; this will fail
checkpoint-create test --redefine c2.xml
echo --err marker
# This is the right order
checkpoint-create test --redefine c3.xml
checkpoint-create test --redefine c2.xml
checkpoint-list test --leaves --name
checkpoint-info test c2
' || fail=1
cat <<\EOF > exp || fail=1
Domain checkpoint c3 created from 'c3.xml'
Domain checkpoint c2 created from 'c2.xml'
c2
Name: c2
Domain: test
Parent: c3
Children: 0
Descendants: 0
EOF
compare exp out || fail=1
cat <<EOF > exp || fail=1
error: invalid argument: parent c3 for moment c2 not found
error: marker
EOF
compare exp err || fail=1
(exit $fail); exit $fail

46
tests/virsh-cpuset Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
# ensure that defining with an invalid vCPU cpuset elicits a diagnostic
# Copyright (C) 2008-2009 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# generate input
$abs_top_builddir/tools/virsh --connect test:///default dumpxml 1 > xml || fail=1
# require the presence of the string we'll transform
grep '<vcpu placement' xml > /dev/null || fail=1
sed "s/vcpu placement='static'>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1
# Require failure and a diagnostic.
$abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1
cat <<\EOF > exp || fail=1
error: Failed to define domain from xml-invalid
error: invalid argument: Failed to parse bitmap 'aaa'
EOF
compare exp out || fail=1
(exit $fail); exit $fail

View File

@ -1,11 +1,26 @@
<domain type='kvm'>
#!/bin/sh
# Exercise a bug whereby defining a valid domain could kill libvirtd.
# The bug can also be exercised with a simple define/dumpxml pair to virsh.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Domain definition from Cole Robinson.
cat <<\EOF > D.xml || fail=1
<domain type='test'>
<name>D</name>
<uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
@ -16,7 +31,7 @@
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<emulator>/usr/bin/qemu-system-i386</emulator>
<controller type='usb' index='0'/>
<serial type='pty'>
<target port='0'/>
@ -44,3 +59,18 @@
<memballoon model='virtio'/>
</devices>
</domain>
EOF
url=test:///default
$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
cat > exp <<EOF || fail=1
Domain 'D' defined from D.xml
$(cat D.xml)
EOF
compare exp out || fail=1
exit $fail

18
tests/virsh-int-overflow Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# Ensure that an invalid domain ID isn't interpreted as a valid one.
# Before, an ID of 2^32+2 would be treated just like an ID of 2.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
echo "error: failed to get domain '4294967298'" > exp || fail=1
$abs_top_builddir/tools/virsh --quiet \
--connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \
'domname 4294967298; quit' > /dev/null 2> err || fail=1
diff -u err exp || fail=1
exit $fail

292
tests/virsh-optparse Executable file
View File

@ -0,0 +1,292 @@
#!/bin/sh
# Ensure that virsh option parsing doesn't regress
# Copyright (C) 2011-2012, 2014 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
test_expensive
VIRSH=$abs_top_builddir/tools/virsh
if test "$VERBOSE" = yes; then
set -x
$VIRSH --version
fi
cat <<\EOF > exp-out || framework_failure
setvcpus: <domain> trying as domain NAME
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: found option <domain>: test
EOF
fail=0
test_url=test:///default
for args in \
'test 2' \
'--domain test 2' \
'--domain=test 2' \
'test --count 2' \
'test --count=2' \
'--domain test --count 2' \
'--domain=test --count 2' \
'--domain test --count=2' \
'--domain=test --count=2' \
'--count 2 --domain test' \
'--count 2 --domain=test' \
'--count=2 --domain test' \
'--count=2 --domain=test' \
'--count 2 test' \
'--count=2 test' \
; do
$VIRSH -k0 -d0 -c $test_url setvcpus $args >out 2>>err || fail=1
LC_ALL=C sort out | compare exp-out - || fail=1
done
# Another complex parsing example
cat <<\EOF > exp-out || framework_failure
<domainsnapshot>
<description>1&lt;2</description>
<memory file='d,e'/>
<disks>
<disk name='vda' snapshot='external'>
<source file='a&amp;b,c'/>
</disk>
<disk name='vdb'/>
</disks>
</domainsnapshot>
EOF
$VIRSH -q -c $test_url snapshot-create-as --print-xml test \
--diskspec 'vda,file=a&b,,c,snapshot=external' --description '1<2' \
--diskspec vdb --memspec file=d,,e >out 2>>err || fail=1
compare exp-out out || fail=1
cat <<\EOF > exp-out || framework_failure
<domainsnapshot>
<name>name</name>
<description>vda</description>
<disks>
<disk name='vdb'/>
</disks>
</domainsnapshot>
EOF
$VIRSH -q -c $test_url snapshot-create-as --print-xml test name vda vdb \
>out 2>>err || fail=1
compare exp-out out || fail=1
cat <<\EOF > exp-out || framework_failure
<domainsnapshot>
<name>name</name>
<description>desc</description>
<disks>
<disk name='vda'/>
<disk name='vdb'/>
</disks>
</domainsnapshot>
EOF
for args in \
'test name desc vda vdb' \
'test name desc --diskspec vda vdb' \
'test name desc --diskspec vda --diskspec vdb' \
'test name desc vda vdb' \
'test --diskspec vda name --diskspec vdb desc' \
'--description desc --name name --domain test vda vdb' \
'--description desc --diskspec vda --name name --domain test vdb' \
; do
$VIRSH -q -c $test_url snapshot-create-as --print-xml $args \
>out 2>>err || fail=1
compare exp-out out || fail=1
done
test -s err && fail=1
# Test a required argv
cat <<\EOF > exp-err || framework_failure
error: this function is not supported by the connection driver: virDomainQemuMonitorCommand
EOF
$VIRSH -q -c $test_url qemu-monitor-command test a >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
### Test a regular numeric option
# Non-numeric value
cat <<\EOF > exp-err || framework_failure
error: Numeric value 'abc' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start abc >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42WB' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start 42WB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with valid suffix. Suffixes are not supported for
# regular numeric options, so this value is rejected
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42MB' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start 42MB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value bigger than INT_MAX
cat <<\EOF > exp-err || framework_failure
error: Numeric value '2147483648' for <start> option is malformed or out of range
EOF
$VIRSH -q -c $test_url cpu-stats test --start 2147483648 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Negative numeric value. The value is not valid for the command
# we're testing, but it has been parsed correctly
cat <<\EOF > exp-err || framework_failure
error: Invalid value for start CPU
EOF
$VIRSH -q -c $test_url cpu-stats test --start -1 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
### Test a scaled numeric option
# Non-numeric value
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value 'abc' for <size> option is malformed or out of range
EOF
$VIRSH -q -c $test_url setmaxmem test abc >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value '42WB' for <size> option is malformed or out of range
error: invalid argument: unknown suffix 'WB'
EOF
$VIRSH -q -c $test_url setmaxmem test 42WB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with valid suffix
$VIRSH -q -c $test_url setmaxmem test 42MB --config >out 2>err || fail=1
test -s out && fail=1
test -s err && fail=1
# Numeric value bigger than INT_MAX. No failure here because
# scaled numeric values are unsigned long long
$VIRSH -q -c $test_url setmaxmem test 2147483648 --config >out 2>err || fail=1
test -s out && fail=1
test -s err && fail=1
# Negative numeric value
cat <<\EOF > exp-err || framework_failure
error: Scaled numeric value '-1' for <size> option is malformed or out of range
EOF
$VIRSH -q -c $test_url setmaxmem test -1 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Zero. The value is not valid for the command we're testing, but
# it has been parsed correctly
cat <<\EOF > exp-err || framework_failure
error: Unable to change MaxMemorySize
error: memory in virDomainSetMemoryFlags must not be zero
EOF
$VIRSH -q -c $test_url setmaxmem test 0 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value
$VIRSH -q -c $test_url setmaxmem test 42 --config >out 2>err || fail=1
test -s out && fail=1
test -s err && fail=1
### Test the <timeout> option (numeric option converted to ms)
# Non-numeric value
cat <<\EOF > exp-err || framework_failure
error: Numeric value 'abc' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout abc >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value that's too big to be converted to ms and still
# fit inside an int
cat <<\EOF > exp-err || framework_failure
error: Numeric value '2147484' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 2147484 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42WB' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 42WB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value with valid suffix. Suffixes are not supported for
# the <timeout> option, so this value is rejected
cat <<\EOF > exp-err || framework_failure
error: Numeric value '42MB' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 42MB >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Negative value
cat <<\EOF > exp-err || framework_failure
error: Numeric value '-1' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout -1 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Zero. This is not a valid timeout, but the value is parsed
# correctly
cat <<\EOF > exp-err || framework_failure
error: Numeric value '0' for <timeout> option is malformed or out of range
EOF
$VIRSH -q -c $test_url event --all --timeout 0 >out 2>err && fail=1
test -s out && fail=1
compare exp-err err || fail=1
# Numeric value. No events will be received and the command will
# fail after a second, but the value has been parsed correctly
cat <<\EOF > exp-out || framework_failure
event loop timed out
events received: 0
EOF
$VIRSH -q -c $test_url event --all --timeout 1 >out 2>err && fail=1
test -s err && fail=1
compare exp-out out || fail=1
(exit $fail); exit $fail

29
tests/virsh-output Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
. "$(dirname $0)/test-lib.sh"
test_expensive
if [ ! -x /bin/bash ]; then
echo skipping test - no bash
exit 77
fi
mock_xdg_ || framework_failure
export LIBVIRT_DEFAULT_URI='test:///default'
ln -s $abs_top_builddir/tools/virsh virsh
$abs_top_srcdir/tests/virsh-output-commands > out 2>&1
echo end >> out
if compare $abs_top_srcdir/tests/virsh-output.out out; then
exit 0
else
if [ "x$VIR_TEST_REGENERATE_OUTPUT" = "x1" ]; then
cp out $abs_top_srcdir/tests/virsh-output.out
fi
exit 1
fi

94
tests/virsh-output-commands Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
attach_disk()
{
./virsh attach-disk --print-xml --domain testdom $@ --source /nonexistent/file
}
set -x
./virsh attach-disk
./virsh attach-disk --print-xml --domain testdom $@ --source ""
./virsh attach-disk --print-xml --domain testdom $@ --source "" --sourcetype file
./virsh attach-disk --print-xml --domain testdom $@ --source "" --sourcetype blah
attach_disk --target hda
attach_disk --target hda --sourcetype file
attach_disk --target hda --sourcetype block
attach_disk --target hda --sourcetype nothing
attach_disk --target hda --sourcetype file --type disk
attach_disk --target hda --sourcetype block --type disk
attach_disk --target hda --sourcetype file --type cdrom
attach_disk --target hda --sourcetype block --type cdrom
attach_disk --target hda --sourcetype file --type blah
attach_disk --target hda --sourcetype block --type blah
attach_disk --target hda --sourcetype file --type disk --driver testdriver
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2
attach_disk --target hda --sourcetype file --type disk --subdriver raw
attach_disk --target hda --sourcetype file --type disk --cache none
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
attach_disk --target hda --sourcetype file --type disk --mode readonly
attach_disk --target hda --sourcetype file --type disk --mode shareable
attach_disk --target hda --sourcetype file --type disk --mode whatever
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias
attach_disk --target hda --sourcetype file --type disk --rawio
attach_disk --target hda --sourcetype file --type disk --multifunction
attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu
attach_disk --target hda --sourcetype file --type disk --address ide:1.2.3
attach_disk --target hda --sourcetype file --type disk --address ide:1.2.4
attach_disk --target hda --sourcetype file --type disk --address ide:1:2:5
attach_disk --target sda --sourcetype file --type disk --address ide:1.2.3
attach_disk --target vda --sourcetype file --type disk --address ide:1.2.3
attach_disk --target sda --sourcetype file --type disk --address usb:12.34
attach_disk --target sda --sourcetype file --type disk --address usb:12.3
attach_disk --target sda --sourcetype file --type disk --address usb:12:34
attach_disk --target vda --sourcetype file --type disk --address usb:12.34
attach_disk --target hda --sourcetype file --type disk --address usb:12.34
attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.3
attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.4
attach_disk --target sda --sourcetype file --type disk --address scsi:1:2:5
attach_disk --target hda --sourcetype file --type disk --address scsi:1.2.3
attach_disk --target vda --sourcetype file --type disk --address scsi:1.2.3
attach_disk --target sda --sourcetype file --type disk --address sata:1.2.3
attach_disk --target sda --sourcetype file --type disk --address sata:1.2.4
attach_disk --target sda --sourcetype file --type disk --address sata:1:2:5
attach_disk --target hda --sourcetype file --type disk --address sata:1.2.3
attach_disk --target vda --sourcetype file --type disk --address sata:1.2.3
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
attach_disk --target hda --sourcetype file --type disk --address pci:12.34.56.aa
attach_disk --target sda --sourcetype file --type disk --address pci:12.34.56.aa
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction
attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction
attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction
attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target vda --sourcetype file --type disk --address ccw:12:34:56
attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target hda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target sda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
attach_disk --target vda --sourcetype file --type disk --address test:12:34:56
attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
./virsh attach-disk --print-xml --domain testdom $@ --source "" --source-protocol AAA
./virsh attach-disk --print-xml --domain testdom $@ --source "" --source-protocol AAA
attach_disk --target hda --source-protocol AAA --sourcetype file
attach_disk --target hda --sourcetype network
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :port
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket

496
tests/virsh-output.out Normal file
View File

@ -0,0 +1,496 @@
+ ./virsh attach-disk
error: command 'attach-disk' requires <domain> option
error: command 'attach-disk' requires <source> option
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source ''
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source '' --sourcetype file
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source '' --sourcetype blah
error: command 'attach-disk' requires <target> option
+ attach_disk --target hda
+ ./virsh attach-disk --print-xml --domain testdom --target hda --source /nonexistent/file
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --source /nonexistent/file
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --source /nonexistent/file
<disk type='block'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype nothing
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype nothing --source /nonexistent/file
error: Unknown source type: 'nothing'
+ attach_disk --target hda --sourcetype file --type disk
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block --type disk
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type disk --source /nonexistent/file
<disk type='block' device='disk'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type cdrom
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type cdrom --source /nonexistent/file
<disk type='file' device='cdrom'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block --type cdrom
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type cdrom --source /nonexistent/file
<disk type='block' device='cdrom'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type blah
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type blah --source /nonexistent/file
<disk type='file' device='blah'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype block --type blah
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type blah --source /nonexistent/file
<disk type='block' device='blah'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --driver testdriver
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --driver testdriver --source /nonexistent/file
<disk type='file' device='disk'>
<driver name='testdriver'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver raw
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver raw --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='raw'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --cache none
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --cache none --source /nonexistent/file
<disk type='file' device='disk'>
<driver cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --cache none --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<serial>TEST_SERIAL</serial>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --mode readonly
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --mode readonly --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --mode shareable
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --mode shareable --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<shareable/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --mode whatever
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --mode whatever --source /nonexistent/file
error: No support for whatever in command 'attach-disk'
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --source /nonexistent/file
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<alias name='testalias'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --rawio
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --rawio --source /nonexistent/file
<disk type='file' device='disk' rawio='yes'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu --source /nonexistent/file
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' iothread='3' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
<alias name='testalias'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ide:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ide:1.2.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ide:1.2.4
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ide:1.2.4 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ide:1:2:5
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ide:1:2:5 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address ide:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address ide:1.2.3 --source /nonexistent/file
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address ide:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ide:1.2.3 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target sda --sourcetype file --type disk --address usb:12.34
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address usb:12.34 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address usb:12.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address usb:12.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='3'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address usb:12:34
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address usb:12:34 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address usb:12.34
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address usb:12.34 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target hda --sourcetype file --type disk --address usb:12.34
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address usb:12.34 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address scsi:1.2.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.4
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address scsi:1.2.4 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address scsi:1:2:5
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address scsi:1:2:5 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address scsi:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address scsi:1.2.3 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address scsi:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address scsi:1.2.3 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target sda --sourcetype file --type disk --address sata:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address sata:1.2.3 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address sata:1.2.4
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address sata:1.2.4 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
+ attach_disk --target sda --sourcetype file --type disk --address sata:1:2:5
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address sata:1:2:5 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address sata:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address sata:1.2.3 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address sata:1.2.3
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address sata:1.2.3 --source /nonexistent/file
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.78 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12:34:56:78 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.aa --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address pci:12.34.56.aa
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address pci:12.34.56.aa --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target sda --sourcetype file --type disk --address pci:12.34.56.aa
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address pci:12.34.56.aa --source /nonexistent/file
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa' multifunction='on'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address ccw:12:34:56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ccw:12:34:56 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
+ attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
+ attach_disk --target hda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
error: expecting an ide:00.00.00 address.
+ attach_disk --target sda --sourcetype file --type disk --address ccw:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type disk --address ccw:12.34.56 --source /nonexistent/file
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+ attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12.34.56 --source /nonexistent/file
error: Invalid address.
+ attach_disk --target vda --sourcetype file --type disk --address test:12:34:56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12:34:56 --source /nonexistent/file
error: Invalid address.
+ attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12.34.56 --source /nonexistent/file
error: Invalid address.
+ ./virsh attach-disk --print-xml --domain testdom --source '' --source-protocol AAA
error: command 'attach-disk' requires <target> option
+ ./virsh attach-disk --print-xml --domain testdom --source '' --source-protocol AAA
error: command 'attach-disk' requires <target> option
+ attach_disk --target hda --source-protocol AAA --sourcetype file
+ ./virsh attach-disk --print-xml --domain testdom --target hda --source-protocol AAA --sourcetype file --source /nonexistent/file
error: --source-protocol option requires --sourcetype network
+ attach_disk --target hda --sourcetype network
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source /nonexistent/file
error: --source-protocol option requires --sourcetype network
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname: --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port=''/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :port
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name :port --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port='port'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name : --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port=''/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket --source /nonexistent/file
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' socket='/nonexistent/socket'/>
</source>
<target dev='hda'/>
</disk>
+ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket
+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket --source /nonexistent/file
error: Option --source-host-transport is required by option --source-host-socket
end

49
tests/virsh-read-bufsiz Executable file
View File

@ -0,0 +1,49 @@
#!/bin/sh
# ensure that reading a file larger than BUFSIZ works
# Copyright (C) 2008, 2010 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Output a valid definition, to be used as input.
$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml.t || fail=1
# Change the VM name and UUID
sed -e "s|<name>test</name>|<name>newtest</name>|g" \
-e "\|<uuid>.*</uuid>|d" \
xml.t > xml
for i in before after; do
# The largest BUFSIZ I've seen is 128K. This is slightly larger.
printf %132000s ' ' > sp || fail=1
in=in-$i
# Append or prepend enough spaces to push the size over the limit:
( test $i = before && cat sp xml || cat xml sp ) > $in || fail=1
$abs_top_builddir/tools/virsh --connect test:///default define $in > out || fail=1
printf "Domain 'newtest' defined from $in\n\n" > exp || fail=1
compare exp out || fail=1
done
(exit $fail); exit $fail

51
tests/virsh-read-non-seekable Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
# ensure that certain file-reading commands can handle non-seekable files
# Copyright (C) 2008 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
cat <<\EOF > dom
<domain type='test' id='2'>
<name>t2</name>
<uuid>004b96e1-2d78-c30f-5aa5-000000000000</uuid>
<memory>8388608</memory>
<vcpu>2</vcpu>
<os>
<type>xen</type>
</os>
<on_reboot>restart</on_reboot>
<on_poweroff>destroy</on_poweroff>
<on_crash>restart</on_crash>
</domain>
EOF
$abs_top_builddir/tools/virsh -c test:///default define dom > /dev/null || fail=1
mkfifo_or_skip_ fifo
cat dom > fifo &
$abs_top_builddir/tools/virsh -c test:///default define fifo > /dev/null || fail=1
(exit $fail); exit $fail

40
tests/virsh-schedinfo Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# Ensure that virsh schedinfo --set invalid=val fails
# Copyright (C) 2010-2011, 2013 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
VIRSH=$abs_top_builddir/tools/virsh
if test "$VERBOSE" = yes; then
set -x
$VIRSH --version
fi
printf 'Scheduler : fair\n\n' > exp-out || framework_failure
printf 'error: invalid scheduler option: j\n' > exp-err || framework_failure
fail=0
test_url=test:///default
$VIRSH -c $test_url schedinfo 1 --set j=k >out 2>err && fail=1
compare exp-out out || fail=1
compare exp-err err || fail=1
(exit $fail); exit $fail

48
tests/virsh-self-test Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
# run virsh self-test to make sure command option structures are valid
# Copyright (C) 2016 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
fail=0
basename=$(basename $0)
if test "x$basename" = "xvirsh-self-test" ; then
binary=virsh
extra_args="-c test:///default"
elif test "x$basename" = "xvirt-admin-self-test" ; then
binary=virt-admin
extra_args=""
else
echo "Unknown binary: $basename";
exit 1
fi
test_intro "$0"
$abs_top_builddir/tools/${binary} ${extra_args} self-test > /dev/null
status=$?
test_result 1 "$0" ${status}
if test "${status}" != "0" ; then
fail=1
fi
test_final $counter $fail
(exit $fail); exit $fail

233
tests/virsh-snapshot Executable file
View File

@ -0,0 +1,233 @@
#!/bin/sh
# simple testing of snapshot APIs on test driver
# Copyright (C) 2019 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
test_expensive
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
mock_xdg_ || framework_failure
# The test driver loses states between restarts, so we perform a script
# with some convenient markers for later post-processing of output.
$abs_top_builddir/tools/virsh --connect test:///default >out 2>err '
# Create a series of snapshots, with names that intentionally sort
# differently by topology than by name. Use revert to create fanout.
snapshot-create-as test s1
snapshot-create-as test s1
snapshot-create-as test s3
snapshot-create-as test s2
snapshot-revert test s3
snapshot-create-as test s6
snapshot-create-as test s5
snapshot-revert test s6
snapshot-create-as test s4
snapshot-revert test s1
snapshot-create-as test s7
snapshot-create-as test s8
# checkpoints cannot be created while snapshots exist
echo --err marker
checkpoint-create-as test c1
echo --err marker
# Checking tree view (siblings sorted alphabetically)
snapshot-list test --tree
# Current was last one created, but we can change that
snapshot-current test --name
snapshot-current test s1
snapshot-current test --name
# Deleting current root leads to multiple roots, demonstrate list filtering
snapshot-delete test --current
echo --err marker
snapshot-current test --name
echo --err marker
snapshot-list test --roots
snapshot-list test --leaves
snapshot-list test --parent --no-leaves
snapshot-list test --from s3
snapshot-list test --from s3 --descendants --name
# More fun with delete flags, current node moves up to remaining parent
snapshot-current test s4
snapshot-delete test --children-only s6
snapshot-current test --name
snapshot-delete test --children s7
snapshot-current test --name
snapshot-delete test s6
snapshot-current test --name
# Now the tree is linear, so we have an unambiguous topological order
snapshot-list test --name
snapshot-list test --name --topological
# Capture some XML for later redefine
echo "<!--MarkerA-->"
snapshot-dumpxml test s3
echo "<!--MarkerB-->"
snapshot-dumpxml test s2
echo "<!--MarkerC-->"
# All done
' || fail=1
# First part is expected output, --tree results in trailing spaces,
# and snapshot-list produces timestamps
sed 's/ *$//; s/[0-9-]\{10\} [0-9:.]* .[0-9]\{4\}/TIMESTAMP/;
/MarkerA/,/MarkerC/d' < out > out.cooked || fail=1
# Second part holds domain snapshot XMLs
sed -n '/MarkerA/,/MarkerB/p' < out > s3.xml || fail=1
sed -n '/MarkerB/,/MarkerC/p' < out > s2.xml || fail=1
cat <<\EOF > exp || fail=1
Domain snapshot s1 created
Domain snapshot s3 created
Domain snapshot s2 created
Domain snapshot s3 reverted
Domain snapshot s6 created
Domain snapshot s5 created
Domain snapshot s6 reverted
Domain snapshot s4 created
Domain snapshot s1 reverted
Domain snapshot s7 created
Domain snapshot s8 created
s1
|
+- s3
| |
| +- s2
| +- s6
| |
| +- s4
| +- s5
|
+- s7
|
+- s8
s8
Snapshot s1 set as current
s1
Domain snapshot s1 deleted
Name Creation Time State
---------------------------------------------
s3 TIMESTAMP running
s7 TIMESTAMP running
Name Creation Time State
---------------------------------------------
s2 TIMESTAMP running
s4 TIMESTAMP running
s5 TIMESTAMP running
s8 TIMESTAMP running
Name Creation Time State Parent
------------------------------------------------------
s3 TIMESTAMP running
s6 TIMESTAMP running s3
s7 TIMESTAMP running
Name Creation Time State
---------------------------------------------
s2 TIMESTAMP running
s6 TIMESTAMP running
s2
s4
s5
s6
Snapshot s4 set as current
Domain snapshot s6 children deleted
s6
Domain snapshot s7 deleted
s6
Domain snapshot s6 deleted
s3
s2
s3
s3
s2
EOF
compare exp out.cooked || fail=1
cat <<EOF > exp || fail=1
error: operation failed: domain moment s1 already exists
error: marker
error: Operation not supported: cannot create checkpoint while snapshot exists
error: marker
error: marker
error: domain 'test' has no current snapshot
error: marker
EOF
compare exp err || fail=1
# Restore state with redefine
$abs_top_builddir/tools/virsh -c test:///default >out 2>err '
# Redefine must be in topological order; this will fail
snapshot-create test --redefine s2.xml --validate
echo --err marker
# This is the right order
snapshot-create test --redefine s3.xml --validate
snapshot-create test --redefine s2.xml --current --validate
snapshot-info test --current
' || fail=1
cat <<\EOF > exp || fail=1
Domain snapshot s3 created from 's3.xml'
Domain snapshot s2 created from 's2.xml'
Name: s2
Domain: test
Current: yes
State: running
Location: internal
Parent: s3
Children: 0
Descendants: 0
Metadata: yes
EOF
compare exp out || fail=1
cat <<EOF > exp || fail=1
error: invalid argument: parent s3 for moment s2 not found
error: marker
EOF
compare exp err || fail=1
(exit $fail); exit $fail

41
tests/virsh-start Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# ensure that virsh start works properly
# Copyright (C) 2008 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
test_url=test:///default
# expect this to fail
$abs_top_builddir/tools/virsh -c $test_url start test > out 2> err && fail=1
# stdout gets a newline
echo > exp || fail=1
compare exp out || fail=1
echo 'error: Domain is already active' > exp || fail=1
compare exp err || fail=1
(exit $fail); exit $fail

76
tests/virsh-undefine Executable file
View File

@ -0,0 +1,76 @@
#!/bin/sh
# exercise virsh's "undefine" command
# Copyright (C) 2008-2009, 2011 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Attempt to undefine a running domain, by domain name. Every time a new
# connection is opened to the test driver, it starts life with a new
# persistent running domain named 'test' with a different uuid, so
# testing this command requires batch mode use of virsh.
$abs_top_builddir/tools/virsh -c test:///default \
'dominfo test; undefine test; dominfo test' > out1 2>&1
test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1
Persistent: yes
Domain 'test' has been undefined
Persistent: no
EOF
compare exp out || fail=1
# A similar diagnostic when specifying a domain ID
$abs_top_builddir/tools/virsh -c test:///default \
'dominfo 1; undefine 1; dominfo 1' > out1 2>&1
test $? = 0 || fail=1
sed '/^Persistent/n; /:/d' < out1 > out
cat <<\EOF > exp || fail=1
Persistent: yes
Domain '1' has been undefined
Persistent: no
EOF
compare exp out || fail=1
# Succeed, now: first shut down, then undefine, both via name.
$abs_top_builddir/tools/virsh -c test:///default \
'shutdown test; undefine test; dominfo test' > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > expout || fail=1
Domain 'test' is being shutdown
Domain 'test' has been undefined
error: failed to get domain 'test'
EOF
compare expout out || fail=1
(exit $fail); exit $fail

97
tests/virsh-uriprecedence Executable file
View File

@ -0,0 +1,97 @@
#!/bin/sh
. "$(dirname $0)/test-lib.sh"
# This test checks if virsh obeys the proper precedence of different
# URI settings
test_intro "virsh-uriprecedence"
virsh_bin="$abs_top_builddir/tools/virsh"
virsh_cmd="$virsh_bin"
counter=0
ret=0
mock_xdg_ || framework_failure
is_uri_good()
{
echo "$1" | grep -F "$good_uri" >/dev/null
}
test_uri_internal()
{
test_name=$1
test_cmd="$virsh_cmd \"$2\""
result=0
debug "Running '$test_cmd'"
out="$($virsh_cmd "$2")"
if ! is_uri_good "$out"; then
debug "Invalid output: '$out'"
result=1
ret=1
fi
counter="$((counter+1))"
test_result "$counter" "$1" "$result"
}
test_uri_connect()
{
test_uri_internal "$1" "connect; uri"
}
test_uri_noconnect()
{
test_uri_internal "$1" "uri"
}
test_uri()
{
test_uri_connect "$1"
test_uri_noconnect "$1"
}
# Precedence is the following (lowest priority first):
#
# 1) if run as root, 'uri_default' from /etc/libvirtd/libvirt.conf,
# otherwise qemu:///session. There is no way to mock this file for
# virsh/libvirt.so and the user may have set anything in there that
# would spoil the test, so we don't test this
#
# 2) 'uri_default' from $XDG_CONFIG_HOME/libvirt/libvirt.conf
#
# 3) LIBVIRT_DEFAULT_URI
#
# 4) VIRSH_DEFAULT_CONNECT_URI
#
# 5) parameter -c (--connect)
unset LIBVIRT_DEFAULT_URI
unset VIRSH_DEFAULT_CONNECT_URI
bad_uri="test:///default?bad_uri"
good_uri="test:///default?good_uri"
printf "uri_default=\"%s\"\n" "$good_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf"
if uid_is_privileged_; then
counter="$((counter+1))"
test_skip_case "$counter" "User config file" "must not be run as root"
else
test_uri "User config file"
fi
printf "uri_default=\"%s\"\n" "$bad_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf"
export LIBVIRT_DEFAULT_URI="$good_uri"
test_uri "LIBVIRT_DEFAULT_URI"
export LIBVIRT_DEFAULT_URI="$bad_uri"
export VIRSH_DEFAULT_CONNECT_URI="$good_uri"
test_uri "VIRSH_DEFAULT_CONNECT_URI"
export VIRSH_DEFAULT_CONNECT_URI="$bad_uri"
virsh_cmd="$virsh_bin --connect $good_uri"
test_uri "Parameter"
test_final "$counter" "$ret"
(exit "$ret"); exit "$ret"

100
tests/virsh-vcpupin Executable file
View File

@ -0,0 +1,100 @@
#!/bin/sh
# ensure that an invalid CPU spec elicits a diagnostic
# Copyright (C) 2008 Red Hat, Inc.
# 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, see
# <http://www.gnu.org/licenses/>.
. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
fail=0
# Invalid syntax.
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: Numeric value 'a' for <vcpu> option is malformed or out of range
EOF
compare exp out || fail=1
# An out-of-range vCPU number deserves a diagnostic, too.
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: invalid argument: requested vcpu '100' is not present in the domain
EOF
compare exp out || fail=1
# Negative number
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: Numeric value '-100' for <vcpu> option is malformed or out of range
EOF
compare exp out || fail=1
# missing argument
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test --cpulist 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpupin: Missing vCPU number in pin mode.
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information with live flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --live > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of live cpu count 2
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information without flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of live cpu count 2
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information with config flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --config > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of persistent cpu count 2
EOF
compare exp out || fail=1
# An out-of-range vCPU number when get information with current flag
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --current > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpu 100 is out of range of live cpu count 2
EOF
compare exp out || fail=1
(exit $fail); exit $fail

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
setvcpus test 2
setvcpus --domain test 2
setvcpus --domain=test 2
setvcpus test --count 2
setvcpus test --count=2
setvcpus --domain test --count 2
setvcpus --domain=test --count 2
setvcpus --domain test --count=2
setvcpus --domain=test --count=2
setvcpus --count 2 --domain test
setvcpus --count 2 --domain=test
setvcpus --count=2 --domain test
setvcpus --count=2 --domain=test
setvcpus --count 2 test
setvcpus --count=2 test

View File

@ -1,91 +0,0 @@
commands: "setvcpus test 2
setvcpus --domain test 2
setvcpus --domain=test 2
setvcpus test --count 2
setvcpus test --count=2
setvcpus --domain test --count 2
setvcpus --domain=test --count 2
setvcpus --domain test --count=2
setvcpus --domain=test --count=2
setvcpus --count 2 --domain test
setvcpus --count 2 --domain=test
setvcpus --count=2 --domain test
setvcpus --count=2 --domain=test
setvcpus --count 2 test
setvcpus --count=2 test
"
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: count(optdata): 2
setvcpus: domain(optdata): test
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME
setvcpus: found option <domain>: test
setvcpus: <domain> trying as domain NAME

View File

@ -1,79 +0,0 @@
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype nothing
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block --type disk
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type cdrom
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block --type cdrom
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type blah
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype block --type blah
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --driver testdriver
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver raw
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --cache none
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --mode readonly
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --mode shareable
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --mode whatever
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --rawio
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none --driver qemu
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ide:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ide:1.2.4
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ide:1:2:5
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address ide:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ide:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address usb:12.34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address usb:12.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address usb:12:34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address usb:12.34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address usb:12.34
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address scsi:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address scsi:1.2.4
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address scsi:1:2:5
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address scsi:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address scsi:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address sata:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address sata:1.2.4
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address sata:1:2:5
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address sata:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address sata:1.2.3
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.78
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12:34:56:78
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.aa
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address pci:12.34.56.aa
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address pci:12.34.56.aa
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.78 --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12:34:56:78 --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address pci:12.34.56.aa --multifunction
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ccw:12:34:56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda --sourcetype file --type disk --address ccw:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address test:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address test:12:34:56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda --sourcetype file --type disk --address test:12.34.56
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --source-protocol AAA --sourcetype file
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name :port
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name :
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket

View File

@ -1,343 +0,0 @@
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
error: Unknown source type: 'nothing'
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block' device='disk'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block' device='cdrom'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='blah'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='block' device='blah'>
<source dev='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver name='testdriver'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='raw'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='qcow2' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<serial>TEST_SERIAL</serial>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<shareable/>
</disk>
error: No support for whatever in command 'attach-disk'
<disk type='file' device='disk'>
<driver type='qcow2'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<alias name='testalias'/>
</disk>
<disk type='file' device='disk' rawio='yes'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' iothread='3' cache='none'/>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<readonly/>
<alias name='testalias'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='hda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='usb' bus='12' port='34'/>
</disk>
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
error: expecting an ide:00.00.00 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='3'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='4'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='sda'/>
<address type='drive' controller='1' bus='2' unit='5'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0x78' multifunction='on'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='pci' domain='0x0012' bus='0x34' slot='0x56' function='0xaa' multifunction='on'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
<disk type='file' device='disk'>
<source file='/nonexistent/file'/>
<target dev='vda'/>
<address type='ccw' cssid='0x12' ssid='0x34' devno='0x0056'/>
</disk>
error: expecting an ide:00.00.00 address.
error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
error: Invalid address.
error: Invalid address.
error: Invalid address.
error: --source-protocol option requires --sourcetype network
error: --source-protocol option requires --sourcetype network
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='hostname' port=''/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port='port'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host name='' port=''/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' name='hostname' port='port'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp'/>
</source>
<target dev='hda'/>
</disk>
<disk type='network'>
<source protocol='TEST' name='/nonexistent/file'>
<host transport='trnsp' socket='/nonexistent/socket'/>
</source>
<target dev='hda'/>
</disk>
error: Option --source-host-transport is required by option --source-host-socket
## Exit code: 1

View File

@ -1,3 +0,0 @@
blkiotune fv0
blkiotune fv0 --weight 500 --device-weights /dev/hda,1000 --device-read-iops-sec /dev/hda,1000 --device-write-iops-sec /dev/hda,1000 --device-read-bytes-sec /dev/hda,1000 --device-write-bytes-sec /dev/hda,1000
blkiotune fv0

View File

@ -1,15 +0,0 @@
weight : 800
device_weight : /dev/hda,700
device_read_iops_sec: /dev/hda,700
device_write_iops_sec: /dev/hda,700
device_read_bytes_sec: /dev/hda,700
device_write_bytes_sec: /dev/hda,700
weight : 500
device_weight : /dev/hda,1000
device_read_iops_sec: /dev/hda,1000
device_write_iops_sec: /dev/hda,1000
device_read_bytes_sec: /dev/hda,1000
device_write_bytes_sec: /dev/hda,1000

View File

@ -1,41 +0,0 @@
<domaincheckpoint>
<name>c2</name>
<parent>
<name>c3</name>
</parent>
<creationTime>1234</creationTime>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c2'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>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'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>

View File

@ -1,38 +0,0 @@
<domaincheckpoint>
<name>c3</name>
<creationTime>5678</creationTime>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c3'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>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'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>

View File

@ -1,13 +0,0 @@
Redefine must be in topological order; this will fail
error: invalid argument: parent c3 for moment c2 not found
correct order
Domain checkpoint c3 created from 'checkpoint-c3.xml'
Domain checkpoint c2 created from 'checkpoint-c2.xml'
Name: c2
Domain: test
Parent: c3
Children: 0
Descendants: 0

View File

@ -1,35 +0,0 @@
echo Create a series of checkpoints, with names that intentionally sort
echo differently by topology than by name. For now, it is not possible
echo to create fanout without hacking through redefines.
checkpoint-create-as test c1
checkpoint-create-as test c1
checkpoint-create-as test c3
checkpoint-create-as test c2
echo snapshots cannot be created while checkpoints exist
snapshot-create-as test s1
echo Checking tree view (siblings sorted alphabetically)
checkpoint-list test --tree
echo Demonstrate list filtering
checkpoint-list test --roots --name
checkpoint-list test --leaves --name
checkpoint-list test --parent --no-leaves --name
checkpoint-list test --from c3 --name
checkpoint-list test --from c1 --descendants --name
echo Now the tree is linear, so we have an unambiguous topological order
checkpoint-list test --name
checkpoint-list test --name --topological
echo validate XML
checkpoint-delete test c1
checkpoint-dumpxml test c3
checkpoint-dumpxml test c2
echo Deleting current checkpoint moves current up to remaining parent
checkpoint-delete test --children-only c3
checkpoint-list test --leaves --name
checkpoint-delete test --children c3
checkpoint-list test --leaves --name

View File

@ -1,133 +0,0 @@
Create a series of checkpoints, with names that intentionally sort
differently by topology than by name. For now, it is not possible
to create fanout without hacking through redefines.
Domain checkpoint c1 created
error: operation failed: domain moment c1 already exists
Domain checkpoint c3 created
Domain checkpoint c2 created
snapshots cannot be created while checkpoints exist
error: Operation not supported: cannot create snapshot while checkpoint exists
Checking tree view (siblings sorted alphabetically)
c1
|
+- c3
|
+- c2
Demonstrate list filtering
c1
c2
c1
c3 c1
c2
c2
c3
Now the tree is linear, so we have an unambiguous topological order
c1
c2
c3
c1
c3
c2
validate XML
Domain checkpoint c1 deleted
<domaincheckpoint>
<name>c3</name>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c3'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>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'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>
<domaincheckpoint>
<name>c2</name>
<parent>
<name>c3</name>
</parent>
<disks>
<disk name='vda' checkpoint='bitmap' bitmap='c2'/>
</disks>
<domain type='test'>
<name>test</name>
<uuid>6695eb01-f6a4-8304-79aa-97f2502e193f</uuid>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>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'>
<source file='/guest/diskimage1'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</disk>
<interface type='network'>
<mac address='aa:bb:cc:dd:ee:ff'/>
<source network='default'/>
<target dev='testnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</interface>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</memballoon>
</devices>
</domain>
</domaincheckpoint>
Deleting current checkpoint moves current up to remaining parent
Domain checkpoint c3 children deleted
c3
Domain checkpoint c3 deleted

View File

@ -1 +0,0 @@
a

View File

@ -1 +0,0 @@
a

View File

@ -1 +0,0 @@
a --shell

View File

@ -1 +0,0 @@
-- --shell a

View File

@ -1 +0,0 @@
a

View File

@ -1 +0,0 @@
--shell a

View File

@ -1,3 +0,0 @@
error: failed to get domain '4294967298'
## Exit code: 1

View File

@ -1,18 +0,0 @@
dominfo ef861801-45b9-11cb-88e3-afbfe5370493
dominfo fc4
dominfo fc5
domid fc4
domid ef861801-45b9-11cb-88e3-afbfe5370493
domuuid 2
domuuid fc4
domname 2
domname ef861801-45b9-11cb-88e3-afbfe5370493
domstate 2
domstate ef861801-45b9-11cb-88e3-afbfe5370493
domstate fc4
domcontrol fc4

View File

@ -1,73 +0,0 @@
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Id: 3
Name: fc5
UUID: 08721f99-3d1d-4aec-96eb-97803297bb36
OS Type: linux
State: running
CPU(s): 4
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: running with undesirable elevated privileges
tainted: network configuration using opaque shell scripts
tainted: use of host cdrom passthrough
tainted: custom device tree blob used
tainted: use of deprecated configuration settings
deprecated configuration: CPU model Deprecated-Test
2
2
ef861801-45b9-11cb-88e3-afbfe5370493
ef861801-45b9-11cb-88e3-afbfe5370493
fc4
fc4
running
running
running
ok

View File

@ -1 +0,0 @@
hello

View File

@ -1,3 +0,0 @@
echo --string hello
echo --str hello
echo --hi;

View File

@ -1,3 +0,0 @@
hello
hello
hello

View File

@ -1,2 +0,0 @@
a A 0 + * ; . ' " / ? =
< > &

View File

@ -1,2 +0,0 @@
a A 0 + '*' ';' . ''\''' '"' / '?' = ' ' '
' '<' '>' '&'

View File

@ -1,2 +0,0 @@
a A 0 + * ; . &apos; &quot; / ? =
&lt; &gt; &amp;

View File

@ -1,11 +0,0 @@
echo a A 0 + * . \' / ? = < > &
echo --xml a A 0 + * . \' / ? = < > &
echo --shell a A 0 + * . \' / ? = < > &
echo ""
echo --shell
echo --xml
echo --shell
echo ''
echo --shell ""
echo --xml ''
echo --shell ""''

View File

@ -1,11 +0,0 @@
a A 0 + * . ' / ? = < > &
a A 0 + * . &apos; / ? = &lt; &gt; &amp;
a A 0 + '*' . ''\''' / '?' = '<' '>' '&'
''
''

View File

@ -1 +0,0 @@
a b

View File

@ -1 +0,0 @@
a b

View File

@ -1 +0,0 @@
a b

View File

@ -1 +0,0 @@
a b

View File

@ -1 +0,0 @@
' " \;echo a

View File

@ -1 +0,0 @@
' " ;echo a

View File

@ -1,2 +0,0 @@
' " \
a

View File

@ -1 +0,0 @@
' " \\

View File

@ -1,5 +0,0 @@
echo --split a,b,,c,,,d,,,,e,,,,,f,,,,,,e
echo --split ,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,
echo --split ,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,
echo --split ,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,
echo --split ,,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,,

View File

@ -1,24 +0,0 @@
a
b,c,
d,,e,,
f,,,e
a
b,c,
d,,e,,
f,,,e
,a
b,c,
d,,e,,
f,,,e,
,
a
b,c,
d,,e,,
f,,,e,
,,a
b,c,
d,,e,,
f,,,e,,

View File

@ -1,2 +0,0 @@
list
nodeinfo

View File

@ -1,15 +0,0 @@
Id Name State
----------------------
1 fv0 running
2 fc4 running
3 fc5 running
CPU model: i986
CPU(s): 50
CPU frequency: 6000 MHz
CPU socket(s): 4
Core(s) per socket: 4
Thread(s) per core: 2
NUMA cell(s): 4
Memory size: 8192000 KiB

View File

@ -1,2 +0,0 @@
list
nodeinfo

View File

@ -1,13 +0,0 @@
Id Name State
----------------------
1 test running
CPU model: i686
CPU(s): 16
CPU frequency: 1400 MHz
CPU socket(s): 2
Core(s) per socket: 2
Thread(s) per core: 2
NUMA cell(s): 2
Memory size: 3145728 KiB

View File

@ -1,14 +0,0 @@
iothreadinfo --domain fc4
iothreadadd --domain fc4 --id 6
iothreadinfo --domain fc4
iothreaddel --domain fc4 --id 2
iothreadinfo --domain fc4
domstats --domain fc4
iothreadset --domain fc4 --id 6 --poll-max-ns 100 --poll-shrink 10 --poll-grow 10
domstats --domain fc4
iothreadadd --domain fc5 --id 2
iothreadinfo --domain fc5
iothreadpin --domain fc5 --iothread 2 --cpulist 0
iothreadinfo --domain fc5

View File

@ -1,51 +0,0 @@
IOThread ID CPU Affinity
-----------------------------
2 0
4 0
IOThread ID CPU Affinity
-----------------------------
2 0
4 0
6 0
IOThread ID CPU Affinity
-----------------------------
4 0
6 0
Domain: 'fc4'
state.state=1
state.reason=0
iothread.count=2
iothread.4.poll-max-ns=32768
iothread.4.poll-grow=0
iothread.4.poll-shrink=0
iothread.6.poll-max-ns=32768
iothread.6.poll-grow=0
iothread.6.poll-shrink=0
Domain: 'fc4'
state.state=1
state.reason=0
iothread.count=2
iothread.4.poll-max-ns=32768
iothread.4.poll-grow=0
iothread.4.poll-shrink=0
iothread.6.poll-max-ns=100
iothread.6.poll-grow=10
iothread.6.poll-shrink=10
IOThread ID CPU Affinity
-----------------------------
2 0-3
IOThread ID CPU Affinity
-----------------------------
2 0

View File

@ -1,23 +0,0 @@
list --all
echo test failure when starting already running guest
start fv0
echo undefine a running domain - by domain name
dominfo fc4
undefine fc4
dominfo fc4
shutdown fc4
dominfo fc4
echo undefine a running domain - by domain id
dominfo 3
undefine 3
dominfo 3
shutdown 3
dominfo fc5
echo shutdown then undefine
shutdown fv0
undefine fv0
dominfo fv0

View File

@ -1,106 +0,0 @@
Id Name State
----------------------
1 fv0 running
2 fc4 running
3 fc5 running
test failure when starting already running guest
error: Domain is already active
undefine a running domain - by domain name
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Domain 'fc4' has been undefined
Id: 2
Name: fc4
UUID: ef861801-45b9-11cb-88e3-afbfe5370493
OS Type: linux
State: running
CPU(s): 1
Max memory: 261072 KiB
Used memory: 131072 KiB
Persistent: no
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: network configuration using opaque shell scripts
Domain 'fc4' is being shutdown
error: failed to get domain 'fc4'
undefine a running domain - by domain id
Id: 3
Name: fc5
UUID: 08721f99-3d1d-4aec-96eb-97803297bb36
OS Type: linux
State: running
CPU(s): 4
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: running with undesirable elevated privileges
tainted: network configuration using opaque shell scripts
tainted: use of host cdrom passthrough
tainted: custom device tree blob used
tainted: use of deprecated configuration settings
deprecated configuration: CPU model Deprecated-Test
Domain '3' has been undefined
Id: 3
Name: fc5
UUID: 08721f99-3d1d-4aec-96eb-97803297bb36
OS Type: linux
State: running
CPU(s): 4
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: no
Autostart: disable
Managed save: no
Security model: testSecurity
Security DOI:
Security label: libvirt-test (enforcing)
Messages: tainted: running with undesirable elevated privileges
tainted: network configuration using opaque shell scripts
tainted: use of host cdrom passthrough
tainted: custom device tree blob used
tainted: use of deprecated configuration settings
deprecated configuration: CPU model Deprecated-Test
Domain '3' is being shutdown
error: failed to get domain 'fc5'
shutdown then undefine
Domain 'fv0' is being shutdown
Domain 'fv0' has been undefined
error: failed to get domain 'fv0'
## Exit code: 1

View File

@ -1,2 +0,0 @@
a
b

View File

@ -1 +0,0 @@
a # b

View File

@ -1 +0,0 @@
a

View File

@ -1 +0,0 @@
a

View File

@ -1,2 +0,0 @@
a
b

View File

@ -1,2 +0,0 @@
a
b

View File

@ -1,2 +0,0 @@
a
b

View File

@ -1,3 +0,0 @@
a
\
b

View File

@ -1 +0,0 @@
a

View File

@ -1,2 +0,0 @@
a
c

View File

@ -1,2 +0,0 @@
a
c

View File

@ -1 +0,0 @@
a # b

View File

@ -1,26 +0,0 @@
echo Test the <timeout> option (numeric option converted to ms)
echo Non-numeric value
event --all --timeout abc
echo Numeric value that is too big to be converted to ms and still
echo fit inside an int
event --all --timeout 2147484
echo Numeric value with invalid suffix
event --all --timeout 42WB
echo Numeric value with valid suffix. Suffixes are not supported for
echo the <timeout> option, so this value is rejected
event --all --timeout 42MB
echo Negative value
event --all --timeout -1
echo Zero. This is not a valid timeout, but the value is parsed
echo correctly
event --all --timeout 0
echo Numeric value. No events will be received and the command will
echo fail after a second, but the value has been parsed correctly
event --all --timeout 1

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