+++ /dev/null
-From 8518fbb314727cbb3f747c20ef194df7cd1bdac3 Mon Sep 17 00:00:00 2001
-Message-Id: <8518fbb314727cbb3f747c20ef194df7cd1bdac3@dist-git>
-From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
-Date: Wed, 28 Jan 2015 12:25:11 +0100
-Subject: [PATCH] Split qemuDomainChrInsert into two parts
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-https://bugzilla.redhat.com/show_bug.cgi?id=1195155
-
-Do the allocation first, then add the actual device.
-The second part should never fail. This is good
-for live hotplug where we don't want to remove the device
-on OOM after the monitor command succeeded.
-
-The only change in behavior is that on failure, the
-vmdef->consoles array is freed, not just the first console.
-
-(cherry picked from commit daf51be5f1b0f7b41c0813d43d6b66edfbe4f6d9)
-Signed-off-by: Ján Tomko <jtomko@redhat.com>
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- src/conf/domain_conf.c | 18 +++++++++++++---
- src/conf/domain_conf.h | 7 +++++--
- src/libvirt_private.syms | 3 ++-
- src/qemu/qemu_hotplug.c | 54 +++++++++++++++++++++++++++++++++++++++++-------
- 4 files changed, 68 insertions(+), 14 deletions(-)
-
-diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
-index fed87f0..9bfffd0 100644
---- a/src/conf/domain_conf.c
-+++ b/src/conf/domain_conf.c
-@@ -11529,15 +11529,27 @@ virDomainChrGetDomainPtrs(const virDomainDef *vmdef,
-
-
- int
--virDomainChrInsert(virDomainDefPtr vmdef,
-- virDomainChrDefPtr chr)
-+virDomainChrPreAlloc(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr)
- {
- virDomainChrDefPtr **arrPtr = NULL;
- size_t *cntPtr = NULL;
-
- virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType, &arrPtr, &cntPtr);
-
-- return VIR_APPEND_ELEMENT(*arrPtr, *cntPtr, chr);
-+ return VIR_REALLOC_N(*arrPtr, *cntPtr + 1);
-+}
-+
-+void
-+virDomainChrInsertPreAlloced(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr)
-+{
-+ virDomainChrDefPtr **arrPtr = NULL;
-+ size_t *cntPtr = NULL;
-+
-+ virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType, &arrPtr, &cntPtr);
-+
-+ ignore_value(VIR_APPEND_ELEMENT_INPLACE(*arrPtr, *cntPtr, chr));
- }
-
- virDomainChrDefPtr
-diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
-index b912845..1436eb8 100644
---- a/src/conf/domain_conf.h
-+++ b/src/conf/domain_conf.h
-@@ -2543,8 +2543,11 @@ bool
- virDomainChrEquals(virDomainChrDefPtr src,
- virDomainChrDefPtr tgt);
- int
--virDomainChrInsert(virDomainDefPtr vmdef,
-- virDomainChrDefPtr chr);
-+virDomainChrPreAlloc(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr);
-+void
-+virDomainChrInsertPreAlloced(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr);
- virDomainChrDefPtr
- virDomainChrRemove(virDomainDefPtr vmdef,
- virDomainChrDefPtr chr);
-diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
-index 325a912..18c715a 100644
---- a/src/libvirt_private.syms
-+++ b/src/libvirt_private.syms
-@@ -153,7 +153,8 @@ virDomainChrDefNew;
- virDomainChrEquals;
- virDomainChrFind;
- virDomainChrGetDomainPtrs;
--virDomainChrInsert;
-+virDomainChrInsertPreAlloced;
-+virDomainChrPreAlloc;
- virDomainChrRemove;
- virDomainChrSerialTargetTypeFromString;
- virDomainChrSerialTargetTypeToString;
-diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
-index 8a3eb27..00ce77f 100644
---- a/src/qemu/qemu_hotplug.c
-+++ b/src/qemu/qemu_hotplug.c
-@@ -1390,9 +1390,9 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
-
- }
-
--int
--qemuDomainChrInsert(virDomainDefPtr vmdef,
-- virDomainChrDefPtr chr)
-+static int
-+qemuDomainChrPreInsert(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr)
- {
- if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
- chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL) {
-@@ -1407,25 +1407,63 @@ qemuDomainChrInsert(virDomainDefPtr vmdef,
- return -1;
- }
-
-- if (virDomainChrInsert(vmdef, chr) < 0)
-+ if (virDomainChrPreAlloc(vmdef, chr) < 0)
- return -1;
-
- /* Due to some crazy backcompat stuff, the first serial device is an alias
- * to the first console too. If this is the case, the definition must be
- * duplicated as first console device. */
-- if (vmdef->nserials == 1 && vmdef->nconsoles == 0) {
-- if ((!vmdef->consoles && VIR_ALLOC(vmdef->consoles) < 0) ||
-- VIR_ALLOC(vmdef->consoles[0]) < 0) {
-- virDomainChrRemove(vmdef, chr);
-+ if (vmdef->nserials == 0 && vmdef->nconsoles == 0 &&
-+ chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
-+ if (!vmdef->consoles && VIR_ALLOC(vmdef->consoles) < 0)
-+ return -1;
-+
-+ if (VIR_ALLOC(vmdef->consoles[0]) < 0) {
-+ VIR_FREE(vmdef->consoles);
- return -1;
- }
-+ vmdef->nconsoles++;
-+ }
-+ return 0;
-+}
-+
-+static void
-+qemuDomainChrInsertPreAlloced(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr)
-+{
-+ virDomainChrInsertPreAlloced(vmdef, chr);
-+ if (vmdef->nserials == 1 && vmdef->nconsoles == 0 &&
-+ chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
- vmdef->nconsoles = 1;
-
- /* Create an console alias for the serial port */
- vmdef->consoles[0]->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
- vmdef->consoles[0]->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
- }
-+}
-
-+static void
-+qemuDomainChrInsertPreAllocCleanup(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr)
-+{
-+ /* Remove the stub console added by qemuDomainChrPreInsert */
-+ if (vmdef->nserials == 0 && vmdef->nconsoles == 1 &&
-+ chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) {
-+ VIR_FREE(vmdef->consoles[0]);
-+ VIR_FREE(vmdef->consoles);
-+ vmdef->nconsoles = 0;
-+ }
-+}
-+
-+int
-+qemuDomainChrInsert(virDomainDefPtr vmdef,
-+ virDomainChrDefPtr chr)
-+{
-+ if (qemuDomainChrPreInsert(vmdef, chr) < 0) {
-+ qemuDomainChrInsertPreAllocCleanup(vmdef, chr);
-+ return -1;
-+ }
-+ qemuDomainChrInsertPreAlloced(vmdef, chr);
- return 0;
- }
-
---
-2.3.0
-
+++ /dev/null
-From babfc1d48c3a0f83592fa501b609fd839ff1a51b Mon Sep 17 00:00:00 2001
-Message-Id: <babfc1d48c3a0f83592fa501b609fd839ff1a51b@dist-git>
-From: Eric Blake <eblake@redhat.com>
-Date: Tue, 24 Feb 2015 11:59:52 +0100
-Subject: [PATCH] blockcopy: allow block device destination
-
-https://bugzilla.redhat.com/show_bug.cgi?id=1196066
-
-To date, anyone performing a block copy and pivot ends up with
-the destination being treated as <disk type='file'>. While this
-works for data access for a block device, it has at least one
-noticeable shortcoming: virDomainGetBlockInfo() reports allocation
-differently for block devices visited as files (the size of the
-device) than for block devices visited as <disk type='block'>
-(the maximum sector used, as reported by qemu); and this difference
-is significant when trying to manage qcow2 format on block devices
-that can be grown as needed.
-
-Of course, the more powerful virDomainBlockCopy() API can already
-express the ability to set the <disk> type. But a new API can't
-be backported, while a new flag to an existing API can; and it is
-also rather inconvenient to have to resort to the full power of
-generating XML when just adding a flag to the older call will do
-the trick. So this patch enhances blockcopy to let the user flag
-when the resulting XML after the copy must list the device as
-type='block'.
-
-* include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_REBASE_COPY_DEV):
-New flag.
-* src/libvirt.c (virDomainBlockRebase): Document it.
-* tools/virsh-domain.c (opts_block_copy, blockJobImpl): Add
---blockdev option.
-* tools/virsh.pod (blockcopy): Document it.
-* src/qemu/qemu_driver.c (qemuDomainBlockRebase): Allow new flag.
-(qemuDomainBlockCopy): Remember the flag, and make sure it is only
-used on actual block devices.
-* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it.
-
-Signed-off-by: Eric Blake <eblake@redhat.com>
-(cherry picked from commit b7e73585a8d96677695a52bafb156f26cbd48fb5)
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- include/libvirt/libvirt.h.in | 2 ++
- src/libvirt.c | 8 +++--
- src/qemu/qemu_driver.c | 36 ++++++++++++++--------
- .../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 4 +--
- tools/virsh-domain.c | 6 ++++
- tools/virsh.pod | 7 +++--
- 6 files changed, 45 insertions(+), 18 deletions(-)
-
-diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
-index 94de8a6..e086c8f 100644
---- a/include/libvirt/libvirt.h.in
-+++ b/include/libvirt/libvirt.h.in
-@@ -2638,6 +2638,8 @@ typedef enum {
- VIR_DOMAIN_BLOCK_REBASE_RELATIVE = 1 << 4, /* Keep backing chain
- referenced using relative
- names */
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_DEV = 1 << 5, /* Treat destination as block
-+ device instead of file */
- } virDomainBlockRebaseFlags;
-
- int virDomainBlockRebase(virDomainPtr dom, const char *disk,
-diff --git a/src/libvirt.c b/src/libvirt.c
-index 5315881..e1c02dc 100644
---- a/src/libvirt.c
-+++ b/src/libvirt.c
-@@ -19891,7 +19891,10 @@ virDomainBlockPull(virDomainPtr dom, const char *disk,
- * pre-create files with relative backing file names, rather than the default
- * of absolute backing file names; as a security precaution, you should
- * generally only use reuse_ext with the shallow flag and a non-raw
-- * destination file.
-+ * destination file. By default, the copy destination will be treated as
-+ * type='file', but using VIR_DOMAIN_BLOCK_REBASE_COPY_DEV treats the
-+ * destination as type='block' (affecting how virDomainGetBlockInfo() will
-+ * report allocation after pivoting).
- *
- * A copy job has two parts; in the first phase, the @bandwidth parameter
- * affects how fast the source is pulled into the destination, and the job
-@@ -19966,7 +19969,8 @@ virDomainBlockRebase(virDomainPtr dom, const char *disk,
- virCheckNonNullArgGoto(base, error);
- } else if (flags & (VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
- VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
-- VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)) {
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_RAW |
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_DEV)) {
- virReportInvalidArg(flags,
- _("use of flags in %s requires a copy job"),
- __FUNCTION__);
-diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
-index 162e039..c25c5ac 100644
---- a/src/qemu/qemu_driver.c
-+++ b/src/qemu/qemu_driver.c
-@@ -15781,7 +15781,8 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
-
- /* Preliminaries: find the disk we are editing, sanity checks */
- virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
-- VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT, -1);
-+ VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_DEV, -1);
-
- priv = vm->privateData;
- cfg = virQEMUDriverGetConfig(driver);
-@@ -15842,25 +15843,34 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
- virReportSystemError(errno, _("unable to stat for disk %s: %s"),
- disk->dst, dest);
- goto endjob;
-- } else if (flags & VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT) {
-+ } else if (flags & (VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_DEV)) {
- virReportSystemError(errno,
- _("missing destination file for disk %s: %s"),
- disk->dst, dest);
- goto endjob;
- }
-- } else if (!S_ISBLK(st.st_mode) && st.st_size &&
-- !(flags & VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)) {
-- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- _("external destination file for disk %s already "
-- "exists and is not a block device: %s"),
-- disk->dst, dest);
-- goto endjob;
-+ } else if (!S_ISBLK(st.st_mode)) {
-+ if (st.st_size && !(flags & VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)) {
-+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-+ _("external destination file for disk %s already "
-+ "exists and is not a block device: %s"),
-+ disk->dst, dest);
-+ goto endjob;
-+ }
-+ if (flags & VIR_DOMAIN_BLOCK_REBASE_COPY_DEV) {
-+ virReportError(VIR_ERR_INVALID_ARG,
-+ _("blockdev flag requested for disk %s, but file "
-+ "'%s' is not a block device"), disk->dst, dest);
-+ goto endjob;
-+ }
- }
-
- if (VIR_ALLOC(mirror) < 0)
- goto endjob;
- /* XXX Allow non-file mirror destinations */
-- mirror->type = VIR_STORAGE_TYPE_FILE;
-+ mirror->type = flags & VIR_DOMAIN_BLOCK_REBASE_COPY_DEV ?
-+ VIR_STORAGE_TYPE_BLOCK : VIR_STORAGE_TYPE_FILE;
-
- if (format) {
- if ((mirror->format = virStorageFileFormatTypeFromString(format)) <= 0) {
-@@ -15954,7 +15964,8 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
- VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
- VIR_DOMAIN_BLOCK_REBASE_COPY |
- VIR_DOMAIN_BLOCK_REBASE_COPY_RAW |
-- VIR_DOMAIN_BLOCK_REBASE_RELATIVE, -1);
-+ VIR_DOMAIN_BLOCK_REBASE_RELATIVE |
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_DEV, -1);
-
- if (!(vm = qemuDomObjFromDomain(dom)))
- return -1;
-@@ -15982,7 +15993,8 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
- }
-
- flags &= (VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
-- VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT);
-+ VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
-+ VIR_DOMAIN_BLOCK_REBASE_COPY_DEV);
- ret = qemuDomainBlockCopy(vm, dom->conn, path, base, format,
- bandwidth, flags);
- vm = NULL;
-diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml
-index 46f2a3e..7495a45 100644
---- a/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml
-+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml
-@@ -17,8 +17,8 @@
- <disk type='block' device='disk'>
- <source dev='/dev/HostVG/QEMUGuest1'/>
- <backingStore/>
-- <mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' job='copy' ready='yes'>
-- <source file='/dev/HostVG/QEMUGuest1Copy'/>
-+ <mirror type='block' job='copy' ready='yes'>
-+ <source dev='/dev/HostVG/QEMUGuest1Copy'/>
- </mirror>
- <target dev='hda' bus='ide'/>
- <address type='drive' controller='0' bus='0' target='0' unit='0'/>
-diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
-index 28f5319..8f79b55 100644
---- a/tools/virsh-domain.c
-+++ b/tools/virsh-domain.c
-@@ -1550,6 +1550,8 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
- flags |= VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT;
- if (vshCommandOptBool(cmd, "raw"))
- flags |= VIR_DOMAIN_BLOCK_REBASE_COPY_RAW;
-+ if (vshCommandOptBool(cmd, "blockdev"))
-+ flags |= VIR_DOMAIN_BLOCK_REBASE_COPY_DEV;
- if (vshCommandOptStringReq(ctl, cmd, "dest", &base) < 0)
- goto cleanup;
- ret = virDomainBlockRebase(dom, path, base, bandwidth, flags);
-@@ -1857,6 +1859,10 @@ static const vshCmdOptDef opts_block_copy[] = {
- .type = VSH_OT_BOOL,
- .help = N_("use raw destination file")
- },
-+ {.name = "blockdev",
-+ .type = VSH_OT_BOOL,
-+ .help = N_("copy destination is block device instead of regular file")
-+ },
- {.name = "wait",
- .type = VSH_OT_BOOL,
- .help = N_("wait for job to reach mirroring phase")
-diff --git a/tools/virsh.pod b/tools/virsh.pod
-index c5b176a..46ef01d 100644
---- a/tools/virsh.pod
-+++ b/tools/virsh.pod
-@@ -959,7 +959,8 @@ unlimited. The hypervisor can choose whether to reject the value or
- convert it to the maximum value allowed.
-
- =item B<blockcopy> I<domain> I<path> I<dest> [I<bandwidth>] [I<--shallow>]
--[I<--reuse-external>] [I<--raw>] [I<--wait> [I<--async>] [I<--verbose>]]
-+[I<--reuse-external>] [I<--raw>] [I<--blockdev>]
-+[I<--wait> [I<--async>] [I<--verbose>]]
- [{I<--pivot> | I<--finish>}] [I<--timeout> B<seconds>]
-
- Copy a disk backing image chain to I<dest>. By default, this command
-@@ -977,7 +978,9 @@ The format of the destination is determined by the first match in the
- following list: if I<--raw> is specified, it will be raw; if
- I<--reuse-external> is specified, the existing destination is probed
- for a format; and in all other cases, the destination format will
--match the source format.
-+match the source format. The destination is treated as a regular
-+file unless I<--blockdev> is used to signal that it is a block
-+device.
-
- By default, the copy job runs in the background, and consists of two
- phases. Initially, the job must copy all data from the source, and
---
-2.3.0
-
+++ /dev/null
-From 61fbb57d74cc44594b5bcb184c350ab18b963291 Mon Sep 17 00:00:00 2001
-Message-Id: <61fbb57d74cc44594b5bcb184c350ab18b963291@dist-git>
-From: Eric Blake <eblake@redhat.com>
-Date: Tue, 24 Feb 2015 11:59:51 +0100
-Subject: [PATCH] blockjob: shuffle block rebase code
-
-https://bugzilla.redhat.com/show_bug.cgi?id=1196066
-
-The existing virDomainBlockRebase code rejected the combination of
-_RELATIVE and _COPY flags, but only by accident. It makes sense
-to add support for the combination someday, at least for the case
-of _SHALLOW and not _REUSE_EXT; but to implement it, libvirt would
-have to pre-create the file with a relative backing name, and I'm
-not ready to code that in yet.
-
-Meanwhile, the code to forward on to the block copy code is getting
-longer, and reorganizing the function to have the block pull done
-early makes it easier to add even more block copy prep code.
-
-This patch should have no semantic difference other than the quality
-of the error message on the unsupported flag combination. Pre-patch:
-
-error: unsupported flags (0x10) in function qemuDomainBlockCopy
-
-Post-patch:
-
-error: argument unsupported: Relative backing during copy not supported yet
-
-* src/qemu/qemu_driver.c (qemuDomainBlockRebase): Reorder code,
-and improve error message of relative copy.
-
-Signed-off-by: Eric Blake <eblake@redhat.com>
-(cherry picked from commit 02d2bd7d91c200d1ea1a5b3f78c8b41720cea832)
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- src/qemu/qemu_driver.c | 47 ++++++++++++++++++++++++++++++++---------------
- 1 file changed, 32 insertions(+), 15 deletions(-)
-
-diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
-index f3b909f..162e039 100644
---- a/src/qemu/qemu_driver.c
-+++ b/src/qemu/qemu_driver.c
-@@ -15947,6 +15947,8 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
- unsigned long bandwidth, unsigned int flags)
- {
- virDomainObjPtr vm;
-+ const char *format = NULL;
-+ int ret = -1;
-
- virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
- VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
-@@ -15957,22 +15959,37 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
- if (!(vm = qemuDomObjFromDomain(dom)))
- return -1;
-
-- if (virDomainBlockRebaseEnsureACL(dom->conn, vm->def) < 0) {
-+ if (virDomainBlockRebaseEnsureACL(dom->conn, vm->def) < 0)
-+ goto cleanup;
-+
-+ /* For normal rebase (enhanced blockpull), the common code handles
-+ * everything, including vm cleanup. */
-+ if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY))
-+ return qemuDomainBlockJobImpl(vm, dom->conn, path, base, bandwidth,
-+ NULL, BLOCK_JOB_PULL, flags);
-+
-+ /* If we got here, we are doing a block copy rebase. */
-+ if (flags & VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
-+ format = "raw";
-+
-+ /* XXX: If we are doing a shallow copy but not reusing an external
-+ * file, we should attempt to pre-create the destination with a
-+ * relative backing chain instead of qemu's default of absolute */
-+ if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE) {
-+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
-+ _("Relative backing during copy not supported yet"));
-+ goto cleanup;
-+ }
-+
-+ flags &= (VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
-+ VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT);
-+ ret = qemuDomainBlockCopy(vm, dom->conn, path, base, format,
-+ bandwidth, flags);
-+ vm = NULL;
-+ cleanup:
-+ if (vm)
- virObjectUnlock(vm);
-- return -1;
-- }
--
-- if (flags & VIR_DOMAIN_BLOCK_REBASE_COPY) {
-- const char *format = NULL;
-- if (flags & VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
-- format = "raw";
-- flags &= ~(VIR_DOMAIN_BLOCK_REBASE_COPY |
-- VIR_DOMAIN_BLOCK_REBASE_COPY_RAW);
-- return qemuDomainBlockCopy(vm, dom->conn, path, base, format, bandwidth, flags);
-- }
--
-- return qemuDomainBlockJobImpl(vm, dom->conn, path, base, bandwidth, NULL,
-- BLOCK_JOB_PULL, flags);
-+ return ret;
- }
-
- static int
---
-2.3.0
-
+++ /dev/null
-From 7854f0d28b2bd526ae27777aa6c97f0ab3443523 Mon Sep 17 00:00:00 2001
-Message-Id: <7854f0d28b2bd526ae27777aa6c97f0ab3443523@dist-git>
-From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
-Date: Wed, 28 Jan 2015 12:25:12 +0100
-Subject: [PATCH] hotplug: only add a chardev to vmdef after monitor call
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-https://bugzilla.redhat.com/show_bug.cgi?id=1195155
-
-This way the device is in vmdef only if ret = 0 and the caller
-(qemuDomainAttachDeviceFlags) does not free it.
-
-Otherwise it might get double freed by qemuProcessStop
-and qemuDomainAttachDeviceFlags if the domain crashed
-in monitor after we've added it to vm->def.
-
-(cherry picked from commit 21e0e8866e341da74e296ca3cf2d97812e847a66)
-Signed-off-by: Ján Tomko <jtomko@redhat.com>
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- src/qemu/qemu_hotplug.c | 34 +++++++++++-----------------------
- 1 file changed, 11 insertions(+), 23 deletions(-)
-
-diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
-index 00ce77f..89757bc 100644
---- a/src/qemu/qemu_hotplug.c
-+++ b/src/qemu/qemu_hotplug.c
-@@ -1510,59 +1510,47 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
- virDomainDefPtr vmdef = vm->def;
- char *devstr = NULL;
- char *charAlias = NULL;
-- bool need_remove = false;
-
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("qemu does not support -device"));
-- return ret;
-+ goto cleanup;
- }
-
- if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0)
-- return ret;
-+ goto cleanup;
-
- if (qemuBuildChrDeviceStr(&devstr, vm->def, chr, priv->qemuCaps) < 0)
-- return ret;
-+ goto cleanup;
-
- if (virAsprintf(&charAlias, "char%s", chr->info.alias) < 0)
- goto cleanup;
-
-- if (qemuDomainChrInsert(vmdef, chr) < 0)
-+ if (qemuDomainChrPreInsert(vmdef, chr) < 0)
- goto cleanup;
-- need_remove = true;
-
- qemuDomainObjEnterMonitor(driver, vm);
- if (qemuMonitorAttachCharDev(priv->mon, charAlias, &chr->source) < 0) {
-- if (qemuDomainObjExitMonitor(driver, vm) < 0) {
-- need_remove = false;
-- ret = -1;
-- goto cleanup;
-- }
-+ ignore_value(qemuDomainObjExitMonitor(driver, vm));
- goto audit;
- }
-
- if (devstr && qemuMonitorAddDevice(priv->mon, devstr) < 0) {
- /* detach associated chardev on error */
- qemuMonitorDetachCharDev(priv->mon, charAlias);
-- if (qemuDomainObjExitMonitor(driver, vm) < 0) {
-- need_remove = false;
-- ret = -1;
-- goto cleanup;
-- }
-+ ignore_value(qemuDomainObjExitMonitor(driver, vm));
- goto audit;
- }
-- if (qemuDomainObjExitMonitor(driver, vm) < 0) {
-- need_remove = false;
-- ret = -1;
-- goto cleanup;
-- }
-+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
-+ goto audit;
-
-+ qemuDomainChrInsertPreAlloced(vm->def, chr);
- ret = 0;
- audit:
- virDomainAuditChardev(vm, NULL, chr, "attach", ret == 0);
- cleanup:
-- if (ret < 0 && need_remove)
-- qemuDomainChrRemove(vmdef, chr);
-+ if (ret < 0 && virDomainObjIsActive(vm))
-+ qemuDomainChrInsertPreAllocCleanup(vm->def, chr);
- VIR_FREE(charAlias);
- VIR_FREE(devstr);
- return ret;
---
-2.3.0
-
+++ /dev/null
-From c0af84c532e72d42a66059998ef7f03dcb0d6bd1 Mon Sep 17 00:00:00 2001
-Message-Id: <c0af84c532e72d42a66059998ef7f03dcb0d6bd1@dist-git>
-From: Michal Privoznik <mprivozn@redhat.com>
-Date: Mon, 23 Feb 2015 08:20:03 +0100
-Subject: [PATCH] qemuBuildNumaArgStr: Use memory-backend-ram more wisely
-
-RHEL-7.2: https://bugzilla.redhat.com/show_bug.cgi?id=1191567
-RHEL-7.1.z: https://bugzilla.redhat.com/show_bug.cgi?id=1194982
-
-So, when building the '-numa' command line, the qemuBuildNumaArgStr()
-function does quite a lot of checks to chose the best backend, or to
-check if one is in fact needed. However, it returned that backend is
-needed even for this little fella:
-
- <numatune>
- <memory mode="strict" nodeset="0,2"/>
- </numatune>
-
-This can be guaranteed via CGroups entirely, there's no need to use
-memory-backend-ram to let qemu know where to get memory from. Well, as
-long as there's no <memnode/> element, which explicitly requires the
-backend. Long story short, we wouldn't have to care, as qemu works
-either way. However, the problem is migration (as always). Previously,
-libvirt would have started qemu with:
-
- -numa node,memory=X
-
-in this case and restricted memory placement in CGroups. Today, libvirt
-creates more complicated command line:
-
- -object memory-backend-ram,id=ram-node0,size=X
- -numa node,memdev=ram-node0
-
-Again, one wouldn't find anything wrong with these two approaches.
-Both work just fine. Unless you try to migrated from the older libvirt
-into the newer one. These two approaches are, unfortunately, not
-compatible. My suggestion is, in order to allow users to migrate, lets
-use the older approach for as long as the newer one is not needed.
-
-Moreover, this partly cherry-picks
-b92a0037103efc15639dee9562866dbaffe302fb too. Especially the tests,
-which need to be fixed too. We can't mix the bare -numa and
-memory-backend-ram on the command line.
-
-Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
-(cherry picked from commit 7832fac84741d65e851dbdbfaf474785cbfdcf3c)
-Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
-
-Conflicts:
- src/qemu/qemu_command.c: The code is totally rewritten
- upstream (esp. after memory hotplug).
- tests/qemuxml2argvtest.c: Context, some tests were not
- introduced yet.
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- src/qemu/qemu_command.c | 35 +++++++++++---------
- .../qemuxml2argv-cputune-numatune.args | 5 +++
- .../qemuxml2argv-cputune-numatune.xml | 37 ++++++++++++++++++++++
- .../qemuxml2argv-hugepages-pages3.args | 3 +-
- .../qemuxml2argv-numatune-auto-prefer.args | 5 +++
- .../qemuxml2argv-numatune-memnode-no-memory.args | 3 +-
- tests/qemuxml2argvtest.c | 6 ++++
- 7 files changed, 77 insertions(+), 17 deletions(-)
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.args
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.xml
- create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
-
-diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
-index db0c324..a9cb7a3 100644
---- a/src/qemu/qemu_command.c
-+++ b/src/qemu/qemu_command.c
-@@ -6540,22 +6540,27 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
- char *nodemask = NULL;
- char *mem_path = NULL;
- int ret = -1;
-+ bool useNodemask = false;
-
-- if (virDomainNumatuneHasPerNodeBinding(def->numatune) &&
-- !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
-- virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE))) {
-- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-- _("Per-node memory binding is not supported "
-- "with this QEMU"));
-- goto cleanup;
-+ if (virDomainNumatuneHasPerNodeBinding(def->numatune)) {
-+ if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
-+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE))) {
-+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-+ _("Per-node memory binding is not supported "
-+ "with this QEMU"));
-+ goto cleanup;
-+ }
-+ useNodemask = true;
- }
-
-- if (def->mem.nhugepages && def->mem.hugepages[0].size &&
-- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
-- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-- _("huge pages per NUMA node are not "
-- "supported with this QEMU"));
-- goto cleanup;
-+ if (def->mem.nhugepages && def->mem.hugepages[0].size) {
-+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
-+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-+ _("huge pages per NUMA node are not "
-+ "supported with this QEMU"));
-+ goto cleanup;
-+ }
-+ useNodemask = true;
- }
-
- for (i = 0; i < def->mem.nhugepages; i++) {
-@@ -6714,7 +6719,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
- virBufferAsprintf(&buf, ",policy=%s", policy);
- }
-
-- if (hugepage || nodemask) {
-+ if (useNodemask) {
- virCommandAddArg(cmd, "-object");
- virCommandAddArgBuffer(cmd, &buf);
- } else {
-@@ -6739,7 +6744,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
- virBufferAdd(&buf, tmpmask, -1);
- }
-
-- if (hugepage || nodemask)
-+ if (useNodemask)
- virBufferAsprintf(&buf, ",memdev=ram-node%zu", i);
- else
- virBufferAsprintf(&buf, ",mem=%d", cellmem);
-diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.args b/tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.args
-new file mode 100644
-index 0000000..481f72f
---- /dev/null
-+++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.args
-@@ -0,0 +1,5 @@
-+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-+/usr/bin/qemu-system-x86_64 -S -M pc-q35-2.3 -m 128 \
-+-smp 2,maxcpus=6,sockets=6,cores=1,threads=1 \
-+-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
-+-boot c -net none -serial none -parallel none
-diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.xml b/tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.xml
-new file mode 100644
-index 0000000..01bbb3d
---- /dev/null
-+++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune-numatune.xml
-@@ -0,0 +1,37 @@
-+<domain type='kvm'>
-+ <name>dummy2</name>
-+ <uuid>4d92ec27-9ebf-400b-ae91-20c71c647c19</uuid>
-+ <memory unit='KiB'>131072</memory>
-+ <currentMemory unit='KiB'>65536</currentMemory>
-+ <vcpu placement='auto' current='2'>6</vcpu>
-+ <iothreads>2</iothreads>
-+ <cputune>
-+ <emulatorpin cpuset='1-3'/>
-+ <iothreadpin iothread='1' cpuset='2'/>
-+ </cputune>
-+ <numatune>
-+ <memory mode='strict' placement='auto'/>
-+ </numatune>
-+ <os>
-+ <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
-+ <boot dev='hd'/>
-+ </os>
-+ <clock offset='utc'/>
-+ <on_poweroff>destroy</on_poweroff>
-+ <on_reboot>restart</on_reboot>
-+ <on_crash>destroy</on_crash>
-+ <devices>
-+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
-+ <controller type='sata' index='0'>
-+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
-+ </controller>
-+ <controller type='pci' index='0' model='pcie-root'/>
-+ <controller type='pci' index='1' model='dmi-to-pci-bridge'>
-+ <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
-+ </controller>
-+ <controller type='pci' index='2' model='pci-bridge'>
-+ <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
-+ </controller>
-+ <memballoon model='none'/>
-+ </devices>
-+</domain>
-diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args
-index f81947e..27b3f8e 100644
---- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args
-+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args
-@@ -1,6 +1,7 @@
- LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
- /usr/bin/qemu -S -M pc -m 1024 -smp 2 \
---numa node,nodeid=0,cpus=0,mem=256 \
-+-object memory-backend-ram,size=256M,id=ram-node0 \
-+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
- -object memory-backend-file,prealloc=yes,\
- mem-path=/dev/hugepages1G/libvirt/qemu,size=768M,id=ram-node1 \
- -numa node,nodeid=1,cpus=1,memdev=ram-node1 \
-diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
-new file mode 100644
-index 0000000..0b1b0f5
---- /dev/null
-+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-auto-prefer.args
-@@ -0,0 +1,5 @@
-+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-+/usr/bin/kvm -S -M pc -m 64 -smp 1 \
-+-numa node,nodeid=0,cpus=0,mem=64 \
-+-nographic -monitor unix:/tmp/test-monitor,server,nowait \
-+-no-acpi -boot c -usb -net none -serial none -parallel none
-diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args
-index 2addf97..b0e274c 100644
---- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args
-+++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode-no-memory.args
-@@ -2,6 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
- /usr/bin/kvm -S -M pc -m 64 -smp 2 \
- -object memory-backend-ram,size=32M,id=ram-node0,host-nodes=3,policy=preferred \
- -numa node,nodeid=0,cpus=0,memdev=ram-node0 \
---numa node,nodeid=1,cpus=1,mem=32 \
-+-object memory-backend-ram,size=32M,id=ram-node1 \
-+-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
- -nographic -monitor unix:/tmp/test-monitor,server,nowait \
- -no-acpi -boot c -usb -net none -serial none -parallel none
-diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
-index 98bb9ad..ee7397a 100644
---- a/tests/qemuxml2argvtest.c
-+++ b/tests/qemuxml2argvtest.c
-@@ -1246,6 +1246,10 @@ mymain(void)
- DO_TEST("blkiotune-device", QEMU_CAPS_NAME);
- DO_TEST("cputune", QEMU_CAPS_NAME);
- DO_TEST("cputune-zero-shares", QEMU_CAPS_NAME);
-+ DO_TEST("cputune-numatune", QEMU_CAPS_SMP_TOPOLOGY,
-+ QEMU_CAPS_KVM,
-+ QEMU_CAPS_OBJECT_MEMORY_RAM,
-+ QEMU_CAPS_OBJECT_MEMORY_FILE);
-
- DO_TEST("numatune-memory", NONE);
- DO_TEST_PARSE_ERROR("numatune-memory-invalid-nodeset", NONE);
-@@ -1256,6 +1260,8 @@ mymain(void)
- DO_TEST_FAILURE("numatune-memnode-no-memory", NONE);
-
- DO_TEST("numatune-auto-nodeset-invalid", NONE);
-+ DO_TEST("numatune-auto-prefer", QEMU_CAPS_OBJECT_MEMORY_RAM,
-+ QEMU_CAPS_OBJECT_MEMORY_FILE);
- DO_TEST_PARSE_ERROR("numatune-memnode-nocpu", NONE);
- DO_TEST_PARSE_ERROR("numatune-memnodes-problematic", NONE);
- DO_TEST("numad", NONE);
---
-2.3.0
-
+++ /dev/null
-From 4841f815fcefb0a2e8715808bb4038c89e3b3889 Mon Sep 17 00:00:00 2001
-Message-Id: <4841f815fcefb0a2e8715808bb4038c89e3b3889@dist-git>
-From: Michal Privoznik <mprivozn@redhat.com>
-Date: Mon, 23 Feb 2015 08:20:02 +0100
-Subject: [PATCH] qemuxml2argvtest: Fake response from numad
-
-RHEL-7.2: https://bugzilla.redhat.com/show_bug.cgi?id=1191567
-RHEL-7.1.z: https://bugzilla.redhat.com/show_bug.cgi?id=1194982
-
-Well, we can pretend that we've asked numad for its suggestion and let
-qemu command line be built with that respect. Again, this alone has no
-big value, but see later commits which build on the top of this.
-
-Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
-(cherry picked from commit 38064806966c04d7cf7525cd78aa6f82bd09e6d0)
-Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
-
-Conflicts:
- tests/qemuxml2argvtest.c: Context, as f7afeddc is not
- backported yet.
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- tests/qemuxml2argvtest.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
-index 595b658..98bb9ad 100644
---- a/tests/qemuxml2argvtest.c
-+++ b/tests/qemuxml2argvtest.c
-@@ -279,12 +279,16 @@ static int testCompareXMLToArgvFiles(const char *xml,
- char *log = NULL;
- virCommandPtr cmd = NULL;
- size_t i;
-+ virBitmapPtr nodeset = NULL;
-
- if (!(conn = virGetConnect()))
- goto out;
- conn->secretDriver = &fakeSecretDriver;
- conn->storageDriver = &fakeStorageDriver;
-
-+ if (virBitmapParse("0-3", '\0', &nodeset, 4) < 0)
-+ goto out;
-+
- if (!(vmdef = virDomainDefParseFile(xml, driver.caps, driver.xmlopt,
- QEMU_EXPECTED_VIRT_TYPES,
- VIR_DOMAIN_XML_INACTIVE))) {
-@@ -363,7 +367,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
- VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
- &testCallbacks, false,
- (flags & FLAG_FIPS),
-- NULL))) {
-+ nodeset))) {
- if (!virtTestOOMActive() &&
- (flags & FLAG_EXPECT_FAILURE)) {
- ret = 0;
-@@ -416,6 +420,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
- virCommandFree(cmd);
- virDomainDefFree(vmdef);
- virObjectUnref(conn);
-+ virBitmapFree(nodeset);
- return ret;
- }
-
---
-2.3.0
-
+++ /dev/null
-From c0e6c7fa7cd8fb4bb4ee26552c7ab35352c47ed0 Mon Sep 17 00:00:00 2001
-Message-Id: <c0e6c7fa7cd8fb4bb4ee26552c7ab35352c47ed0@dist-git>
-From: Peter Krempa <pkrempa@redhat.com>
-Date: Tue, 24 Feb 2015 10:32:21 +0100
-Subject: [PATCH] util: storage: Fix parsing of nbd:// URI without path
-
-https://bugzilla.redhat.com/show_bug.cgi?id=1195156
-
-If a storage file would be backed with a NBD device without path
-(nbd://localhost) libvirt would crash when parsing the backing path for
-the disk as the URI structure's path element is NULL in such case but
-the NBD parser would access it shamelessly.
-
-(cherry picked from commit fdb80ed4f6563928b9942a0d1450e0c725aa6c06)
-
- Conflicts: tests/virstoragetest.c - test case numbering refactor was
- not backported and thus I
- manually numbered this test as
- 12.5
-
-Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
----
- src/util/virstoragefile.c | 3 ++-
- tests/virstoragetest.c | 14 ++++++++++++++
- 2 files changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
-index 580ad20..3ab20a4 100644
---- a/src/util/virstoragefile.c
-+++ b/src/util/virstoragefile.c
-@@ -2150,7 +2150,8 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src,
- /* XXX We currently don't support auth, so don't bother parsing it */
-
- /* possibly skip the leading slash */
-- if (VIR_STRDUP(src->path,
-+ if (uri->path &&
-+ VIR_STRDUP(src->path,
- *uri->path == '/' ? uri->path + 1 : uri->path) < 0)
- goto cleanup;
-
-diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
-index 2601edc..fc37489 100644
---- a/tests/virstoragetest.c
-+++ b/tests/virstoragetest.c
-@@ -870,6 +870,20 @@ mymain(void)
- (&qcow2, &nbd2), EXP_PASS,
- (&qcow2, &nbd2), ALLOW_PROBE | EXP_PASS);
-
-+ /* Rewrite qcow2 to use an nbd: protocol without path as backend */
-+ virCommandFree(cmd);
-+ cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2",
-+ "-F", "raw", "-b", "nbd://example.org",
-+ "qcow2", NULL);
-+ if (virCommandRun(cmd, NULL) < 0)
-+ ret = -1;
-+ qcow2.expBackingStoreRaw = "nbd://example.org";
-+
-+ nbd2.path = NULL;
-+ TEST_CHAIN(12.5, absqcow2, VIR_STORAGE_FILE_QCOW2,
-+ (&qcow2, &nbd2), EXP_PASS,
-+ (&qcow2, &nbd2), ALLOW_PROBE | EXP_PASS);
-+
- /* qed file */
- testFileData qed = {
- .expBackingStoreRaw = absraw,
---
-2.3.0
-
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 1.2.8
-Release: 16%{?dist}.1%{?extra_release}
+Release: 16%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Patch331: libvirt-qemu-Add-missing-goto-error-in-qemuRestoreCgroupState.patch
Patch332: libvirt-qemu-don-t-setup-cpuset.mems-if-memory-mode-in-numatune-is-not-strict.patch
Patch333: libvirt-lxc-don-t-setup-cpuset.mems-if-memory-mode-in-numatune-is-not-strict.patch
-Patch334: libvirt-qemuxml2argvtest-Fake-response-from-numad.patch
-Patch335: libvirt-qemuBuildNumaArgStr-Use-memory-backend-ram-more-wisely.patch
-Patch336: libvirt-util-storage-Fix-parsing-of-nbd-URI-without-path.patch
-Patch337: libvirt-Split-qemuDomainChrInsert-into-two-parts.patch
-Patch338: libvirt-hotplug-only-add-a-chardev-to-vmdef-after-monitor-call.patch
-Patch339: libvirt-blockjob-shuffle-block-rebase-code.patch
-Patch340: libvirt-blockcopy-allow-block-device-destination.patch
%if %{with_libvirtd}
%doc examples/systemtap
%changelog
-* Wed Feb 25 2015 Jiri Denemark <jdenemar@redhat.com> - 1.2.8-16.el7_1.1
-- qemuxml2argvtest: Fake response from numad (rhbz#1194982)
-- qemuBuildNumaArgStr: Use memory-backend-ram more wisely (rhbz#1194982)
-- util: storage: Fix parsing of nbd:// URI without path (rhbz#1195156)
-- Split qemuDomainChrInsert into two parts (rhbz#1195155)
-- hotplug: only add a chardev to vmdef after monitor call (rhbz#1195155)
-- blockjob: shuffle block rebase code (rhbz#1196066)
-- blockcopy: allow block device destination (rhbz#1196066)
-
* Wed Jan 28 2015 Jiri Denemark <jdenemar@redhat.com> - 1.2.8-16
- qemu: don't setup cpuset.mems if memory mode in numatune is not 'strict' (rhbz#1186094)
- lxc: don't setup cpuset.mems if memory mode in numatune is not 'strict' (rhbz#1186094)