[libvirt] Virsh Attach Volume Fails
by Vilobh Meshram
Hi,
When trying to attach a created volume to an instance using the virsh utility I am running into this error :-
[] $ sudo virsh attach-device instance-00000015 disk.xml
error: Failed to attach device from disk.xml
error: internal error unable to execute QEMU command '__com.redhat_drive_add': Device 'drive-virtio-disk21' could not be initialized
For experimental purpose I have libvirt 0.10.2 and QEMU 0.12.1. The volume to be attached is on a remote storage.
Any idea what I might be missing ?
Thanks,
Vilobh
10 years, 7 months
[libvirt] [libvirt PATCH] udev: consider the device a CDROM when ID_CDROM=1
by Giuseppe Scrivano
Some CDROM devices are reported by udev to have an ID_TYPE="generic"
thus it is necessary to check if ID_CDROM is present.
As a side effect, treating ID_TYPE="generic" as a missing ID_TYPE will
enable checks for ID_DRIVE_FLASH_SD and ID_DRIVE_FLOPPY and the
udevKludgeStorageType heuristic.
Signed-off-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
---
src/node_device/node_device_udev.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 71b3c79..de1cc67 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1,7 +1,7 @@
/*
* node_device_udev.c: node device enumeration - libudev implementation
*
- * Copyright (C) 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2009-2014 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
@@ -1093,7 +1093,8 @@ static int udevProcessStorage(struct udev_device *device,
if (udevGetStringProperty(device,
"ID_TYPE",
- &data->storage.drive_type) != PROPERTY_FOUND) {
+ &data->storage.drive_type) != PROPERTY_FOUND
+ || STREQ(def->caps->data.storage.drive_type, "generic")) {
int tmp_int = 0;
/* All floppy drives have the ID_DRIVE_FLOPPY prop. This is
@@ -1104,6 +1105,12 @@ static int udevProcessStorage(struct udev_device *device,
if (VIR_STRDUP(data->storage.drive_type, "floppy") < 0)
goto out;
+ } else if ((udevGetIntProperty(device, "ID_CDROM",
+ &tmp_int, 0) == PROPERTY_FOUND) &&
+ (tmp_int == 1)) {
+
+ if (VIR_STRDUP(data->storage.drive_type, "cd") < 0)
+ goto out;
} else if ((udevGetIntProperty(device, "ID_DRIVE_FLASH_SD",
&tmp_int, 0) == PROPERTY_FOUND) &&
(tmp_int == 1)) {
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] docs: update README-hacking
by Chen Hanxiao
We didn't have "README-valgrind" file now.
So remove related description.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
README-hacking | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README-hacking b/README-hacking
index 80b022c..4e02fd8 100644
--- a/README-hacking
+++ b/README-hacking
@@ -15,7 +15,7 @@ Specific development tools and versions will be checked for and listed by
the bootstrap script.
Valgrind <http://valgrind.org/> is also highly recommended, if
-Valgrind supports your architecture. See also README-valgrind.
+Valgrind supports your architecture.
While building from a just-cloned source tree may require installing a
few prerequisites, later, a plain `git pull && make' should be sufficient.
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] PCI: Introduce new device binding path using pci_dev.driver_override
by Alex Williamson
The driver_override field allows us to specify the driver for a device
rather than relying on the driver to provide a positive match of the
device. This shortcuts the existing process of looking up the vendor
and device ID, adding them to the driver new_id, binding the device,
then removing the ID, but it also provides a couple advantages.
First, the above existing process allows the driver to bind to any
device matching the new_id for the window where it's enabled. This is
often not desired, such as the case of trying to bind a single device
to a meta driver like pci-stub or vfio-pci. Using driver_override we
can do this deterministically using:
echo pci-stub > /sys/bus/pci/devices/0000:03:00.0/driver_override
echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
Previously we could not invoke drivers_probe after adding a device
to new_id for a driver as we get non-deterministic behavior whether
the driver we intend or the standard driver will claim the device.
Now it becomes a deterministic process, only the driver matching
driver_override will probe the device.
To return the device to the standard driver, we simply clear the
driver_override and reprobe the device:
echo > /sys/bus/pci/devices/0000:03:00.0/preferred_driver
echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbind
echo 0000:03:00.0 > /sys/bus/pci/drivers_probe
Another advantage to this approach is that we can specify a driver
override to force a specific binding or prevent any binding. For
instance when an IOMMU group is exposed to userspace through VFIO
we require that all devices within that group are owned by VFIO.
However, devices can be hot-added into an IOMMU group, in which case
we want to prevent the device from binding to any driver (preferred
driver = "none") or perhaps have it automatically bind to vfio-pci.
With driver_override it's a simple matter for this field to be set
internally when the device is first discovered to prevent driver
matches.
Signed-off-by: Alex Williamson <alex.williamson(a)redhat.com>
---
Changes since RFC:
- Add ABI documentation (gregkh)
- Documentation wording clarification (Christoffer)
Nobody puked on the RFC and platform folks have posted a working
version of this for platform devices, so I guess the only thing left
to do is formally propose this as a new driver binding mechanism. I
don't see much incentive to push this into the driver core since the
match ultimately needs to be done by the bus driver. I think this is
therefore like new_id/remove_id where PCI and USB implement separate,
but consistent interfaces.
I've pruned the CC list a bit from the RFC, but I've added libvirt
folks since I expect they would be the first userspace tool that would
adopt this. Thanks,
Alex
Documentation/ABI/testing/sysfs-bus-pci | 21 ++++++++++++++++
drivers/pci/pci-driver.c | 25 +++++++++++++++++--
drivers/pci/pci-sysfs.c | 40 +++++++++++++++++++++++++++++++
include/linux/pci.h | 1 +
4 files changed, 84 insertions(+), 3 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index a3c5a66..898ddc4 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -250,3 +250,24 @@ Description:
valid. For example, writing a 2 to this file when sriov_numvfs
is not 0 and not 2 already will return an error. Writing a 10
when the value of sriov_totalvfs is 8 will return an error.
+
+What: /sys/bus/pci/devices/.../driver_override
+Date: April 2014
+Contact: Alex Williamson <alex.williamson(a)redhat.com>
+Description:
+ This file allows the driver for a device to be specified which
+ will override standard static and dynamic ID matching. When
+ specified, only a driver with a name matching the value written
+ to driver_override will have an opportunity to bind to the
+ device. The override is specified by writing a string to the
+ driver_override file (echo pci-stub > driver_override) and
+ may be cleared with an empty string (echo > driver_override).
+ This returns the device to standard matching rules binding.
+ Writing to driver_override does not automatically unbind the
+ device from its current driver or make any attempt to
+ automatically load the specified driver. If no driver with a
+ matching name is currently loaded in the kernel, the device
+ will not bind to any driver. This also allows devices to
+ opt-out of driver binding using a driver_override name such as
+ "none". Only a single driver may be specified in the override,
+ there is no support for parsing delimiters.
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 25f0bc6..f780eb8 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -216,6 +216,13 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
return NULL;
}
+static const struct pci_device_id pci_device_id_any = {
+ .vendor = PCI_ANY_ID,
+ .device = PCI_ANY_ID,
+ .subvendor = PCI_ANY_ID,
+ .subdevice = PCI_ANY_ID,
+};
+
/**
* pci_match_device - Tell if a PCI device structure has a matching PCI device id structure
* @drv: the PCI driver to match against
@@ -229,18 +236,30 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
struct pci_dev *dev)
{
struct pci_dynid *dynid;
+ const struct pci_device_id *found_id = NULL;
+
+ /* When driver_override is set, only bind to the matching driver */
+ if (dev->driver_override && strcmp(dev->driver_override, drv->name))
+ return NULL;
/* Look at the dynamic ids first, before the static ones */
spin_lock(&drv->dynids.lock);
list_for_each_entry(dynid, &drv->dynids.list, node) {
if (pci_match_one_device(&dynid->id, dev)) {
- spin_unlock(&drv->dynids.lock);
- return &dynid->id;
+ found_id = &dynid->id;
+ break;
}
}
spin_unlock(&drv->dynids.lock);
- return pci_match_id(drv->id_table, dev);
+ if (!found_id)
+ found_id = pci_match_id(drv->id_table, dev);
+
+ /* driver_override will always match, send a dummy id */
+ if (!found_id && dev->driver_override)
+ found_id = &pci_device_id_any;
+
+ return found_id;
}
struct drv_dev_and_id {
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 276ef9c..70cb39d 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -510,6 +510,45 @@ static struct device_attribute sriov_numvfs_attr =
sriov_numvfs_show, sriov_numvfs_store);
#endif /* CONFIG_PCI_IOV */
+static ssize_t driver_override_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ char *driver_override, *old = pdev->driver_override;
+
+ if (count > PATH_MAX)
+ return -EINVAL;
+
+ driver_override = kstrndup(buf, count, GFP_KERNEL);
+ if (!driver_override)
+ return -ENOMEM;
+
+ while (strlen(driver_override) &&
+ driver_override[strlen(driver_override) - 1] == '\n')
+ driver_override[strlen(driver_override) - 1] = '\0';
+
+ if (strlen(driver_override)) {
+ pdev->driver_override = driver_override;
+ } else {
+ kfree(driver_override);
+ pdev->driver_override = NULL;
+ }
+
+ kfree(old);
+
+ return count;
+}
+
+static ssize_t driver_override_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+ return sprintf(buf, "%s\n", pdev->driver_override);
+}
+static DEVICE_ATTR_RW(driver_override);
+
static struct attribute *pci_dev_attrs[] = {
&dev_attr_resource.attr,
&dev_attr_vendor.attr,
@@ -532,6 +571,7 @@ static struct attribute *pci_dev_attrs[] = {
#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
&dev_attr_d3cold_allowed.attr,
#endif
+ &dev_attr_driver_override.attr,
NULL,
};
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33aa2ca..6b666af 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -364,6 +364,7 @@ struct pci_dev {
#endif
phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
size_t romlen; /* Length of ROM if it's not from the BAR */
+ char *driver_override; /* Driver name to force a match */
};
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
10 years, 7 months
[libvirt] LSN-2014-0003: Unsafe parsing of XML documents allows arbitrary file read
by Daniel P. Berrange
Libvirt Security Notice: LSN-2014-0003
======================================
Summary: Unsafe parsing of XML documents allows arbitrary
file read
Reported on: 20140411
Published on: 20140506
Fixed on: 20140506
Reported by: Daniel P. Berrange <berrange(a)redhat.com>
Richard Jones <rjones(a)redhat.com>
Patched by: Daniel P. Berrange <berrange(a)redhat.com>
See also: CVE-2014-0179
Description
-----------
When parsing XML documents, libvirt passes the XML_PARSE_NOENT flag
to libxml2 which instructs it to expand all entities in the XML
document during parsing. This can be used to insert the contents of
host OS files in the resulting parsed content. Although the flaw was
introduced in 0.0.5, it was dormant having no ill effects, since the
APIs involved all required the user to authenticate with privileges
equivalent to root. In version 0.7.5 or later the
virConnectCompareCPU / virConnectBaselineCPU methods activate the
dormant bug, allowing for denial of service. In version 1.0.0 or
later, if the admin opts in to using the new fine grained access
control feature, there is potential for unprivileged information
disclosure.
Impact
------
A malicious user can pass libvirt an XML document which contains an
entity that points to an arbitrary file on the host. When libvirt
parses this document, it will insert the contents of that host file,
which could allow the user to read the contents of files that they
otherwise do not have permission to view. It also has the potential
to cause a denial of service / indefinite hang of libvirt, if the
entity points to a named pipe with no writer connected or certain
proc files. If the libvirt installation is not using fine grained
access control then virConnectCompareCPU and virConnectBaselineCPU
APIs can be used by a read-only user to inflict a denial of service
attack. If the libvirt installation is using fine grained access
control, then as well as the denial of service attack, one or more
of the following APIs can be used for information disclosure of
files: virDomainDefineXML, virNetworkCreateXML, virNetworkDefineXML,
virStoragePoolCreateXML, virStoragePoolDefineXML,
virStorageVolCreateXML, virDomainCreateXML, virNodeDeviceCreateXML,
virInterfaceDefineXML, virStorageVolCreateXMLFrom,
virConnectDomainXMLFromNative, virConnectDomainXMLToNative,
virSecretDefineXML, virNWFilterDefineXML,
virDomainSnapshotCreateXML, virDomainSaveImageDefineXML,
virDomainCreateXMLWithFiles, virConnectCompareCPU,
virConnectBaselineCPU.
Workaround
----------
Stop use of the fine grained access control mechanism, and restrict
access to all the libvirt TCP/UNIX sockets to only trusted
authenticated users. Simply denying access to the affected APIs in
the access control policy is insufficient to mitigate the bug, since
the XML document typically needs to be parsed before the access
control check is applied in order to extra the UUID/name of the
object to check. Access to the readonly libvirt socket must also be
revoked
Affected product
----------------
Name: libvirt
Repository: git://libvirt.org/git/libvirt.git
http://libvirt.org/git/?p=libvirt.git
Branch: master
Broken in: v0.7.5
Broken in: v0.7.6
Broken in: v0.7.7
Broken in: v0.8.0
Broken in: v0.8.1
Broken in: v0.8.2
Broken in: v0.8.3
Broken in: v0.8.4
Broken in: v0.8.5
Broken in: v0.8.6
Broken in: v0.8.7
Broken in: v0.8.8
Broken in: v0.9.0
Broken in: v0.9.1
Broken in: v0.9.2
Broken in: v0.9.3
Broken in: v0.9.4
Broken in: v0.9.5
Broken in: v0.9.6
Broken in: v0.9.7
Broken in: v0.9.8
Broken in: v0.9.9
Broken in: v0.9.10
Broken in: v0.9.11
Broken in: v0.9.12
Broken in: v0.9.13
Broken in: v1.0.0
Broken in: v1.0.1
Broken in: v1.0.2
Broken in: v1.0.3
Broken in: v1.0.4
Broken in: v1.0.5
Broken in: v1.0.6
Broken in: v1.1.0
Broken in: v1.1.1
Broken in: v1.1.2
Broken in: v1.1.3
Broken in: v1.1.4
Broken in: v1.2.0
Broken in: v1.2.1
Broken in: v1.2.2
Broken in: v1.2.3
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: d6b27d3e4c40946efa79e91d134616b41b1666c4
Branch: v0.9.6-maint
Broken in: v0.9.6.1
Broken in: v0.9.6.2
Broken in: v0.9.6.3
Broken in: v0.9.6.4
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Fixed by: be7a5de9d0c406f36efae3230e1743c613ad6945
Branch: v0.9.11-maint
Broken in: v0.9.11.1
Broken in: v0.9.11.2
Broken in: v0.9.11.3
Broken in: v0.9.11.4
Broken in: v0.9.11.5
Broken in: v0.9.11.6
Broken in: v0.9.11.7
Broken in: v0.9.11.8
Broken in: v0.9.11.9
Broken in: v0.9.11.10
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Branch: v0.9.12-maint
Broken in: v0.9.12.1
Broken in: v0.9.12.2
Broken in: v0.9.12.3
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Fixed by: 022b34cee73f86b01724b5279cf626df9cca245f
Branch: v1.0.5-maint
Broken in: v1.0.5.1
Broken in: v1.0.5.2
Broken in: v1.0.5.3
Broken in: v1.0.5.4
Broken in: v1.0.5.5
Broken in: v1.0.5.6
Broken in: v1.0.5.7
Broken in: v1.0.5.8
Broken in: v1.0.5.9
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Fixed by: 4410a83e18c1b41f1f5d3f10a0b648fc9304bc35
Branch: v1.1.0-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: 6f4eae73a0bf3e1c5e9597e4f9a8078cad69b1e3
Branch: v1.1.1-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: cfc94140e5989c9f3cce0fdbb758730818cb2572
Branch: v1.1.2-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: 8fd2005cc0594742dc6cfab07a62f9774798a56d
Branch: v1.1.3-maint
Broken in: v1.1.3.1
Broken in: v1.1.3.2
Broken in: v1.1.3.3
Broken in: v1.1.3.4
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: 46de45d079ae2622660fe147cf237ee617cc461c
Branch: v1.1.4-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: e2b96d539f8a06e08cdf001627efe3f399db9c07
Branch: v1.2.0-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: 9b1d09377492a4ce92498abb7cf830d693bc661c
Branch: v1.2.1-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: 877388678a77bacf802f97de429b2b350b02eb41
Branch: v1.2.2-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: ab07ebeb22b1d724999dc6eabc33cd6266de496f
Branch: v1.2.3-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: a45368839fb898feb6b634df2bf337697155ea74
Branch: v1.2.4-maint
Broken by: 77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e
Broken by: 387941fb626d9362835aa216b4a871e18268f649
Broken by: 0b7d2ae653f583825f6d83bfb0744673648a9833
Broken by: ed3bac713c3cfc055ef551cbfe92a061084382c3
Fixed by: a8480e2bc0d0b1c5cd98ff7424cace3e82db5ace
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
10 years, 7 months
[libvirt] [PATCH] util: changing all the "enum" structures into typedef's in "src/util/" directory.
by Julio Faracco
In "src/util/" there are many enumeration (enum) structures. Sometimes, it's better using a typedef for variable types, function types and other usages. Other enumeration will be changed to typedef's in the future.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/conf/domain_conf.c | 4 ++--
src/qemu/qemu_command.c | 12 ++++++------
src/qemu/qemu_command.h | 4 ++--
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 16 ++++++++--------
src/qemu/qemu_process.c | 2 +-
src/qemu/qemu_process.h | 2 +-
src/storage/storage_backend.c | 2 +-
src/util/viraudit.c | 2 +-
src/util/viraudit.h | 6 +++---
src/util/virfile.c | 4 ++--
src/util/virfile.h | 8 ++++----
src/util/virhook.h | 24 ++++++++++++------------
src/util/virinitctl.h | 5 ++---
src/util/virnetdevmacvlan.c | 10 +++++-----
src/util/virnetdevmacvlan.h | 12 ++++++------
src/util/virnetdevvportprofile.c | 4 ++--
src/util/virnetdevvportprofile.h | 8 ++++----
src/util/virnuma.h | 4 ++--
src/util/virseclabel.h | 4 ++--
src/util/virstorageencryption.h | 4 ++--
src/util/virstoragefile.h | 28 ++++++++++++++--------------
src/util/virsysinfo.h | 4 ++--
tests/virstoragetest.c | 2 +-
24 files changed, 86 insertions(+), 87 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c655bcf..402c234 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4972,7 +4972,7 @@ virDomainDiskSourceParse(xmlNodePtr node,
memset(&host, 0, sizeof(host));
- switch ((enum virStorageType)src->type) {
+ switch ((virStorageType)src->type) {
case VIR_STORAGE_TYPE_FILE:
src->path = virXMLPropString(node, "file");
break;
@@ -14847,7 +14847,7 @@ virDomainDiskSourceFormat(virBufferPtr buf,
startupPolicy = virDomainStartupPolicyTypeToString(policy);
if (src->path || src->nhosts > 0 || src->srcpool || startupPolicy) {
- switch ((enum virStorageType)src->type) {
+ switch ((virStorageType)src->type) {
case VIR_STORAGE_TYPE_FILE:
virBufferAddLit(buf, "<source");
virBufferEscapeString(buf, " file='%s'", src->path);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6d80042..474b8db 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -163,7 +163,7 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
- enum virNetDevVPortProfileOp vmop)
+ virNetDevVPortProfileOp vmop)
{
int rc;
char *res_ifname = NULL;
@@ -3567,7 +3567,7 @@ qemuNetworkDriveGetPort(int protocol,
return ret;
}
- switch ((enum virStorageNetProtocol) protocol) {
+ switch ((virStorageNetProtocol) protocol) {
case VIR_STORAGE_NET_PROTOCOL_HTTP:
return 80;
@@ -3618,7 +3618,7 @@ qemuBuildNetworkDriveURI(int protocol,
virURIPtr uri = NULL;
size_t i;
- switch ((enum virStorageNetProtocol) protocol) {
+ switch ((virStorageNetProtocol) protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
if (nhosts != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -3856,7 +3856,7 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
}
}
- switch ((enum virStorageType) actualType) {
+ switch ((virStorageType) actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
case VIR_STORAGE_TYPE_DIR:
@@ -7509,7 +7509,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps,
int vlan,
int bootindex,
- enum virNetDevVPortProfileOp vmop,
+ virNetDevVPortProfileOp vmop,
bool standalone)
{
int ret = -1;
@@ -7704,7 +7704,7 @@ qemuBuildCommandLine(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop,
+ virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
bool standalone)
{
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 0866c6b..ecd1d45 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -75,7 +75,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr current_snapshot,
- enum virNetDevVPortProfileOp vmop,
+ virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
bool forXMLToArgv)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(11);
@@ -195,7 +195,7 @@ int qemuPhysIfaceConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
- enum virNetDevVPortProfileOp vmop);
+ virNetDevVPortProfileOp vmop);
int qemuOpenVhostNet(virDomainDefPtr def,
virDomainNetDefPtr net,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ab19738..3345474 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2269,7 +2269,7 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
for (i = vm->def->ndisks; i > 0; i--) {
disk = vm->def->disks[i - 1];
const char *path = virDomainDiskGetSource(disk);
- enum virStorageFileFormat format = virDomainDiskGetFormat(disk);
+ virStorageFileFormat format = virDomainDiskGetFormat(disk);
if (!path)
continue;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 69a7053..c87ae45 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12307,13 +12307,13 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
{
int actualType = virStorageSourceGetActualType(&disk->src);
- switch ((enum virStorageType) actualType) {
+ switch ((virStorageType) actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((enum virStorageNetProtocol) disk->src.protocol) {
+ switch ((virStorageNetProtocol) disk->src.protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@@ -12369,13 +12369,13 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
{
int actualType = virStorageSourceGetActualType(&disk->src);
- switch ((enum virStorageType) actualType) {
+ switch ((virStorageType) actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((enum virStorageNetProtocol) disk->src.protocol) {
+ switch ((virStorageNetProtocol) disk->src.protocol) {
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
return 0;
@@ -12417,7 +12417,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayInactive(virDomainSnapshotDiskDefPtr
{
int actualType = virStorageSourceGetActualType(&disk->src);
- switch ((enum virStorageType) actualType) {
+ switch ((virStorageType) actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
return 0;
@@ -12514,13 +12514,13 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
actualType = virStorageSourceGetActualType(&disk->src);
- switch ((enum virStorageType) actualType) {
+ switch ((virStorageType) actualType) {
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
return 0;
case VIR_STORAGE_TYPE_NETWORK:
- switch ((enum virStorageNetProtocol) disk->src.protocol) {
+ switch ((virStorageNetProtocol) disk->src.protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@@ -12747,7 +12747,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
VIR_STRDUP(persistSource, snap->src.path) < 0)
goto cleanup;
- switch ((enum virStorageType)snap->src.type) {
+ switch ((virStorageType)snap->src.type) {
case VIR_STORAGE_TYPE_BLOCK:
reuse = true;
/* fallthrough */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0afad9d..bfabbc5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3606,7 +3606,7 @@ int qemuProcessStart(virConnectPtr conn,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop,
+ virNetDevVPortProfileOp vmop,
unsigned int flags)
{
int ret;
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index 4176815..d99978f 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -57,7 +57,7 @@ int qemuProcessStart(virConnectPtr conn,
int stdin_fd,
const char *stdin_path,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop,
+ virNetDevVPortProfileOp vmop,
unsigned int flags);
typedef enum {
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 946196b..5eec90d 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -736,7 +736,7 @@ virStorageBackendCreateQemuImgOpts(char **opts,
for (i = 0; i < VIR_STORAGE_FILE_FEATURE_LAST; i++) {
ignore_value(virBitmapGetBit(features, i, &b));
if (b) {
- switch ((enum virStorageFileFeature) i) {
+ switch ((virStorageFileFeature) i) {
case VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS:
if (STREQ_NULLABLE(compat, "0.10")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 33ed2f6..8023c60 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -82,7 +82,7 @@ void virAuditSend(virLogSourcePtr source,
const char *funcname,
const char *clienttty ATTRIBUTE_UNUSED,
const char *clientaddr ATTRIBUTE_UNUSED,
- enum virAuditRecordType type ATTRIBUTE_UNUSED, bool success,
+ virAuditRecordType type ATTRIBUTE_UNUSED, bool success,
const char *fmt, ...)
{
char *str = NULL;
diff --git a/src/util/viraudit.h b/src/util/viraudit.h
index cf3da6c..8101e50 100644
--- a/src/util/viraudit.h
+++ b/src/util/viraudit.h
@@ -26,11 +26,11 @@
# include "internal.h"
# include "virlog.h"
-enum virAuditRecordType {
+typedef enum {
VIR_AUDIT_RECORD_MACHINE_CONTROL,
VIR_AUDIT_RECORD_MACHINE_ID,
VIR_AUDIT_RECORD_RESOURCE,
-};
+} virAuditRecordType;
int virAuditOpen(void);
@@ -39,7 +39,7 @@ void virAuditLog(int enabled);
void virAuditSend(virLogSourcePtr source,
const char *filename, size_t linenr, const char *funcname,
const char *clienttty, const char *clientaddr,
- enum virAuditRecordType type, bool success,
+ virAuditRecordType type, bool success,
const char *fmt, ...)
ATTRIBUTE_FMT_PRINTF(9, 10);
diff --git a/src/util/virfile.c b/src/util/virfile.c
index da4e0a0..dc2f2b2 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -818,7 +818,7 @@ virFileNBDDeviceFindUnused(void)
int virFileNBDDeviceAssociate(const char *file,
- enum virStorageFileFormat fmt,
+ virStorageFileFormat fmt,
bool readonly,
char **dev)
{
@@ -887,7 +887,7 @@ int virFileLoopDeviceAssociate(const char *file,
}
int virFileNBDDeviceAssociate(const char *file,
- enum virStorageFileFormat fmt ATTRIBUTE_UNUSED,
+ virStorageFileFormat fmt ATTRIBUTE_UNUSED,
bool readonly ATTRIBUTE_UNUSED,
char **dev ATTRIBUTE_UNUSED)
{
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 5d0d699..25678df 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -31,7 +31,7 @@
# include "internal.h"
# include "virstoragefile.h"
-typedef enum virFileCloseFlags {
+typedef enum {
VIR_FILE_CLOSE_PRESERVE_ERRNO = 1 << 0,
VIR_FILE_CLOSE_IGNORE_EBADF = 1 << 1,
VIR_FILE_CLOSE_DONT_LOG = 1 << 2,
@@ -83,10 +83,10 @@ typedef virFileWrapperFd *virFileWrapperFdPtr;
int virFileDirectFdFlag(void);
-enum virFileWrapperFdFlags {
+typedef enum {
VIR_FILE_WRAPPER_BYPASS_CACHE = (1 << 0),
VIR_FILE_WRAPPER_NON_BLOCKING = (1 << 1),
-};
+} virFileWrapperFdFlags;
virFileWrapperFdPtr virFileWrapperFdNew(int *fd,
const char *name,
@@ -116,7 +116,7 @@ int virFileLoopDeviceAssociate(const char *file,
char **dev);
int virFileNBDDeviceAssociate(const char *file,
- enum virStorageFileFormat fmt,
+ virStorageFileFormat fmt,
bool readonly,
char **dev);
diff --git a/src/util/virhook.h b/src/util/virhook.h
index 7b09ac5..5bc0a5f 100644
--- a/src/util/virhook.h
+++ b/src/util/virhook.h
@@ -26,32 +26,32 @@
# include "internal.h"
-enum virHookDriverType {
+typedef enum {
VIR_HOOK_DRIVER_DAEMON = 0, /* Daemon related events */
VIR_HOOK_DRIVER_QEMU, /* QEmu domains related events */
VIR_HOOK_DRIVER_LXC, /* LXC domains related events */
VIR_HOOK_DRIVER_NETWORK, /* network related events */
VIR_HOOK_DRIVER_LAST,
-};
+} virHookDriverType;
-enum virHookDaemonOpType {
+typedef enum {
VIR_HOOK_DAEMON_OP_START, /* daemon is about to start */
VIR_HOOK_DAEMON_OP_SHUTDOWN, /* daemon is about to shutdown */
VIR_HOOK_DAEMON_OP_RELOAD, /* driver reload with SIGHUP */
VIR_HOOK_DAEMON_OP_LAST,
-};
+} virHookDaemonOpType;
-enum virHookSubopType {
+typedef enum {
VIR_HOOK_SUBOP_NONE, /* no sub-operation */
VIR_HOOK_SUBOP_BEGIN, /* beginning of the operation */
VIR_HOOK_SUBOP_END, /* end of the operation */
VIR_HOOK_SUBOP_LAST,
-};
+} virHookSubopType;
-enum virHookQemuOpType {
+typedef enum {
VIR_HOOK_QEMU_OP_START, /* domain is about to start */
VIR_HOOK_QEMU_OP_STOPPED, /* domain has stopped */
VIR_HOOK_QEMU_OP_PREPARE, /* domain startup initiated */
@@ -62,9 +62,9 @@ enum virHookQemuOpType {
VIR_HOOK_QEMU_OP_ATTACH, /* domain is being attached to be libvirt */
VIR_HOOK_QEMU_OP_LAST,
-};
+} virHookQemuOpType;
-enum virHookLxcOpType {
+typedef enum {
VIR_HOOK_LXC_OP_START, /* domain is about to start */
VIR_HOOK_LXC_OP_STOPPED, /* domain has stopped */
VIR_HOOK_LXC_OP_PREPARE, /* domain startup initiated */
@@ -73,9 +73,9 @@ enum virHookLxcOpType {
VIR_HOOK_LXC_OP_RECONNECT, /* domain is being reconnected by libvirt */
VIR_HOOK_LXC_OP_LAST,
-};
+} virHookLxcOpType;
-enum virHookNetworkOpType {
+typedef enum {
VIR_HOOK_NETWORK_OP_START, /* network is about to start */
VIR_HOOK_NETWORK_OP_STARTED, /* network has start */
VIR_HOOK_NETWORK_OP_STOPPED, /* network has stopped */
@@ -83,7 +83,7 @@ enum virHookNetworkOpType {
VIR_HOOK_NETWORK_OP_IFACE_UNPLUGGED, /* an interface was unplugged from the network */
VIR_HOOK_NETWORK_OP_LAST,
-};
+} virHookNetworkOpType;
int virHookInitialize(void);
diff --git a/src/util/virinitctl.h b/src/util/virinitctl.h
index 6aeb1a6..75a9a50 100644
--- a/src/util/virinitctl.h
+++ b/src/util/virinitctl.h
@@ -24,8 +24,7 @@
#ifndef __VIR_INITCTL_H__
# define __VIR_INITCTL_H__
-typedef enum virInitctlRunLevel virInitctlRunLevel;
-enum virInitctlRunLevel {
+typedef enum {
VIR_INITCTL_RUNLEVEL_POWEROFF = 0,
VIR_INITCTL_RUNLEVEL_1 = 1,
VIR_INITCTL_RUNLEVEL_2 = 2,
@@ -35,7 +34,7 @@ enum virInitctlRunLevel {
VIR_INITCTL_RUNLEVEL_REBOOT = 6,
VIR_INITCTL_RUNLEVEL_LAST
-};
+} virInitctlRunLevel;
int virInitctlSetRunLevel(virInitctlRunLevel level);
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 7bbf540..56a5f6b 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -434,7 +434,7 @@ struct virNetlinkCallbackData {
char *linkdev;
int vf;
unsigned char vmuuid[VIR_UUID_BUFLEN];
- enum virNetDevVPortProfileOp vmOp;
+ virNetDevVPortProfileOp vmOp;
unsigned int linkState;
};
@@ -748,7 +748,7 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
const char *linkdev,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
- enum virNetDevVPortProfileOp vmOp)
+ virNetDevVPortProfileOp vmOp)
{
virNetlinkCallbackDataPtr calld = NULL;
@@ -803,13 +803,13 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
const virMacAddr *macaddress,
const char *linkdev,
- enum virNetDevMacVLanMode mode,
+ virNetDevMacVLanMode mode,
bool withTap,
int vnet_hdr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname,
- enum virNetDevVPortProfileOp vmOp,
+ virNetDevVPortProfileOp vmOp,
char *stateDir,
virNetDevBandwidthPtr bandwidth)
{
@@ -1022,7 +1022,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
const char *linkdev,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
- enum virNetDevVPortProfileOp vmOp)
+ virNetDevVPortProfileOp vmOp)
{
int rc = 0;
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 225ddba..9b15a31 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -30,14 +30,14 @@
# include "virnetdevvportprofile.h"
/* the mode type for macvtap devices */
-enum virNetDevMacVLanMode {
+typedef enum {
VIR_NETDEV_MACVLAN_MODE_VEPA,
VIR_NETDEV_MACVLAN_MODE_PRIVATE,
VIR_NETDEV_MACVLAN_MODE_BRIDGE,
VIR_NETDEV_MACVLAN_MODE_PASSTHRU,
VIR_NETDEV_MACVLAN_MODE_LAST,
-};
+} virNetDevMacVLanMode;
VIR_ENUM_DECL(virNetDevMacVLanMode)
int virNetDevMacVLanCreate(const char *ifname,
@@ -55,13 +55,13 @@ int virNetDevMacVLanDelete(const char *ifname)
int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
const virMacAddr *macaddress,
const char *linkdev,
- enum virNetDevMacVLanMode mode,
+ virNetDevMacVLanMode mode,
bool withTap,
int vnet_hdr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname,
- enum virNetDevVPortProfileOp vmop,
+ virNetDevVPortProfileOp vmop,
char *stateDir,
virNetDevBandwidthPtr bandwidth)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(7)
@@ -81,7 +81,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
const char *linkdev,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
- enum virNetDevVPortProfileOp vmOp)
+ virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
@@ -90,7 +90,7 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
const char *linkdev,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
- enum virNetDevVPortProfileOp vmOp)
+ virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
#endif /* __UTIL_MACVTAP_H__ */
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 8977275..7354b2c 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -1139,7 +1139,7 @@ virNetDevVPortProfileAssociate(const char *macvtap_ifname,
const char *linkdev,
int vf,
const unsigned char *vmuuid,
- enum virNetDevVPortProfileOp vmOp,
+ virNetDevVPortProfileOp vmOp,
bool setlink_only)
{
int rc = 0;
@@ -1202,7 +1202,7 @@ virNetDevVPortProfileDisassociate(const char *macvtap_ifname,
const virMacAddr *macvtap_macaddr,
const char *linkdev,
int vf,
- enum virNetDevVPortProfileOp vmOp)
+ virNetDevVPortProfileOp vmOp)
{
int rc = 0;
diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index 3febf3a..ad063c5 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -40,7 +40,7 @@ enum virNetDevVPortProfile {
};
VIR_ENUM_DECL(virNetDevVPort)
-enum virNetDevVPortProfileOp {
+typedef enum {
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
VIR_NETDEV_VPORT_PROFILE_OP_SAVE,
VIR_NETDEV_VPORT_PROFILE_OP_RESTORE,
@@ -51,7 +51,7 @@ enum virNetDevVPortProfileOp {
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
VIR_NETDEV_VPORT_PROFILE_OP_LAST
-};
+} virNetDevVPortProfileOp;
VIR_ENUM_DECL(virNetDevVPortProfileOp)
/* profile data for macvtap (VEPA) and openvswitch */
@@ -98,7 +98,7 @@ int virNetDevVPortProfileAssociate(const char *ifname,
const char *linkdev,
int vf,
const unsigned char *vmuuid,
- enum virNetDevVPortProfileOp vmOp,
+ virNetDevVPortProfileOp vmOp,
bool setlink_only)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(6)
ATTRIBUTE_RETURN_CHECK;
@@ -108,7 +108,7 @@ int virNetDevVPortProfileDisassociate(const char *ifname,
const virMacAddr *macaddr,
const char *linkdev,
int vf,
- enum virNetDevVPortProfileOp vmOp)
+ virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4)
ATTRIBUTE_RETURN_CHECK;
diff --git a/src/util/virnuma.h b/src/util/virnuma.h
index eee0225..8464b19 100644
--- a/src/util/virnuma.h
+++ b/src/util/virnuma.h
@@ -26,13 +26,13 @@
# include "virbitmap.h"
# include "virutil.h"
-enum virNumaTuneMemPlacementMode {
+typedef enum {
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO,
VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST
-};
+} virNumaTuneMemPlacementMode;
VIR_ENUM_DECL(virNumaTuneMemPlacementMode)
diff --git a/src/util/virseclabel.h b/src/util/virseclabel.h
index 41b90bc..9e970a5 100644
--- a/src/util/virseclabel.h
+++ b/src/util/virseclabel.h
@@ -22,14 +22,14 @@
#ifndef __SECLABEL_H
# define __SECLABEL_H
-enum virDomainSeclabelType {
+typedef enum {
VIR_DOMAIN_SECLABEL_DEFAULT,
VIR_DOMAIN_SECLABEL_NONE,
VIR_DOMAIN_SECLABEL_DYNAMIC,
VIR_DOMAIN_SECLABEL_STATIC,
VIR_DOMAIN_SECLABEL_LAST
-};
+} virDomainSeclabelType;
/* Security configuration for domain */
typedef struct _virSecurityLabelDef virSecurityLabelDef;
diff --git a/src/util/virstorageencryption.h b/src/util/virstorageencryption.h
index 03c38a5..bf83d34 100644
--- a/src/util/virstorageencryption.h
+++ b/src/util/virstorageencryption.h
@@ -29,11 +29,11 @@
# include <libxml/tree.h>
-enum virStorageEncryptionSecretType {
+typedef enum {
VIR_STORAGE_ENCRYPTION_SECRET_TYPE_PASSPHRASE = 0,
VIR_STORAGE_ENCRYPTION_SECRET_TYPE_LAST
-};
+} virStorageEncryptionSecretType;
VIR_ENUM_DECL(virStorageEncryptionSecretType)
typedef struct _virStorageEncryptionSecret virStorageEncryptionSecret;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 148776e..8d6e610 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -42,7 +42,7 @@
* virStorageVolType, except we have an undetermined state, don't have
* a netdir type, and add a volume type for reference through a
* storage pool. */
-enum virStorageType {
+typedef enum {
VIR_STORAGE_TYPE_NONE,
VIR_STORAGE_TYPE_FILE,
VIR_STORAGE_TYPE_BLOCK,
@@ -51,12 +51,12 @@ enum virStorageType {
VIR_STORAGE_TYPE_VOLUME,
VIR_STORAGE_TYPE_LAST
-};
+} virStorageType;
VIR_ENUM_DECL(virStorage)
-enum virStorageFileFormat {
+typedef enum {
VIR_STORAGE_FILE_AUTO_SAFE = -2,
VIR_STORAGE_FILE_AUTO = -1,
VIR_STORAGE_FILE_NONE = 0,
@@ -84,15 +84,15 @@ enum virStorageFileFormat {
VIR_STORAGE_FILE_VMDK,
VIR_STORAGE_FILE_LAST,
-};
+} virStorageFileFormat;
VIR_ENUM_DECL(virStorageFileFormat);
-enum virStorageFileFeature {
+typedef enum {
VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS = 0,
VIR_STORAGE_FILE_FEATURE_LAST
-};
+} virStorageFileFeature;
VIR_ENUM_DECL(virStorageFileFeature);
@@ -117,7 +117,7 @@ struct _virStorageTimestamps {
/* Information related to network storage */
-enum virStorageNetProtocol {
+typedef enum {
VIR_STORAGE_NET_PROTOCOL_NBD,
VIR_STORAGE_NET_PROTOCOL_RBD,
VIR_STORAGE_NET_PROTOCOL_SHEEPDOG,
@@ -130,18 +130,18 @@ enum virStorageNetProtocol {
VIR_STORAGE_NET_PROTOCOL_TFTP,
VIR_STORAGE_NET_PROTOCOL_LAST
-};
+} virStorageNetProtocol;
VIR_ENUM_DECL(virStorageNetProtocol)
-enum virStorageNetHostTransport {
+typedef enum {
VIR_STORAGE_NET_HOST_TRANS_TCP,
VIR_STORAGE_NET_HOST_TRANS_UNIX,
VIR_STORAGE_NET_HOST_TRANS_RDMA,
VIR_STORAGE_NET_HOST_TRANS_LAST
-};
+} virStorageNetHostTransport;
VIR_ENUM_DECL(virStorageNetHostTransport)
@@ -160,7 +160,7 @@ struct _virStorageNetHostDef {
* Used for volume "type" disk to indicate how to represent
* the disk source if the specified "pool" is of iscsi type.
*/
-enum virStorageSourcePoolMode {
+typedef enum {
VIR_STORAGE_SOURCE_POOL_MODE_DEFAULT = 0,
/* Use the path as it shows up on host, e.g.
@@ -174,7 +174,7 @@ enum virStorageSourcePoolMode {
VIR_STORAGE_SOURCE_POOL_MODE_DIRECT,
VIR_STORAGE_SOURCE_POOL_MODE_LAST
-};
+} virStorageSourcePoolMode;
VIR_ENUM_DECL(virStorageSourcePoolMode)
@@ -190,13 +190,13 @@ struct _virStorageSourcePoolDef {
typedef virStorageSourcePoolDef *virStorageSourcePoolDefPtr;
-enum virStorageSecretType {
+typedef enum {
VIR_STORAGE_SECRET_TYPE_NONE,
VIR_STORAGE_SECRET_TYPE_UUID,
VIR_STORAGE_SECRET_TYPE_USAGE,
VIR_STORAGE_SECRET_TYPE_LAST
-};
+} virStorageSecretType;
typedef struct _virStorageDriverData virStorageDriverData;
typedef virStorageDriverData *virStorageDriverDataPtr;
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index fbb505b..6236ca6 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -28,11 +28,11 @@
# include "virutil.h"
# include "virbuffer.h"
-enum virSysinfoType {
+typedef enum {
VIR_SYSINFO_SMBIOS,
VIR_SYSINFO_LAST
-};
+} virSysinfoType;
typedef struct _virSysinfoProcessorDef virSysinfoProcessorDef;
typedef virSysinfoProcessorDef *virSysinfoProcessorDefPtr;
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 018469a..d49098e 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -294,7 +294,7 @@ enum {
struct testChainData
{
const char *start;
- enum virStorageFileFormat format;
+ virStorageFileFormat format;
const testFileData *files[4];
int nfiles;
unsigned int flags;
--
1.7.10.4
10 years, 7 months
[libvirt] [PATCH 1/5] conf: changing all the "enum" structures into typedef's in "src/conf/" directory.
by Julio Faracco
In "src/conf/" there are many enumeration (enum) structures like "src/util" directory. Sometimes, it's better using a typedef for variable types, function types and other usages. Other enumeration and folders will be changed to typedef's in the future.
Most of the files changed in this commit included CPU (cpu_conf) enum structures.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/conf/cpu_conf.c | 2 +-
src/conf/cpu_conf.h | 22 +++++++++++-----------
src/conf/device_conf.h | 4 ++--
src/cpu/cpu_powerpc.c | 2 +-
src/cpu/cpu_x86.c | 4 ++--
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index a8b1b03..ebdaa19 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -176,7 +176,7 @@ virCPUDefCopy(const virCPUDef *cpu)
virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
- enum virCPUType mode)
+ virCPUType mode)
{
virCPUDefPtr def;
xmlNodePtr *nodes = NULL;
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index dbe7103..8c932ce 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -32,46 +32,46 @@
# define VIR_CPU_VENDOR_ID_LENGTH 12
-enum virCPUType {
+typedef enum {
VIR_CPU_TYPE_HOST,
VIR_CPU_TYPE_GUEST,
VIR_CPU_TYPE_AUTO,
VIR_CPU_TYPE_LAST
-};
+} virCPUType;
VIR_ENUM_DECL(virCPU)
-enum virCPUMode {
+typedef enum {
VIR_CPU_MODE_CUSTOM,
VIR_CPU_MODE_HOST_MODEL,
VIR_CPU_MODE_HOST_PASSTHROUGH,
VIR_CPU_MODE_LAST
-};
+} virCPUMode;
VIR_ENUM_DECL(virCPUMode)
-enum virCPUMatch {
+typedef enum {
VIR_CPU_MATCH_MINIMUM,
VIR_CPU_MATCH_EXACT,
VIR_CPU_MATCH_STRICT,
VIR_CPU_MATCH_LAST
-};
+} virCPUMatch;
VIR_ENUM_DECL(virCPUMatch)
-enum virCPUFallback {
+typedef enum {
VIR_CPU_FALLBACK_ALLOW,
VIR_CPU_FALLBACK_FORBID,
VIR_CPU_FALLBACK_LAST
-};
+} virCPUFallback;
VIR_ENUM_DECL(virCPUFallback)
-enum virCPUFeaturePolicy {
+typedef enum {
VIR_CPU_FEATURE_FORCE,
VIR_CPU_FEATURE_REQUIRE,
VIR_CPU_FEATURE_OPTIONAL,
@@ -79,7 +79,7 @@ enum virCPUFeaturePolicy {
VIR_CPU_FEATURE_FORBID,
VIR_CPU_FEATURE_LAST
-};
+} virCPUFeaturePolicy;
VIR_ENUM_DECL(virCPUFeaturePolicy)
@@ -140,7 +140,7 @@ virCPUDefCopy(const virCPUDef *cpu);
virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
- enum virCPUType mode);
+ virCPUType mode);
bool
virCPUDefIsEqual(virCPUDefPtr src,
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 7986ca6..d66afd2 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -32,13 +32,13 @@
# include "virthread.h"
# include "virbuffer.h"
-enum virDeviceAddressPCIMulti {
+typedef enum {
VIR_DEVICE_ADDRESS_PCI_MULTI_DEFAULT = 0,
VIR_DEVICE_ADDRESS_PCI_MULTI_ON,
VIR_DEVICE_ADDRESS_PCI_MULTI_OFF,
VIR_DEVICE_ADDRESS_PCI_MULTI_LAST
-};
+} virDeviceAddressPCIMulti;
typedef struct _virDevicePCIAddress virDevicePCIAddress;
typedef virDevicePCIAddress *virDevicePCIAddressPtr;
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 3b868bb..372272f 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -534,7 +534,7 @@ static int
ppcUpdate(virCPUDefPtr guest,
const virCPUDef *host)
{
- switch ((enum virCPUMode) guest->mode) {
+ switch ((virCPUMode) guest->mode) {
case VIR_CPU_MODE_HOST_MODEL:
case VIR_CPU_MODE_HOST_PASSTHROUGH:
guest->match = VIR_CPU_MATCH_EXACT;
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 7328582..06fbfba 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1615,7 +1615,7 @@ x86DecodeCPUData(virCPUDefPtr cpu,
static virCPUx86Data *
x86EncodePolicy(const virCPUDef *cpu,
const struct x86_map *map,
- enum virCPUFeaturePolicy policy)
+ virCPUFeaturePolicy policy)
{
struct x86_model *model;
virCPUx86Data *data = NULL;
@@ -2045,7 +2045,7 @@ static int
x86Update(virCPUDefPtr guest,
const virCPUDef *host)
{
- switch ((enum virCPUMode) guest->mode) {
+ switch ((virCPUMode) guest->mode) {
case VIR_CPU_MODE_CUSTOM:
return x86UpdateCustom(guest, host);
--
1.7.10.4
10 years, 7 months
[libvirt] [PATCH] spec: Don't install nonexistent test_libvirt_lockd.aug
by Jiri Denemark
test_libvirt_lockd.aug is only generated when qemu driver is enabled.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
libvirt.spec.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 84d5bf3..ae40e0e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1878,7 +1878,9 @@ exit 0
%{_datadir}/augeas/lenses/virtlockd.aug
%{_datadir}/augeas/lenses/tests/test_virtlockd.aug
%{_datadir}/augeas/lenses/libvirt_lockd.aug
+ %if %{with_qemu}
%{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug
+ %endif
%if %{with_polkit}
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
--
1.9.2
10 years, 7 months
[libvirt] [PATCH] spec: sanlock is x86_64 only on RHEL
by Jiri Denemark
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
libvirt.spec.in | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index aeccf4f..84d5bf3 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -262,16 +262,11 @@
%endif
# Enable sanlock library for lock management with QEMU
-# Sanlock is available only on i686 x86_64 for RHEL
+# Sanlock is available only on x86_64 for RHEL
%if 0%{?fedora} >= 16
%define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
%endif
-%if 0%{?rhel} == 6
- %ifarch %{ix86} x86_64
- %define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
- %endif
-%endif
-%if 0%{?rhel} >= 7
+%if 0%{?rhel} >= 6
%ifarch x86_64
%define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
%endif
--
1.9.2
10 years, 7 months
[libvirt] [PATCH 0/2] qemu: support pci passthrough of devices in non-0 domain
by Laine Stump
qemu added support for this somewhere between 0.12 and 0.13, but
libvirt never caught wind of it, so we've been ignoring the domain for
all this time (not too surprising, since a non-0 PCI domain is very
rare).
Laine Stump (2):
qemu: add host-pci-multidomain capability
qemu: specify domain in host-side PCI addresses when needed/supported
src/qemu/qemu_capabilities.c | 4 +++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 13 ++++++-
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
tests/qemuhelptest.c | 3 +-
.../qemuxml2argv-hostdev-vfio-multidomain.args | 6 ++++
.../qemuxml2argv-hostdev-vfio-multidomain.xml | 33 +++++++++++++++++
.../qemuxml2argv-net-hostdev-multidomain.args | 7 ++++
.../qemuxml2argv-net-hostdev-multidomain.xml | 40 +++++++++++++++++++++
.../qemuxml2argv-net-hostdev-vfio-multidomain.args | 7 ++++
.../qemuxml2argv-net-hostdev-vfio-multidomain.xml | 41 ++++++++++++++++++++++
.../qemuxml2argv-net-hostdev-vfio.xml | 2 +-
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 2 +-
tests/qemuxml2argvtest.c | 18 ++++++++++
19 files changed, 179 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-vfio-multidomain.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-vfio-multidomain.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-multidomain.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-multidomain.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-vfio-multidomain.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-hostdev-vfio-multidomain.xml
--
1.9.0
10 years, 7 months