[libvirt] [PATCH 00/18] Get rid of virStorageFileMetadata
by Peter Krempa
Peter Krempa (18):
qemu: unexport qemuDiskChainCheckBroken
util: storagefile: Always store raw backing name in the metadata
util: storage: Don't force path canonicalization when loading metadata
util: storage: Remove obsolete argument
virStorageFileGetMetadataInternal
util: storage: Move checking of the actual backing image to the worker
storage: util: Clean up arguments of virStorageFileGetMetadataInternal
util: storage: Rename "path" to "relPath" in virStorageFileMetadata
util: storagefile: Rename "canonPath" to "path" in
virStorageFileMetadata
util: virstoragefile: Don't use "backingStore" directly
virstoragefile: Kill "backingStore" field from virStorageFileMetadata
util: storagefile: Add function to free a virStorageSourcePrt
util: storagefile: Add fields from virStorageMetadata to
virStorageSource
maint: Switch over from struct virStorageFileMetadata to
virStorageSource
util: virstorage: Kill struct virStorageFileMetadata
util: virstoragefile: Rename backingMeta to backingStore
storage: Move disk->backingChain to the recursive
disk->src.backingStore
util: virstoragefile: Don't mangle data stored about directories
util: storage: Invert the way recursive metadata retrieval works
src/conf/domain_conf.c | 17 +-
src/conf/domain_conf.h | 1 -
src/libvirt_private.syms | 2 +-
src/qemu/qemu_domain.c | 58 ++---
src/qemu/qemu_domain.h | 2 -
src/qemu/qemu_driver.c | 44 ++--
src/security/security_selinux.c | 2 +-
src/security/virt-aa-helper.c | 9 +-
src/storage/storage_backend_fs.c | 4 +-
src/storage/storage_backend_gluster.c | 4 +-
src/util/virstoragefile.c | 476 ++++++++++++++++------------------
src/util/virstoragefile.h | 88 +++----
tests/virstoragetest.c | 178 ++++++++-----
13 files changed, 435 insertions(+), 450 deletions(-)
--
1.9.1
10 years, 5 months
[libvirt] KVM connection issue
by Vikas Kokare
We are using Libvirt Java API version 0.5.0 to connect RHEL 5 KVM, and
fetch KVM environment attributes. While doing it, we are seeing the
following exception:
*this function is not supported by the connection driver:
qemuGetSchedulerTypeStack trace:
org.libvirt.ErrorHandler.processError(Unknown Source)
org.libvirt.Connect.processError(Unknown Source)
org.libvirt.Domain.processError(Unknown Source)
org.libvirt.Domain.getSchedulerType(Unknown Source)*
The machine that is running the Java code to connect to the KVM is also
RHEL 5. Is this related to certain libvirt version mismatch or something
not supported?
-Vikas
10 years, 5 months
[libvirt] [PATCHv2 1/1] Set pci-ohci as the USB default controller for PPC64.
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
PPC64 prefers to set pci-ohci controller as default USB controller.
Currently, libvirt is using legacy USB controller as default. There
are problems with VGA which can't work correctly with USB Keyboard and
USB Mouse.
While providing -nodefaults, ppc64 should be specifying the usb
controller explicitly in place of using the legacy
controller(-usb). Qemu spapr initialization code when sees "-usb" adds a
USB Keyboard and USB Mouse by default. And libvirt has added a USB
keyboard and USB mouse.
A recent fix in the in qemu VGA code uncoverd this problem, which
resulted in addition of extra keyboard and mouse to the qemu machine.
This patch is to set pci-ohci as USB default controller.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
v2 -> v1:
* Rephrase the commit message. (Nikunj A Dadhania)
src/qemu/qemu_command.c | 5 +++--
tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 379c094..46e851a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8466,8 +8466,9 @@ qemuBuildCommandLine(virConnectPtr conn,
} else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
cont->model == -1 &&
!qemuDomainMachineIsQ35(def) &&
- (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
- def->os.arch == VIR_ARCH_PPC64)) {
+ (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
+ (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) &&
+ def->os.arch == VIR_ARCH_PPC64))) {
if (usblegacy) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Multiple legacy USB controllers are "
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
index 3a21b76..eac7c56 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
@@ -3,5 +3,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-nographic -nodefconfig -nodefaults \
-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
--usb -chardev pty,id=charserial0 \
+-device pci-ohci,id=usb,bus=pci,addr=0x1 -chardev pty,id=charserial0 \
-device spapr-vty,chardev=charserial0,reg=0x30000000
--
1.8.2.1
10 years, 5 months
[libvirt] [PATCH] Qemu fails to restore when guest has selinux static context
by Shivaprasad G Bhat
The file handle passed from libvirt to qemu is not set to the context of the
guest. So, set the selinux context of fd before passing it to qemu
Signed-off-by: Shivaprasad G Bhat<sbhat(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4bb4819..8cf3666 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5522,6 +5522,9 @@ qemuDomainRestoreFlags(virConnectPtr conn,
goto cleanup;
def = NULL;
+ if (virSecurityManagerSetImageFDLabel(driver->securityManager, vm->def, fd) < 0)
+ goto cleanup;
+
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
goto cleanup;
10 years, 5 months
[libvirt] [PATCH] Fix pci bus naming for PPC
by Daniel P. Berrange
Recent discussions around naming of 'pci' vs 'pci.0' for PPC
made me go back and look at the PPC emulator in every historical
version of QEMU since 1.0. The results were worse than I imagined.
This patch adds the logic required to make libvirt work with PPC
correctly with naming variations across all versions & machine
types.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 80 +++++++++++++++++++++++++++++++++++++++-----
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_command.c | 2 +-
3 files changed, 75 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a5c6879..b491f58 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1928,6 +1928,56 @@ virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
}
+bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
+ virDomainDefPtr def)
+{
+ bool hasMultiBus = virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+
+ if (hasMultiBus)
+ return true;
+
+ if (def->os.arch == VIR_ARCH_PPC ||
+ def->os.arch == VIR_ARCH_PPC64) {
+ /*
+ * Usage of pci.0 naming:
+ *
+ * ref405ep: no pci
+ * taihu: no pci
+ * bamboo: 1.1.0
+ * mac99: 2.0.0
+ * g3beige: 2.0.0
+ * prep: 1.4.0
+ * pseries: 2.0.0
+ * mpc8544ds: forever
+ * virtex-m507: no pci
+ * ppce500: 1.6.0
+ */
+
+ if (qemuCaps->version >= 2000000)
+ return true;
+
+ if (qemuCaps->version >= 1006000 &&
+ STREQ(def->os.machine, "ppce500"))
+ return true;
+
+ if (qemuCaps->version >= 1004000 &&
+ STREQ(def->os.machine, "prep"))
+ return true;
+
+ if (qemuCaps->version >= 1001000 &&
+ STREQ(def->os.machine, "bamboo"))
+ return true;
+
+ if (STREQ(def->os.machine, "mpc8544ds"))
+ return true;
+
+ return false;
+ }
+
+ return false;
+}
+
+
const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps)
{
return qemuCaps->binary;
@@ -2809,15 +2859,22 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid)
false) < 0)
goto cleanup;
- /* Currently only x86_64 and i686 support PCI-multibus. */
+ /* x86_64 and i686 support PCI-multibus on all machine types
+ * since forever. For other architectures, it has been changing
+ * across releases, per machine type, so we can't simply detect
+ * it here. Thus the rest of the logic is provided in a separate
+ * helper virQEMUCapsHasPCIMultiBus() which keys off the machine
+ * stored in virDomainDef and QEMU version number
+ */
if (qemuCaps->arch == VIR_ARCH_X86_64 ||
- qemuCaps->arch == VIR_ARCH_I686) {
+ qemuCaps->arch == VIR_ARCH_I686)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
- } else {
- /* -no-acpi is not supported on other archs
- * even if qemu reports it in -help */
+
+ /* -no-acpi is not supported on non-x86
+ * even if qemu reports it in -help */
+ if (qemuCaps->arch != VIR_ARCH_X86_64 &&
+ qemuCaps->arch != VIR_ARCH_I686)
virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
- }
/* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
* understands the 0.13.0+ notion of "-device driver,". */
@@ -2934,9 +2991,14 @@ virQEMUCapsInitArchQMPBasic(virQEMUCapsPtr qemuCaps,
goto cleanup;
}
- /*
- * Currently only x86_64 and i686 support PCI-multibus,
- * -no-acpi and -no-kvm-pit-reinjection.
+ /* x86_64 and i686 support PCI-multibus on all machine types
+ * since forever. For other architectures, it has been changing
+ * across releases, per machine type, so we can't simply detect
+ * it here. Thus the rest of the logic is provided in a separate
+ * helper virQEMUCapsHasPCIMultiBus() which keys off the machine
+ * stored in virDomainDef and QEMU version number
+ *
+ * ACPI/HPET/KVM PIT are also x86 specific
*/
if (qemuCaps->arch == VIR_ARCH_X86_64 ||
qemuCaps->arch == VIR_ARCH_I686) {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index df8c978..5c63b81 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -239,6 +239,9 @@ void virQEMUCapsClear(virQEMUCapsPtr qemuCaps,
bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
enum virQEMUCapsFlags flag);
+bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
+ virDomainDefPtr def);
+
char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps);
const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 91367ab..403c9a9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3076,7 +3076,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
goto cleanup;
}
} else {
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS)) {
+ if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef)) {
virBufferAsprintf(buf, ",bus=%s", contAlias);
} else {
virBufferAddLit(buf, ",bus=pci");
--
1.9.0
10 years, 5 months
[libvirt] [PATCH] nwfilter: Validate rule after parsing
by Stefan Berger
From: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
An IP or IPv6 rule with port specification but without protocol
specification cannot be instantiated by ebtables. The documentation
points to 'protocol' being required but implementation does not
enforce it to be given.
Implement a rule validation function that checks whether the rule is
valid when it is defined. This for example prevents the definition
of rules like:
<ip dstportstart='53'>
where a protocol attribute would be required for it to be valid and for
ebtables to be able to instantiate it. A valid rule then is:
<ip protocol='udp' dstportstart='53'>
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
src/conf/nwfilter_conf.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index f5a75e4..ce7bc78 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2093,6 +2093,63 @@ virNWFilterRuleDefFixupIPSet(ipHdrDataDefPtr ipHdr)
}
}
+
+/*
+ * virNWFilterRuleValidate
+ *
+ * Perform some basic rule validation to prevent rules from being
+ * defined that cannot be instantiated.
+ */
+static int
+virNWFilterRuleValidate(virNWFilterRuleDefPtr rule)
+{
+ int ret = 0;
+ portDataDefPtr portData = NULL;
+ const char *protocol;
+
+ switch (rule->prtclType) {
+ case VIR_NWFILTER_RULE_PROTOCOL_IP:
+ portData = &rule->p.ipHdrFilter.portData;
+ protocol = "IP";
+ /* fall through */
+ case VIR_NWFILTER_RULE_PROTOCOL_IPV6:
+ if (portData == NULL) {
+ portData = &rule->p.ipv6HdrFilter.portData;
+ protocol = "IPv6";
+ }
+ if (HAS_ENTRY_ITEM(&portData->dataSrcPortStart) ||
+ HAS_ENTRY_ITEM(&portData->dataDstPortStart) ||
+ HAS_ENTRY_ITEM(&portData->dataSrcPortEnd) ||
+ HAS_ENTRY_ITEM(&portData->dataDstPortEnd)) {
+ if (HAS_ENTRY_ITEM(&rule->p.ipHdrFilter.ipHdr.dataProtocolID)) {
+ switch (rule->p.ipHdrFilter.ipHdr.dataProtocolID.u.u8) {
+ case 6: /* tcp */
+ case 17: /* udp */
+ case 33: /* dccp */
+ case 132: /* sctp */
+ break;
+ default:
+ ret = -1;
+ }
+ } else {
+ ret = -1;
+ }
+ if (ret < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s rule with port specification requires "
+ "protocol specification with protocol to be "
+ "either one of tcp(6), udp(17), dccp(33), or "
+ "sctp(132)"), protocol);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
static void
virNWFilterRuleDefFixup(virNWFilterRuleDefPtr rule)
{
@@ -2389,6 +2446,8 @@ virNWFilterRuleParse(xmlNodePtr node)
virAttr[i].att) < 0) {
goto err_exit;
}
+ if (virNWFilterRuleValidate(ret) < 0)
+ goto err_exit;
break;
}
if (!found) {
--
1.8.1.4
10 years, 5 months
[libvirt] [PATCHv2 0/7] more of round 2 of virstoragefile refactoring
by Eric Blake
compared to v1, this is rebased on top of Cole's changes,
treats disk partition types slightly differently, and adds
a couple patches.
1/7: was 16/n, unreviewed so far
2/7: was 13/n with weak ack
3-4/7: was 14-15/n; commit messages improved to justify it further
5-7: all new patches
I'm still working on how best to fold virStorageFileMetadata into
virStorageSource; it's a bit tricky since the metadata type is
rather awkward (storing type information about the backing file
in the parent, rather than in the backing file)
Eric Blake (7):
conf: manage disk source by struct instead of pieces
conf: tweak volume target struct details
conf: move volume structs to util/
conf: use common struct in storage volumes
conf: track sizes directly in source struct
conf: drop redundant parameters during probe
conf: modify tracking of encrypted images
src/conf/domain_conf.c | 139 ++++++++++++------------------
src/conf/domain_conf.h | 24 ++----
src/conf/snapshot_conf.c | 17 +---
src/conf/storage_conf.c | 40 ++++-----
src/conf/storage_conf.h | 51 ++---------
src/esx/esx_storage_backend_iscsi.c | 5 +-
src/esx/esx_storage_backend_vmfs.c | 20 ++---
src/parallels/parallels_driver.c | 2 +-
src/parallels/parallels_storage.c | 22 ++---
src/phyp/phyp_driver.c | 4 +-
src/storage/storage_backend.c | 150 +++++++++++++++------------------
src/storage/storage_backend.h | 11 +--
src/storage/storage_backend_disk.c | 26 +++---
src/storage/storage_backend_fs.c | 32 +++----
src/storage/storage_backend_gluster.c | 12 ++-
src/storage/storage_backend_logical.c | 18 ++--
src/storage/storage_backend_mpath.c | 8 +-
src/storage/storage_backend_rbd.c | 11 +--
src/storage/storage_backend_scsi.c | 6 +-
src/storage/storage_backend_sheepdog.c | 10 +--
src/storage/storage_driver.c | 40 ++++-----
src/test/test_driver.c | 16 ++--
src/util/virstoragefile.c | 11 ++-
src/util/virstoragefile.h | 30 ++++++-
src/vbox/vbox_tmpl.c | 11 +--
tests/storagebackendsheepdogtest.c | 5 +-
tests/virstoragetest.c | 4 +-
27 files changed, 322 insertions(+), 403 deletions(-)
--
1.9.0
10 years, 5 months
[libvirt] [PATCH 0/2] Two more setvcpu fixes
by Ján Tomko
Fix fix fix.
Ján Tomko (2):
Save domain status after cpu hotplug
Document behavior of setvcpus during guest boot
src/libvirt.c | 6 ++++++
src/qemu/qemu_driver.c | 3 +++
tools/virsh.pod | 4 +++-
3 files changed, 12 insertions(+), 1 deletion(-)
--
1.8.3.2
10 years, 5 months
[libvirt] [PATCH] bhyve: bhyveDomainDefineXML fixes
by Roman Bogorodskiy
- do not loose new definition for an active domain
- do not leak oldDef
- do not set dom->id if virDomainSaveConfig() fails
- do not call virObjectUnlock(vm) if vm is NULL
---
src/bhyve/bhyve_driver.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 0cafe4c..6d681fd 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -472,17 +472,23 @@ bhyveDomainDefineXML(virConnectPtr conn, const char *xml)
def = NULL;
vm->persistent = 1;
+ if (virDomainSaveConfig(BHYVE_CONFIG_DIR,
+ vm->newDef ? vm->newDef : vm->def) < 0) {
+ virDomainObjListRemove(privconn->domains, vm);
+ vm = NULL;
+ goto cleanup;
+ }
+
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom)
dom->id = vm->def->id;
- if (virDomainSaveConfig(BHYVE_CONFIG_DIR, vm->def) < 0)
- goto cleanup;
-
cleanup:
virObjectUnref(caps);
virDomainDefFree(def);
- virObjectUnlock(vm);
+ virDomainDefFree(oldDef);
+ if (vm)
+ virObjectUnlock(vm);
return dom;
}
--
1.9.0
10 years, 5 months
[libvirt] Google Summer of Code and Outreach Program for Women accepted projects
by Stefan Hajnoczi
Dear QEMU, Libvirt, and KVM communities,
We are participating in Google Summer of Code 2014
(http://google-melange.com/) and Outreach Program for Women
(http://opw.gnome.org/). Both programs fund candidates to work on our
open source projects for 12 weeks this summer.
Accepted projects have now been announced:
Intel IOMMU (VT-d) Emulation - Candidate: Le Tan
Mentor: Jan Kiszka
Device driver framework for low-level testing - Candidate: Marc Marí
Mentors: Paolo Bonzini and Stefan Hajnoczi
Disk image fuzz testing - Candidate: Maria Kustova (maxa)
Mentors: Fam Zheng and Stefan Hajnoczi
TianoCore support for Apple's boot.efi - Candidate: Reza Jelveh
Mentors: Alexander Graf and Gabriel Somlo
Continuous vmstate testing and dirty bitmap logging - Candidate: sanidhya
Mentor: Juan Quintela
Rewriting code of vbox driver for libvirt - Candidate: T A Mahadevan
Mentor: Michal Privoznik
Libvirt: Job Control for the Storage Driver - Candidate: TuckerD
Mentor: Martin Kletzander
Applying for the idea rewrite virtual box's driver - Candidate: uaedante
Mentor: Michal Privoznik
Congratulations to our accepted candidates and welcome to the QEMU,
libvirt, and KVM communities!
Stefan
10 years, 5 months