[libvirt] [PATCH]lxc: add debug logs when dst for mounting does not exist
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
We automatically create dir when dst for mounting does not exist.
Add debug log for it.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e8f7a75..570dc1d 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1085,6 +1085,7 @@ static int lxcContainerMountFSBind(virDomainFSDefPtr fs,
src);
goto cleanup;
}
+ VIR_DEBUG("dst '%s' not found, create it in container for mounting", fs->dst);
if (S_ISDIR(st.st_mode)) {
if (virFileMakePath(fs->dst) < 0) {
virReportSystemError(errno,
--
1.8.2.1
11 years
[libvirt] GenericVmConfigFault - Unable to allocate a PCI SCSI adapter. Too many PCI devices are already configured.
by Andrew Holway
Hello,
I am trying to create virtual machines on a VMware ESXi 5.5.0
build-1331820 with Virsh 1.1.4 on Fedora 19. I see the following.
Can anyone show me where I am going wrong or perhaps suggest a more
sensible way of spawning virtual machines on ESXi with libvirt.
Thanks,
Andrew
[aholway@libvirt ~]$ virsh --connect esx://10.51.3.59/?no_verify=1
virsh # vol-list --pool "datastore1 (1)"
Name Path
-----------------------------------------
VM001/VM001.vmdk [datastore1 (1)] VM001/VM001.vmdk
VM002/VM002.vmdk [datastore1 (1)] VM002/VM002.vmdk
virsh # vol-clone --pool "datastore1 (1)" VM001/VM001.vmdk VM003/VM003.vmdk
Vol VM003/VM003.vmdk cloned from VM001/VM001.vmdk
virsh # define domain.xml
Domain VM003 defined from domain.xml
virsh # start VM003
error: Failed to start domain VM003
error: internal error: Could not start domain:
GenericVmConfigFault - Unable to allocate a PCI SCSI adapter. Too
many PCI devices are already configured.
#### domain.xml ####
<domain type='vmware'>
<name>VM003</name>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
</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='[datastore1 (1)] VM003/VM003.vmdk'/>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='vmpvscsi'/>
<interface type='bridge'>
<mac address='00:50:56:8c:32:65'/>
<source bridge='10G'/>
<model type='vmxnet3'/>
</interface>
<video>
<model type='vmvga' vram='4096'/>
</video>
</devices>
</domain>
#### VM003.vmdk ####
# Disk DescriptorFile
version=1
encoding="UTF-8"
CID=fffffffe
parentCID=ffffffff
isNativeSnapshot="no"
createType="vmfs"
# Extent description
RW 33554432 VMFS "VM003-flat.vmdk"
# The Disk Data Base
#DDB
ddb.adapterType = "lsilogic"
ddb.deletable = "true"
ddb.geometry.cylinders = "2088"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.longContentID = "1a5627c7a84f812eeec7f9aafffffffe"
ddb.uuid = "60 00 C2 9a 31 de b1 1d-ca 50 4c c2 1a 1a 7d ab"
ddb.virtualHWVersion = "8"
#### VM003.vmx ####
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "8"
guestOS = "other-64"
uuid.bios = "07 fd ba 3e 47 fb 49 00-ae 2f f0 26 04 90 ee e2"
displayName = "VM003"
memsize = "2048"
numvcpus = "1"
scsi0.present = "true"
scsi0.virtualDev = "pvscsi"
scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName =
"/vmfs/volumes/527267fd-20e8ff06-e667-7845c4faefd1/VM003/VM003.vmdk"
ethernet0.present = "true"
ethernet0.virtualDev = "vmxnet3"
ethernet0.networkName = "10G"
ethernet0.connectionType = "bridged"
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:8c:32:65"
svga.vramSize = "4194304"
extendedConfigFile = "VM003.vmxf"
virtualHW.productCompatibility = "hosted"
floppy0.present = "FALSE"
floppy1.present = "FALSE"
sched.swap.derivedName =
"/vmfs/volumes/527267fd-20e8ff06-e667-7845c4faefd1/VM003/VM003-42cd42fb.vswp"
uuid.location = "56 4d 21 b1 88 3d de 7e-5e 33 79 e2 70 ac ac 91"
replay.supported = "FALSE"
replay.filename = ""
scsi0:0.redo = ""
scsi0.pciSlotNumber = "21"
ethernet0.pciSlotNumber = "22"
vc.uuid = "50 0c f8 80 50 18 27 e2-ef 43 8d 60 66 e7 48 a1"
11 years
[libvirt] [PATCH] virt-login-shell: also build virAtomic.h
by Guido Günther
Needed for architectures that don't use gcc atomic ops but pthread. This
fixes the armel build that otherwise breaks like:
CCLD virt-login-shell
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virClassNew':
/«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:150: undefined reference to `virAtomicLock'
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virObjectNew':
/«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:202: undefined reference to `virAtomicLock'
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virObjectUnref':
/«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:274: undefined reference to `virAtomicLock'
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-virobject.o): In function `virObjectRef':
/«PKGBUILDDIR»/debian/build/src/../../../src/util/virobject.c:295: undefined reference to `virAtomicLock'
collect2: error: ld returned 1 exit status
See https://buildd.debian.org/status/fetch.php?pkg=libvirt&arch=armel&ver=1.1...
---
src/Makefile.am | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index 21b9caf..ad39b74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1982,6 +1982,8 @@ noinst_LTLIBRARIES += libvirt-setuid-rpc-client.la
libvirt_setuid_rpc_client_la_SOURCES = \
util/viralloc.c \
+ util/viratomic.c \
+ util/viratomic.h \
util/virbitmap.c \
util/virbuffer.c \
util/vircommand.c \
--
1.8.4.2
11 years
[libvirt] [PATCHv2 00/10] Strip libnuma functions from nodeinfo.c
by Peter Krempa
As a pre-requisite for doing unit tests for topology detection code
the code in nodeinfo.c needs to be cleaned up.
Peter Krempa (10):
nodeinfo: Rename linuxNodeInfoCPUPopulate and export it properly
numa: Introduce virNumaIsAvailable and use it instead of
numa_available
nodeinfo: Avoid forward declarations of static functions
numa: Introduce virNumaGetMaxNode and use it instead of numa_max_node
numa: Introduce virNumaGetNodeMemory and use it instead of
numa_node_size64
nodeinfo: Get rid of nodeGetCellMemory
numa: Replace NUMA_MAX_N_CPUS macro with virNumaGetMaxCPUs()
caps: Fix function docs for virCapabilitiesAddHostNUMACell
numa: Add wrapper of numa_node_to_cpus and use it
nodeinfo: Remove libnuma include
src/conf/capabilities.c | 1 +
src/libvirt_linux.syms | 2 +-
src/libvirt_private.syms | 3 +
src/nodeinfo.c | 222 +++++++++++++----------------------------------
src/nodeinfo.h | 5 ++
src/util/virnuma.c | 221 +++++++++++++++++++++++++++++++++++++++++++++-
src/util/virnuma.h | 11 +++
tests/nodeinfotest.c | 6 +-
8 files changed, 304 insertions(+), 167 deletions(-)
--
1.8.3.2
11 years
[libvirt] [PATCH] storage: recognize gluster as networked file
by Eric Blake
A qcow2 file with a backing file of 'gluster://host/vol/file' should
not try to look for a directory named './gluster:/' in the file system.
* src/util/virstoragefile.c (virBackingStoreIsFile): Broaden check
to include all protocols.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
This one will be important to my work on gluster backing chains, but
can be reviewed and applied independently now.
src/util/virstoragefile.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 1b4d4cf..8f04b78 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -671,8 +671,13 @@ virStorageFileMatchesVersion(int format,
static bool
virBackingStoreIsFile(const char *backing)
{
- /* Backing store is a network block device or Rados block device */
- if (STRPREFIX(backing, "nbd:") || STRPREFIX(backing, "rbd:"))
+ char *colon = strchr(backing, ':');
+ char *slash = strchr(backing, '/');
+
+ /* Reject anything that looks like a protocol (such as nbd: or
+ * rbd:); if someone really does want a relative file name that
+ * includes ':', they can always prefix './'. */
+ if (colon && (!slash || colon < slash))
return false;
return true;
}
--
1.8.3.1
11 years
[libvirt] [PATCH] virpcitest: Fix variable arguments using in pci_driver_new
by Michal Privoznik
In the pci_driver_new function it is possible to set a list of
<vendor:device> IDs that the driver knows. These IDs are passed as
variable arguments and are processed the usual way using va_start() and
va_arg(). However, after all arguments has been processed, we should
call va_end() what we aren't currently doing.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/virpcimock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 2944780..9385d2c 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -405,6 +405,8 @@ pci_driver_new(const char *name, ...)
driver->len++;
}
+ va_end(args);
+
make_file(driverpath, "bind", NULL);
make_file(driverpath, "unbind", NULL);
make_file(driverpath, "new_id", NULL);
--
1.8.1.5
11 years
[libvirt] [PATCH] network: fix connections count in case of allocate failure
by Laine Stump
This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1020135
If networkAllocateActualDevice() had failed due to a pool of hostdev
or direct devices being depleted, the calling function could still
call networkReleaseActualDevice() as part of its cleanup, and that
function would then unconditionally decrement the connections count
for the network, even though it hadn't been incremented (due to
failure of allocate). This *was* necessary because the .actual member
of the netdef was allocated with a "lazy" algorithm, only being
created if there was a need to store data there (e.g. if a device was
allocated from a pool, or bandwidth was allocated for the device), so
there was no simple way for networkReleaseActualDevice() to tell if
something really had been allocated (i.e. if "connections++" had been
executed).
This patch changes networkAllocateDevice() to *always* allocate an
actual device for any netdef of type='network', even if it isn't
needed for any other reason. This has no ill effects anywhere else in
the code (except for using a small amount of memory), and
networkReleaseActualDevice() can then determine if there was a
previous successful allocate by checking for .actual != NULL (if not,
it skips the "connections--").
---
src/network/bridge_driver.c | 41 +++++++++++------------------------------
1 file changed, 11 insertions(+), 30 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 3ce3130..41edb97 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3151,6 +3151,9 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
}
netdef = network->def;
+ if (VIR_ALLOC(iface->data.network.actual) < 0)
+ goto error;
+
/* portgroup can be present for any type of network, in particular
* for bandwidth information, so we need to check for that and
* fill it in appropriately for all forward types.
@@ -3167,14 +3170,9 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
else if (portgroup && portgroup->bandwidth)
bandwidth = portgroup->bandwidth;
- if (bandwidth) {
- if (!iface->data.network.actual &&
- VIR_ALLOC(iface->data.network.actual) < 0)
- goto error;
- if (virNetDevBandwidthCopy(&iface->data.network.actual->bandwidth,
- bandwidth) < 0)
- goto error;
- }
+ if (bandwidth && virNetDevBandwidthCopy(&iface->data.network.actual->bandwidth,
+ bandwidth) < 0)
+ goto error;
/* copy appropriate vlan info to actualNet */
if (iface->vlan.nTags > 0)
@@ -3184,13 +3182,8 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
else if (netdef->vlan.nTags > 0)
vlan = &netdef->vlan;
- if (vlan) {
- if (!iface->data.network.actual &&
- VIR_ALLOC(iface->data.network.actual) < 0)
- goto error;
- if (virNetDevVlanCopy(&iface->data.network.actual->vlan, vlan) < 0)
- goto error;
- }
+ if (vlan && virNetDevVlanCopy(&iface->data.network.actual->vlan, vlan) < 0)
+ goto error;
if ((netdef->forward.type == VIR_NETWORK_FORWARD_NONE) ||
(netdef->forward.type == VIR_NETWORK_FORWARD_NAT) ||
@@ -3199,8 +3192,7 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
*NETWORK; we just keep the info from the portgroup in
* iface->data.network.actual
*/
- if (iface->data.network.actual)
- iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_NETWORK;
+ iface->data.network.actual->type = VIR_DOMAIN_NET_TYPE_NETWORK;
if (networkPlugBandwidth(network, iface) < 0)
goto error;
@@ -3212,10 +3204,6 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
* is VIR_DOMAIN_NET_TYPE_BRIDGE
*/
- if (!iface->data.network.actual &&
- VIR_ALLOC(iface->data.network.actual) < 0)
- goto error;
-
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_BRIDGE;
if (VIR_STRDUP(iface->data.network.actual->data.bridge.brname,
netdef->bridge) < 0)
@@ -3248,10 +3236,6 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
virDomainHostdevSubsysPciBackendType backend;
- if (!iface->data.network.actual &&
- VIR_ALLOC(iface->data.network.actual) < 0)
- goto error;
-
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_HOSTDEV;
if (netdef->forward.npfs > 0 && netdef->forward.nifs <= 0 &&
networkCreateInterfacePool(netdef) < 0) {
@@ -3335,10 +3319,6 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
* VIR_DOMAIN_NET_TYPE_DIRECT.
*/
- if (!iface->data.network.actual &&
- VIR_ALLOC(iface->data.network.actual) < 0)
- goto error;
-
/* Set type=direct and appropriate <source mode='xxx'/> */
iface->data.network.actual->type = actualType = VIR_DOMAIN_NET_TYPE_DIRECT;
switch (netdef->forward.type) {
@@ -3813,7 +3793,8 @@ networkReleaseActualDevice(virDomainNetDefPtr iface)
}
success:
- netdef->connections--;
+ if (iface->data.network.actual)
+ netdef->connections--;
VIR_DEBUG("Releasing network %s, %d connections",
netdef->name, netdef->connections);
ret = 0;
--
1.8.3.1
11 years
[libvirt] [PATCH v4] qemu: don't use deprecated -no-kvm-pit-reinjection
by Ján Tomko
Since qemu-kvm 1.1 [1] (since 1.3. in upstream QEMU [2])
'-no-kvm-pit-reinjection' has been deprecated.
Use -global kvm-pit.lost_tick_policy=discard instead.
https://bugzilla.redhat.com/show_bug.cgi?id=978719
[1] http://git.kernel.org/cgit/virt/kvm/qemu-kvm.git/commit/?id=4e4fa39
[2] http://git.qemu.org/?p=qemu.git;a=commitdiff;h=c21fb4f
---
v4: check for the property of the kvm-pit device instead of just the
kvm-pit device
keep the NO_KVM_PIT capability
v3: use -global instead of trying to add another -device
v2: https://www.redhat.com/archives/libvir-list/2013-July/msg00821.html
v1: https://www.redhat.com/archives/libvir-list/2013-July/msg00045.html
src/qemu/qemu_capabilities.c | 7 ++++++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 8 ++++--
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.2.2-1.replies | 14 +++++++++++
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.3.1-1.replies | 14 +++++++++++
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.4.2-1.replies | 14 +++++++++++
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.replies | 14 +++++++++++
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.replies | 14 +++++++++++
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.replies | 14 +++++++++++
.../qemuxml2argv-kvm-pit-delay.args | 5 ++++
.../qemuxml2argv-kvm-pit-delay.xml | 29 ++++++++++++++++++++++
.../qemuxml2argv-kvm-pit-device.args | 5 ++++
.../qemuxml2argv-kvm-pit-device.xml | 29 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 5 ++++
20 files changed, 177 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 17095b4..71a913b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -242,6 +242,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"usb-storage.removable",
"virtio-mmio",
"ich9-intel-hda",
+ "kvm-pit-lost-tick-policy",
);
struct _virQEMUCaps {
@@ -1458,6 +1459,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUsbStorage[] = {
{ "removable", QEMU_CAPS_USB_STORAGE_REMOVABLE },
};
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsKVMPit[] = {
+ { "lost_tick_policy", QEMU_CAPS_KVM_PIT_TICK_POLICY },
+};
+
struct virQEMUCapsObjectTypeProps {
const char *type;
struct virQEMUCapsStringFlags *props;
@@ -1501,6 +1506,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
ARRAY_CARDINALITY(virQEMUCapsObjectPropsQ35PciHost) },
{ "usb-storage", virQEMUCapsObjectPropsUsbStorage,
ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbStorage) },
+ { "kvm-pit", virQEMUCapsObjectPropsKVMPit,
+ ARRAY_CARDINALITY(virQEMUCapsObjectPropsKVMPit) },
};
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index f1faa76..02d47c6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -197,6 +197,7 @@ enum virQEMUCapsFlags {
QEMU_CAPS_USB_STORAGE_REMOVABLE = 156, /* usb-storage.removable */
QEMU_CAPS_DEVICE_VIRTIO_MMIO = 157, /* -device virtio-mmio */
QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 158, /* -device ich9-intel-hda */
+ QEMU_CAPS_KVM_PIT_TICK_POLICY = 159, /* kvm-pit.lost_tick_policy */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 63e235d..e48c9c2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7993,11 +7993,15 @@ qemuBuildCommandLine(virConnectPtr conn,
case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY:
/* delay is the default if we don't have kernel
(-no-kvm-pit), otherwise, the default is catchup. */
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT))
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM_PIT_TICK_POLICY))
+ virCommandAddArgList(cmd, "-global",
+ "kvm-pit.lost_tick_policy=discard", NULL);
+ else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT))
virCommandAddArg(cmd, "-no-kvm-pit-reinjection");
break;
case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT)) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM_PIT_TICK_POLICY)) {
/* do nothing - this is default for kvm-pit */
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_TDF)) {
/* -tdf switches to 'catchup' with userspace pit. */
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
index c580c0c..73a561d 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
@@ -111,4 +111,5 @@
<flag name='vnc-share-policy'/>
<flag name='usb-storage'/>
<flag name='usb-storage.removable'/>
+ <flag name='kvm-pit-lost-tick-policy'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
index 96fe4f2..345c32b 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies
@@ -1394,6 +1394,20 @@
{
"return": [
{
+ "name": "lost_tick_policy",
+ "type": "LostTickPolicy"
+ },
+ {
+ "name": "iobase",
+ "type": "hex32"
+ }
+ ],
+ "id": "libvirt-26"
+}
+
+{
+ "return": [
+ {
"name": "xenpv"
},
{
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
index 02ccc09..da15d8b 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
@@ -125,4 +125,5 @@
<flag name='dmi-to-pci-bridge'/>
<flag name='usb-storage'/>
<flag name='usb-storage.removable'/>
+ <flag name='kvm-pit-lost-tick-policy'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
index 1d033cb..63c18da 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies
@@ -1553,6 +1553,20 @@
{
"return": [
{
+ "name": "lost_tick_policy",
+ "type": "LostTickPolicy"
+ },
+ {
+ "name": "iobase",
+ "type": "hex32"
+ }
+ ],
+ "id": "libvirt-26"
+}
+
+{
+ "return": [
+ {
"name": "xenpv"
},
{
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
index 08e9c20..c419068 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
@@ -126,4 +126,5 @@
<flag name='usb-storage'/>
<flag name='usb-storage.removable'/>
<flag name='ich9-intel-hda'/>
+ <flag name='kvm-pit-lost-tick-policy'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
index bcf202c..4fb4061 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies
@@ -1600,6 +1600,20 @@
{
"return": [
{
+ "name": "lost_tick_policy",
+ "type": "LostTickPolicy"
+ },
+ {
+ "name": "iobase",
+ "type": "hex32"
+ }
+ ],
+ "id": "libvirt-26"
+}
+
+{
+ "return": [
+ {
"name": "xenpv"
},
{
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 323ac82..09cf657 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -130,4 +130,5 @@
<flag name='usb-storage'/>
<flag name='usb-storage.removable'/>
<flag name='ich9-intel-hda'/>
+ <flag name='kvm-pit-lost-tick-policy'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
index 8ff17ce..686fa3e 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies
@@ -1674,6 +1674,20 @@
{
"return": [
{
+ "name": "lost_tick_policy",
+ "type": "LostTickPolicy"
+ },
+ {
+ "name": "iobase",
+ "type": "hex32"
+ }
+ ],
+ "id": "libvirt-26"
+}
+
+{
+ "return": [
+ {
"name": "pc-q35-1.4",
"cpu-max": 255
},
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index 3587d45..33ee73b 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -134,4 +134,5 @@
<flag name='usb-storage.removable'/>
<flag name='virtio-mmio'/>
<flag name='ich9-intel-hda'/>
+ <flag name='kvm-pit-lost-tick-policy'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
index 1b983d0..95e0c37 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies
@@ -1736,6 +1736,20 @@
{
"return": [
{
+ "name": "lost_tick_policy",
+ "type": "LostTickPolicy"
+ },
+ {
+ "name": "iobase",
+ "type": "hex32"
+ }
+ ],
+ "id": "libvirt-26"
+}
+
+{
+ "return": [
+ {
"name": "xenpv",
"cpu-max": 1
},
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index 0bface5..a66034a 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -133,4 +133,5 @@
<flag name='usb-storage.removable'/>
<flag name='virtio-mmio'/>
<flag name='ich9-intel-hda'/>
+ <flag name='kvm-pit-lost-tick-policy'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
index ab78cb3..3ecf185 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies
@@ -1700,6 +1700,20 @@
{
"return": [
{
+ "name": "lost_tick_policy",
+ "type": "LostTickPolicy"
+ },
+ {
+ "name": "iobase",
+ "type": "hex32"
+ }
+ ],
+ "id": "libvirt-26"
+}
+
+{
+ "return": [
+ {
"name": "xenpv",
"cpu-max": 1
},
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args
new file mode 100644
index 0000000..ca5823f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 2 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-kvm-pit-reinjection -no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \
+-net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml
new file mode 100644
index 0000000..7835a1b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-delay.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'>
+ <timer name='pit' tickpolicy='delay'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args
new file mode 100644
index 0000000..f03840f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 2 -nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-global kvm-pit.lost_tick_policy=discard -no-acpi -boot c -usb \
+-hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
new file mode 100644
index 0000000..7835a1b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'>
+ <timer name='pit' tickpolicy='delay'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b14e713..a74ac2a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1103,6 +1103,11 @@ mymain(void)
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
+ DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
+ DO_TEST("kvm-pit-device", QEMU_CAPS_NO_KVM_PIT,
+ QEMU_CAPS_KVM_PIT_TICK_POLICY);
+
virObjectUnref(driver.config);
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
1.8.1.5
11 years
[libvirt] [PATCH] Resolve Coverity issue regarding not checking return value
by John Ferlan
Coverity complains that the call to virPCIDeviceDetach() in
qemuPrepareHostdevPCIDevices() doesn't check status return like
other calls. Seems this just was lurking until a recent change
to this module resulted in Coverity looking harder and finding
the issue. Introduced by 'a4efb2e33' when function was called
'pciReAttachDevice()'
Just added a ignore_value() since it doesn't appear to matter
if the call fails since we're on a failure path already.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_hostdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 57ab28c..f5cad15 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -819,7 +819,8 @@ reattachdevs:
/* NB: This doesn't actually re-bind to original driver, just
* unbinds from the stub driver
*/
- virPCIDeviceReattach(dev, driver->activePciHostdevs, NULL);
+ ignore_value(virPCIDeviceReattach(dev, driver->activePciHostdevs,
+ NULL));
}
cleanup:
--
1.8.3.1
11 years
[libvirt] [PATCH v2 0/5] Test our PCI device handling functions
by Michal Privoznik
The 4/5 is actually fix for a bug,
Michal Privoznik (5):
tests: Introduce virpcitest
virpcitest: Test virPCIDeviceDetach
virpcitest: Introduce testVirPCIDeviceReattach
virpci: Don't error on not binded devices
virpcitest: Introduce check for unbinded devices
.gitignore | 1 +
cfg.mk | 4 +-
src/util/virpci.c | 12 +-
tests/Makefile.am | 21 +-
tests/virpcimock.c | 913 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/virpcitest.c | 204 ++++++++++++
6 files changed, 1148 insertions(+), 7 deletions(-)
create mode 100644 tests/virpcimock.c
create mode 100644 tests/virpcitest.c
--
1.8.1.5
11 years