[libvirt] [PATCH 0/6] add fields to virStorageFileMetadata
by Eric Blake
I'm finally happy enough that I'm populating new fields correctly;
I still need to visit uses of the old fields to swap them over
to using the new fields before I can finally merge the
virStorageFileMetadata and virStorageSource structs into one.
I posted an RFC version of patch 4 earlier:
https://www.redhat.com/archives/libvir-list/2014-April/msg00047.html
since then, I've cleaned things up so that it passes the testsuite
the first time through.
Eric Blake (6):
conf: track user vs. canonical name through full chain lookup
conf: earlier allocation during backing chain crawl
conf: rename some test fields
conf: track more fields in backing chain metadata
conf: start testing contents of the new backing chain fields
conf: test for more fields
src/util/virstoragefile.c | 221 ++++++++++++++++++++++++++++---------------
src/util/virstoragefile.h | 36 ++++++-
tests/virstoragetest.c | 234 +++++++++++++++++++++++++++++++++++-----------
3 files changed, 358 insertions(+), 133 deletions(-)
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] qemu: Unexport qemuBuildNetworkDriveURI()
by Peter Krempa
The function isn't used in any other file. Convert it to static.
---
Notes:
Pushed as trivial.
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_command.h | 7 -------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3942a23..8b4a57a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3605,7 +3605,7 @@ qemuNetworkDriveGetPort(int protocol,
#define QEMU_DEFAULT_NBD_PORT "10809"
-char *
+static char *
qemuBuildNetworkDriveURI(int protocol,
const char *src,
size_t nhosts,
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index d5e8a4d..bad6ac0 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -182,13 +182,6 @@ char * qemuBuildHubDevStr(virDomainDefPtr def,
char * qemuBuildRedirdevDevStr(virDomainDefPtr def,
virDomainRedirdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
-char *qemuBuildNetworkDriveURI(int proto,
- const char *src,
- size_t nhosts,
- virStorageNetHostDefPtr hosts,
- const char *username,
- const char *secret);
-
int qemuNetworkIfaceConnect(virDomainDefPtr def,
virConnectPtr conn,
virQEMUDriverPtr driver,
--
1.9.1
10 years, 8 months
[libvirt] [PATCH 0/3] storage: refactor storage file helpers in storage driver after virStorageSource introduction
by Peter Krempa
Peter Krempa (3):
conf: Refactor helpers to retrieve actual storage type
storage: Refactor storage file initialization to use
virStorageSourcePtr
storage: Refactor location of metadata for storage drive access to
files
src/conf/domain_conf.c | 10 ---
src/conf/domain_conf.h | 1 -
src/conf/snapshot_conf.c | 7 ---
src/conf/snapshot_conf.h | 2 -
src/libvirt_private.syms | 3 +-
src/qemu/qemu_command.c | 6 +-
src/qemu/qemu_driver.c | 37 ++++++------
src/storage/storage_backend.c | 1 +
src/storage/storage_backend.h | 20 ++++--
src/storage/storage_backend_fs.c | 12 ++--
src/storage/storage_backend_gluster.c | 33 +++++-----
src/storage/storage_driver.c | 111 ++++++++++++----------------------
src/storage/storage_driver.h | 35 +++--------
src/util/virstoragefile.c | 10 +++
src/util/virstoragefile.h | 6 ++
15 files changed, 122 insertions(+), 172 deletions(-)
--
1.9.1
10 years, 8 months
[libvirt] [PATCH] storage: Don't update pool available/allocation pool if vol-create-as fails
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1024159
If adding a volume to a storage pool fails during the CreateXML or
CreateXMLFrom API's, we don't want to adjust the available and
allocation values for the storage pool during storageVolDelete
since we haven't adjusted the values for the create.
Refactor storageVolDelete() a bit to create a storageVolDeleteInternal()
which will handle the primary deletion activities. Add a parameter
updateMeta which will signify whether to update the values or not.
Adjust the calls from CreateXML and CreateXMLFrom to directly call the
DeleteInternal with the pool lock held. This does bypass the call
to virStorageVolDeleteEnsureACL().
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
I did try to make storageVolDelete() just be a shim to
storageVolDeleteInternal(), but ran afoul of check-aclrules.pl
since the EnsureAcl wasn't in storageVolDelete().
src/storage/storage_driver.c | 83 +++++++++++++++++++++++++++-----------------
1 file changed, 52 insertions(+), 31 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2f98f78..6b14b1b 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1553,6 +1553,51 @@ storageVolLookupByPath(virConnectPtr conn,
static int
+storageVolDeleteInternal(virStorageVolPtr obj,
+ virStorageBackendPtr backend,
+ virStoragePoolObjPtr pool,
+ virStorageVolDefPtr vol,
+ unsigned int flags,
+ bool updateMeta)
+{
+ size_t i;
+ int ret = -1;
+
+ if (!backend->deleteVol) {
+ virReportError(VIR_ERR_NO_SUPPORT,
+ "%s", _("storage pool does not support vol deletion"));
+
+ goto cleanup;
+ }
+
+ if (backend->deleteVol(obj->conn, pool, vol, flags) < 0)
+ goto cleanup;
+
+ /* Update pool metadata - don't update meta data from error paths
+ * in this module since the allocation/available weren't adjusted yet
+ */
+ if (updateMeta) {
+ pool->def->allocation -= vol->target.allocation;
+ pool->def->available += vol->target.allocation;
+ }
+
+ for (i = 0; i < pool->volumes.count; i++) {
+ if (pool->volumes.objs[i] == vol) {
+ VIR_INFO("Deleting volume '%s' from storage pool '%s'",
+ vol->name, pool->def->name);
+ virStorageVolDefFree(vol);
+
+ VIR_DELETE_ELEMENT(pool->volumes.objs, i, pool->volumes.count);
+ break;
+ }
+ }
+ ret = 0;
+
+ cleanup:
+ return ret;
+}
+
+static int
storageVolDelete(virStorageVolPtr obj,
unsigned int flags)
{
@@ -1560,7 +1605,6 @@ storageVolDelete(virStorageVolPtr obj,
virStoragePoolObjPtr pool;
virStorageBackendPtr backend;
virStorageVolDefPtr vol = NULL;
- size_t i;
int ret = -1;
storageDriverLock(driver);
@@ -1602,30 +1646,9 @@ storageVolDelete(virStorageVolPtr obj,
goto cleanup;
}
- if (!backend->deleteVol) {
- virReportError(VIR_ERR_NO_SUPPORT,
- "%s", _("storage pool does not support vol deletion"));
-
- goto cleanup;
- }
-
- if (backend->deleteVol(obj->conn, pool, vol, flags) < 0)
+ if (storageVolDeleteInternal(obj, backend, pool, vol, flags, true) < 0)
goto cleanup;
- /* Update pool metadata */
- pool->def->allocation -= vol->target.allocation;
- pool->def->available += vol->target.allocation;
-
- for (i = 0; i < pool->volumes.count; i++) {
- if (pool->volumes.objs[i] == vol) {
- VIR_INFO("Deleting volume '%s' from storage pool '%s'",
- vol->name, pool->def->name);
- virStorageVolDefFree(vol);
-
- VIR_DELETE_ELEMENT(pool->volumes.objs, i, pool->volumes.count);
- break;
- }
- }
ret = 0;
cleanup:
@@ -1634,7 +1657,6 @@ storageVolDelete(virStorageVolPtr obj,
return ret;
}
-
static virStorageVolPtr
storageVolCreateXML(virStoragePoolPtr obj,
const char *xmldesc,
@@ -1738,9 +1760,9 @@ storageVolCreateXML(virStoragePoolPtr obj,
voldef = NULL;
if (buildret < 0) {
- virStoragePoolObjUnlock(pool);
- storageVolDelete(volobj, 0);
- pool = NULL;
+ storageVolDeleteInternal(volobj, backend, pool, buildvoldef,
+ 0, false);
+ buildvoldef = NULL;
goto cleanup;
}
@@ -1908,7 +1930,6 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
origvol->building = 0;
newvol->building = 0;
allocation = newvol->target.allocation;
- newvol = NULL;
pool->asyncjobs--;
if (origpool) {
@@ -1918,11 +1939,11 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
}
if (buildret < 0) {
- virStoragePoolObjUnlock(pool);
- storageVolDelete(volobj, 0);
- pool = NULL;
+ storageVolDeleteInternal(volobj, backend, pool, newvol, 0, false);
+ newvol = NULL;
goto cleanup;
}
+ newvol = NULL;
/* Updating pool metadata */
pool->def->allocation += allocation;
--
1.9.0
10 years, 8 months
[libvirt] [PATCH 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.
This patch is to set pci-ohci as USB default controller.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
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, 8 months
[libvirt] [PATCH] build: avoid compiler warning on shadowed name
by Jean-Baptiste Rouault
Introduced in commit d1e55de3.
virstoragetest.c: In function ‘testStorageChain’:
virstoragetest.c:249:10: warning: declaration of ‘abs’ shadows a global
declaration [-Wshadow]
---
tests/virstoragetest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 74ad15c..bfdee8c 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -246,7 +246,7 @@ testStorageChain(const void *args)
virStorageFileMetadataPtr elt;
size_t i = 0;
char *broken = NULL;
- bool abs = !!(data->flags & ABS_START);
+ bool isAbs = !!(data->flags & ABS_START);
meta = virStorageFileGetMetadata(data->start, data->format, -1, -1,
(data->flags & ALLOW_PROBE) != 0);
@@ -292,7 +292,7 @@ testStorageChain(const void *args)
goto cleanup;
}
- expDirectory = abs ? data->files[i]->expDirectoryAbs
+ expDirectory = isAbs ? data->files[i]->expDirectoryAbs
: data->files[i]->expDirectoryRel;
if (virAsprintf(&expect,
"store:%s\nraw:%s\ndirectory:%s\nother:%d %d %lld %d",
--
1.8.5.3
10 years, 8 months
[libvirt] [PATCH] tests: use virBhyveCapsBuild in bhyvexml2argv test
by Roman Bogorodskiy
As we can use virBhyveCapsBuild() now, replace
testBhyveBuildCapabilities() with it.
---
tests/bhyvexml2argvtest.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index b37fbb0..aedfb01 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -6,6 +6,7 @@
# include "datatypes.h"
+# include "bhyve/bhyve_capabilities.h"
# include "bhyve/bhyve_utils.h"
# include "bhyve/bhyve_command.h"
@@ -13,33 +14,6 @@
static bhyveConn driver;
-static virCapsPtr
-testBhyveBuildCapabilities(void)
-{
- virCapsPtr caps;
- virCapsGuestPtr guest;
-
- if ((caps = virCapabilitiesNew(virArchFromHost(),
- 0, 0)) == NULL)
- return NULL;
-
- if ((guest = virCapabilitiesAddGuest(caps, "hvm",
- VIR_ARCH_X86_64,
- "bhyve",
- NULL, 0, NULL)) == NULL)
- goto error;
-
- if (virCapabilitiesAddGuestDomain(guest,
- "bhyve", NULL, NULL, 0, NULL) == NULL)
- goto error;
-
- return caps;
-
- error:
- virObjectUnref(caps);
- return NULL;
-}
-
static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline)
{
@@ -114,7 +88,7 @@ mymain(void)
{
int ret = 0;
- if ((driver.caps = testBhyveBuildCapabilities()) == NULL)
+ if ((driver.caps = virBhyveCapsBuild()) == NULL)
return EXIT_FAILURE;
if ((driver.xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)) == NULL)
--
1.9.0
10 years, 8 months
[libvirt] [PATCH 0/2] byve: domain management
by Wojciech Macek
Some enhancements and fixes with domain management.
1. Create stub for domainResume. Since bhyve does not support suspending,
this one works a little different. If domain is already running, it
reports success, but fails in all other cases.
2. add domainCreateXML routine
3. Fix persistency: when domain is not persistent, it should be forgotten
upon domainDestroy.
Wojciech Macek (2):
bhyve: stub for domainResume
bhyve: domainCreateXML
src/bhyve/bhyve_driver.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 114 insertions(+), 1 deletion(-)
--
1.9.0
10 years, 8 months
[libvirt] [PATCH 0/5] more work on virstoragefile
by Eric Blake
More patches along my way towards exposing backing chains
in domain XML.
Eric Blake (5):
conf: avoid memleak on NULL path
conf: fix detection of infinite backing loop
conf: test for more scenarios
conf: interleave virstoragetest structs
conf: another refactor of virstoragetest
src/security/virt-aa-helper.c | 5 +-
src/util/virstoragefile.c | 28 +++-
src/util/virstoragefile.h | 3 +-
tests/virstoragetest.c | 360 ++++++++++++++++++++++++------------------
4 files changed, 230 insertions(+), 166 deletions(-)
--
1.9.0
10 years, 8 months