[libvirt] [PATCH v2 0/3] libvirtd: fix crashes on termination
by Nikolay Shirokovskiy
diff from v1
============
1. drop patches 1-2 of v1.
As to "event loop" patch seems nobody has "production" problems due to leaks on
termination. Turning freeing callback objects registered in event loop on after
it is finished has an impact that is hard to predict. Different parts of
libvirt use event loop and the patch can trigger paths that were not passed
before. Let's wait for real issue)
"Breaking cyclic dependency" patch will not reach its target without "event
loop patch" anyway - daemon object will still leak in certain situation so
let's drop it too.
2. add code commenting patch
It documents another reason why we should not free callback object
synchronously in remove handle/timeout function besides Dan's objection:
https://www.redhat.com/archives/libvir-list/2016-September/msg01005.html
Reproducing:
============
Crash situation of patches 1-2 can easily be simulated, just
patch libvirt:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 30a2830..f6b71d6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4515,6 +4515,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver,
unsigned int stopFlags = 0;
virObjectEventPtr event = NULL;
+ sleep(3);
+
if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, true) < 0)
return;
then when it is up and running and there is also a qemu domain running:
kill -9 $QEMU_DOMAIN && pkill libvirtd
By the way there should be no admin connection at the moment or crash
will not happen due to leaks.
Nikolay Shirokovskiy (3):
daemon: keep daemon until all hypervisors drivers are cleaned up
qemu: first wait all workers finish on state cleanup
util: event loop: document another reason to defer deletion
daemon/libvirtd.c | 4 +++-
src/qemu/qemu_driver.c | 2 +-
src/util/vireventpoll.c | 7 +++++++
3 files changed, 11 insertions(+), 2 deletions(-)
--
1.8.3.1
8 years, 1 month
[libvirt] [PATCH] build: update to latest gnulib
by Eric Blake
In particular, pull in gnulib's fix for the broken SIZE_MAX on s390.
* .gnulib: Update to latest.
* bootstrap: Resync to upstream.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
A buildbot on an s390 platform was complaining:
CC util/libvirt_setuid_rpc_client_la-virconf.lo
util/virconf.c: In function 'virConfGetValueSizeT':
util/virconf.c:1220:9: error: format '%zu' expects argument of type 'size_t', but argument 9 has type 'unsigned int' [-Werror=format=]
virReportError(VIR_ERR_INTERNAL_ERROR,
^
This gnulib update should fix it; since we're between releases,
I'm pushing this under the gnulib maintenance rule.
* .gnulib e89b4a7...5ddd9d7 (73):
> strerror_r-posix: Fix override of AC_FUNC_STRERROR_R
> Fix gnulib C++ namespace support and std::frexp
> GNULIB_NAMESPACE::func need not pull in rpl_func
> manywarnings: fix -Wno-missing-field-initializers detection
> non-recursive-gnulib-prefix-hack: revert use of parameterized 'lib' dir
> strftime,strptime: support %q to represent the quarter
> autoupdate
> bootstrap: Fix get_version() for AIX 5.3
> intprops: port to older XL C
> autoupdate
> backupfile: initialize default suffix within the implementation
> futimens: remove FIXME for old Linux kernels
> utimensat: remove FIXME for old Linux kernels
> maint: update how to make web pages
> qsort_r: Fix macrology for platforms that lack the function.
> sys_types: fix Texinfo typos
> getprogname: port to HP-UX
> Update doc about target platforms.
> opendir, readdir, closedir: Relicense under LGPLv2+.
> Fix conflict between strerror_r-posix module and AC_FUNC_STRERROR_R.
> Make the 'argp' module work without the 'error' module.
> diffseq: restore TOO_EXPENSIVE heuristic
> non-recursive-gnulib-prefix-hack: Don't make assumptions about gnulib-tool's --source-base option value.
> iconv: Avoid compilation error when bootstrapping GNU libiconv.
> Avoid gnulib-tool warnings about the dependencies of 'parse-datetime'.
> system-quote tests: Avoid compiler warning on AIX.
> Fix some "gcc -Wall" warnings.
> gnulib-tool: Make --create-testdir on all modules work again.
> libunistring: change the maintainer to 'all'
> Simplify "configure: checking ..." messages.
> Simplify "configure: checking ..." messages.
> quotearg-tests: pacify gcc -Wall
> canonicalize-lgpl: fix for missing SIZE_MAX on older systems
> printf.m4: fix a bug in detecting printf %j support
> sched: substitute HAVE_SYS_CDEFS_H too
> quotearg: never write beyond the returned length
> getprogname tests: Avoid failure in packages that use libtool.
> getprogname: Fix test failure on Cygwin. Comments.
> Make sure the libunistring detection rejects older versions with a known bug.
> sh-quote, system-quote: revert regression of unit test.
> quotearg: fix stale tests
> non-recursive-gnulib-prefix-hack: fix inconsequential typo
> Fix a test crash.
> test-limits-h: suppress -Woverlength-strings
> gettime, timespec, utimens: Relicense under LGPL.
> canonicalize-lgpl: Support the case path_max > INT_MAX.
> getprogname: IBM z/OS: avoid NULL-dereference
> test-stdint: use _GL_VERIFY rather than "verify" for some tests
> Add missing ChangeLog entry
> stdint: port SIZE_MAX to glibc s390
> getprogname: port to IBM z/OS
> maint: remove stray space after "." in AC_DEFINE comment.
> long-options: avoid new GCC 7 warning from -Wimplicit-fallthrough
> utimecmp: avoid new GCC 7 warning from -Wbool-operation
> dfa: save memory for states
> wchar, wctype-h: fix for MinGW 3.22.2
> long-options: avoid new GCC 7 warning from -Wimplicit-fallthrough
> utimecmp: avoid new GCC 7 warning from -Wbool-operation
> autoupdate
> quotearg: minimize shell quoting using double quotes
> vasnprintf.c: avoid spurious warning from GCC 7
> getprogname: correct the test for a __progname variable
> u8-uctomb-aux.c: build: placate GCC 7's new -Wimplicit-fallthrough
> dfa: build: avoid warning from GCC 7's new -Wimplicit-fallthrough
> getprogname: avoid __progname vs program_invocation_short_name pitfall
> getprogname: port to OpenBSD 5.1
> sched: port to GCC 6.2.1 on macOS Sierra
> tests/init.sh: port Alpine fix to AIX 7.1
> nl_langinfo: pacify GCC
> stdint: also set GL_GENERATE_LIMITS_H
> limits-h, stdint: Don't assume extensions, fix typo
> getprogname: port to AIX
> update from texinfo
.gnulib | 2 +-
bootstrap | 38 ++++++++++++++++++++------------------
2 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/.gnulib b/.gnulib
index e89b4a7..5ddd9d7 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit e89b4a7aefce9cb02963920712ba7cdd13641644
+Subproject commit 5ddd9d713d58d6c6d10494a28ceee6988d20ff98
diff --git a/bootstrap b/bootstrap
index f060bab..5d3c289 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2016-01-24.06; # UTC
+scriptversion=2016-11-03.18; # UTC
# Bootstrap this package from checked-out sources.
@@ -418,28 +418,30 @@ sort_ver() { # sort -V is not generally available
done
}
+get_version_sed='
+# Move version to start of line.
+s/.*[v ]\([0-9]\)/\1/
+
+# Skip lines that do not start with version.
+/^[0-9]/!d
+
+# Remove characters after the version.
+s/[^.a-z0-9-].*//
+
+# The first component must be digits only.
+s/^\([0-9]*\)[a-z-].*/\1/
+
+#the following essentially does s/5.005/5.5/
+s/\.0*\([1-9]\)/.\1/g
+p
+q'
+
get_version() {
app=$1
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
- $app --version 2>&1 |
- sed -n '# Move version to start of line.
- s/.*[v ]\([0-9]\)/\1/
-
- # Skip lines that do not start with version.
- /^[0-9]/!d
-
- # Remove characters after the version.
- s/[^.a-z0-9-].*//
-
- # The first component must be digits only.
- s/^\([0-9]*\)[a-z-].*/\1/
-
- #the following essentially does s/5.005/5.5/
- s/\.0*\([1-9]\)/.\1/g
- p
- q'
+ $app --version 2>&1 | sed -n "$get_version_sed"
}
check_versions() {
--
2.7.4
8 years, 1 month
[libvirt] [PATCH v6 00/17] Use more PCIe less legacy PCI
by Laine Stump
This is a rebase of v5 (, with the addition of patches 16 & 17, which
detect the type of VFIO assigned devices and assign them to either an
Express or a legacy PCI slot as appropriate,
Laine Stump (17):
qemu: new functions qemuDomainMachineHasPCI[e]Root()
qemu: new functions to calculate/set device pciConnectFlags
qemu: set/use info->pciConnectFlags when validating/assigning PCI
addresses
qemu: set/use proper pciConnectFlags during hotplug
qemu: set pciConnectFlags to 0 instead of PCI|HOTPLUGGABLE if device
isn't PCI
qemu: assign virtio devices to PCIe slot when appropriate
qemu: assign e1000e network devices to PCIe slots when appropriate
qemu: assign nec-xhci (USB3) controller to a PCIe address when
appropriate
qemu: only force an available legacy-PCI slot on domains with pci-root
qemu: auto-add pcie-root-port/dmi-to-pci-bridge controllers as needed
[RFC] qemu: if pci-bridge is in PCIe config w/o dmi-to-pci-bridge, add
it
qemu: don't force-add a dmi-to-pci-bridge just on principle
qemu: add a USB3 controller to Q35 domains by default
qemu: try to put ich9 sound device at 00:1B.0
qemu: initially reserve one open pcie-root-port for hotplug
qemu: propagate virQEMUDriver object to
qemuDomainDeviceCalculatePCIConnectFlags
qemu: assign vfio devices to PCIe addresses when appropriate
src/conf/device_conf.h | 5 +
src/conf/domain_addr.c | 112 ++-
src/conf/domain_addr.h | 3 +-
src/qemu/qemu_domain.c | 54 +-
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_domain_address.c | 880 +++++++++++++++++----
src/qemu/qemu_domain_address.h | 9 +-
src/qemu/qemu_hotplug.c | 28 +-
src/qemu/qemu_process.c | 13 +-
tests/qemuhotplugtest.c | 4 +-
tests/qemuxml2argvdata/qemuxml2argv-autoindex.args | 10 +-
.../qemuxml2argv-bios-nvram-secure.args | 1 +
.../qemuxml2argv-machine-smm-opt.args | 1 +
tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args | 3 +-
.../qemuxml2argv-q35-default-devices-only.args | 23 +
.../qemuxml2argv-q35-default-devices-only.xml | 18 +
.../qemuxml2argv-q35-pcie-autoadd.args | 57 ++
.../qemuxml2argv-q35-pcie-autoadd.xml | 51 ++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args | 58 ++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml | 67 ++
.../qemuxml2argv-q35-pm-disable-fallback.args | 1 +
.../qemuxml2argv-q35-pm-disable.args | 1 +
.../qemuxml2argv-q35-virt-manager-basic.args | 56 ++
.../qemuxml2argv-q35-virt-manager-basic.xml | 76 ++
.../qemuxml2argv-q35-virtio-pci.args | 58 ++
.../qemuxml2argv-q35-virtio-pci.xml | 1 +
tests/qemuxml2argvtest.c | 164 +++-
.../qemuxml2xmlout-autoindex.xml | 10 +-
.../qemuxml2xmlout-pcie-root.xml | 4 -
.../qemuxml2xmlout-q35-default-devices-only.xml | 45 ++
.../qemuxml2xmlout-q35-pcie-autoadd.xml | 148 ++++
.../qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml | 152 ++++
.../qemuxml2xmlout-q35-virt-manager-basic.xml | 121 +++
.../qemuxml2xmlout-q35-virtio-pci.xml | 152 ++++
tests/qemuxml2xmltest.c | 136 +++-
35 files changed, 2285 insertions(+), 239 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-default-devices-only.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-default-devices-only.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie-autoadd.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie-autoadd.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virt-manager-basic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virt-manager-basic.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-default-devices-only.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie-autoadd.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virtio-pci.xml
--
2.7.4
8 years, 1 month
[libvirt] [PATCH] conf: Use UNIT_MAX for checking max value of unsigned int
by Nitesh Konkar
In the current scenario the controller parsing fails
when no index is specified .As the docs point out
that specifying index is optional, libvirt is expected
to fill the index without erroring out.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
Before the Patch:
cat controller.xml
<controller model="virtio-scsi" type="scsi" />
virsh attach-device vm1 controller.xml --persistent
error: Failed to attach device from controller.xml
error: internal error: Cannot parse controller index -1
After the patch:
virsh attach-device vm1 controller.xml --persistent
Device attached successfully
---
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6e008e2..c52e67f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8374,7 +8374,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
if (idx) {
unsigned int idxVal;
if (virStrToLong_ui(idx, NULL, 10, &idxVal) < 0 ||
- idxVal > INT_MAX) {
+ idxVal > UINT_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot parse controller index %s"), idx);
goto error;
--
2.1.0
8 years, 1 month
[libvirt] [PATCH 0/2] Replace some leftover vshPrint calls with vshPrintExtra
by Erik Skultety
Erik Skultety (2):
tools: use vshError rather than vshPrint on failure
tools: Replace vshPrint with vshPrintExtra on places we forgot about
tools/virsh-domain.c | 73 +++++++++++++++++++++++++------------------------
tools/virsh-edit.c | 4 +--
tools/virsh-interface.c | 28 +++++++++----------
tools/virsh-network.c | 37 +++++++++++++------------
tools/virsh-nwfilter.c | 6 ++--
tools/virsh-pool.c | 21 +++++++-------
tools/virsh-snapshot.c | 20 +++++++-------
tools/virsh-volume.c | 14 +++++-----
tools/virt-admin.c | 4 +--
tools/vsh.c | 4 +--
10 files changed, 107 insertions(+), 104 deletions(-)
--
2.5.5
8 years, 1 month
[libvirt] [PATCH 0/2] qemu: Enable NUMA node tag in pci-root for PPC64
by Shivaprasad G Bhat
This patch addresses the same aspects on PPC the bug 1103314 addressed
on x86. It sets the target numa node in the pci-root instead of
using the pci-expander-bus.
The pci-expander-bus is of not much use on PPC, and the approach is
to set the value globally for reasons mentioned in Patch 2 commit
message.
Known issue :
If the destination doesn't recognize the NUMA node in the target,
then thats dropped during parsing. There is no ABI failure and the
migration will be successful. The issue needs us to relook on how
to make sure the unparsed tags on the destination which dont fail the ABI
could be enforced during migration. Not addressing that in these two patches.
---
Shivaprasad G Bhat (2):
qemu: capabilitity: Introduce QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE
qemu: Enable NUMA node tag in pci-root for PPC
docs/formatdomain.html.in | 5 ++
src/qemu/qemu_capabilities.c | 7 ++
src/qemu/qemu_capabilities.h | 1
src/qemu/qemu_command.c | 25 ++++++++
src/qemu/qemu_domain.c | 15 +++--
.../qemucapabilitiesdata/caps_1.2.2.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_1.3.1.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_1.4.2.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_1.5.3.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_1.6.0.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_1.7.0.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_2.1.1.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 22 +++++--
.../caps_2.6.0-gicv2.aarch64.replies | 22 +++++--
.../caps_2.6.0-gicv3.aarch64.replies | 24 +++++---
.../caps_2.6.0.ppc64le.replies | 60 ++++++++++++++++++--
.../qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 22 +++++--
.../qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 22 +++++--
...emuxml2argv-spapr-pci-hos-bridge-numa-node.args | 26 +++++++++
...qemuxml2argv-spapr-pci-hos-bridge-numa-node.xml | 43 ++++++++++++++
tests/qemuxml2argvtest.c | 2 +
22 files changed, 366 insertions(+), 106 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-spapr-pci-hos-bridge-numa-node.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-spapr-pci-hos-bridge-numa-node.xml
--
Signature
8 years, 1 month
[libvirt] [PATCH v2] BlockCopy support rbd external destination file
by Liu Qing
Currently qemuDomainBlockCopy only support local file. This patch make
the rbd external destination file could be passed to qemu driver_mirror.
If the flag VIR_DOMAIN_BLOCK_COPY_REUSE_EXT is not set for rbd protocol,
qemuDomainBlockCopy will report an error.
Signed-off-by: Liu Qing <liuqing(a)chinac.com>
---
src/qemu/qemu_driver.c | 119 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 82 insertions(+), 37 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a82e58b..c0b7fda 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16609,6 +16609,12 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
virQEMUDriverConfigPtr cfg = NULL;
const char *format = NULL;
int desttype = virStorageSourceGetActualType(mirror);
+ char *mirr_path = NULL;
+ qemuDomainSecretInfoPtr tmp_secinfo = NULL;
+ qemuDomainSecretInfoPtr mirr_secinfo = NULL;
+ qemuDomainSecretInfoPtr tmp_encinfo = NULL;
+ virStorageSourcePtr tmp_src = NULL;
+ qemuDomainDiskPrivatePtr diskPriv = NULL;
/* Preliminaries: find the disk we are editing, sanity checks */
virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW |
@@ -16629,6 +16635,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
if (!(disk = qemuDomainDiskByName(vm->def, path)))
goto endjob;
+ diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+
if (!(device = qemuAliasFromDisk(disk)))
goto endjob;
@@ -16675,51 +16683,67 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
}
/* Prepare the destination file. */
- /* XXX Allow non-file mirror destinations */
- if (!virStorageSourceIsLocalStorage(mirror)) {
+ if (!virStorageSourceIsLocalStorage(mirror) &&
+ (mirror->type != VIR_STORAGE_TYPE_NETWORK ||
+ mirror->protocol != VIR_STORAGE_NET_PROTOCOL_RBD)) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("non-file destination not supported yet"));
goto endjob;
}
- if (stat(mirror->path, &st) < 0) {
- if (errno != ENOENT) {
- virReportSystemError(errno, _("unable to stat for disk %s: %s"),
- disk->dst, mirror->path);
- goto endjob;
- } else if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT ||
- desttype == VIR_STORAGE_TYPE_BLOCK) {
- virReportSystemError(errno,
- _("missing destination file for disk %s: %s"),
- disk->dst, mirror->path);
- goto endjob;
- }
- } else if (!S_ISBLK(st.st_mode)) {
- if (st.st_size && !(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("external destination file for disk %s already "
- "exists and is not a block device: %s"),
- disk->dst, mirror->path);
- goto endjob;
- }
- if (desttype == VIR_STORAGE_TYPE_BLOCK) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("blockdev flag requested for disk %s, but file "
- "'%s' is not a block device"),
- disk->dst, mirror->path);
- goto endjob;
+ if (virStorageSourceIsLocalStorage(mirror)) {
+ if (stat(mirror->path, &st) < 0) {
+ if (errno != ENOENT) {
+ virReportSystemError(errno, _("unable to stat for disk %s: %s"),
+ disk->dst, mirror->path);
+ goto endjob;
+ } else if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT ||
+ desttype == VIR_STORAGE_TYPE_BLOCK) {
+ virReportSystemError(errno,
+ _("missing destination file for disk %s: %s"),
+ disk->dst, mirror->path);
+ goto endjob;
+ }
+ } else if (!S_ISBLK(st.st_mode)) {
+ if (st.st_size && !(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("external destination file for disk %s already "
+ "exists and is not a block device: %s"),
+ disk->dst, mirror->path);
+ goto endjob;
+ }
+ if (desttype == VIR_STORAGE_TYPE_BLOCK) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("blockdev flag requested for disk %s, but file "
+ "'%s' is not a block device"),
+ disk->dst, mirror->path);
+ goto endjob;
+ }
}
+ } else if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ "%s",
+ _("only external destination file is supported for "
+ "rbd protocol"));
+ goto endjob;
}
if (!mirror->format) {
- if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
- mirror->format = disk->src->format;
- } else {
- /* If the user passed the REUSE_EXT flag, then either they
- * can also pass the RAW flag or use XML to tell us the format.
- * So if we get here, we assume it is safe for us to probe the
- * format from the file that we will be using. */
- mirror->format = virStorageFileProbeFormat(mirror->path, cfg->user,
+ if (virStorageSourceIsLocalStorage(mirror)) {
+ if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
+ mirror->format = disk->src->format;
+ } else {
+ /* If the user passed the REUSE_EXT flag, then either they
+ * can also pass the RAW flag or use XML to tell us the format.
+ * So if we get here, we assume it is safe for us to probe the
+ * format from the file that we will be using. */
+ mirror->format = virStorageFileProbeFormat(mirror->path, cfg->user,
cfg->group);
+ }
+ } else {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("format is required for %s"),
+ mirror->path);
+ goto endjob;
}
}
@@ -16745,9 +16769,29 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
goto endjob;
}
+ tmp_secinfo = diskPriv->secinfo;
+ tmp_encinfo = diskPriv->encinfo;
+ tmp_src = disk->src;
+ disk->src = mirror;
+
+ if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0) {
+ disk->src = tmp_src;
+ diskPriv->secinfo = tmp_secinfo;
+ diskPriv->encinfo = tmp_encinfo;
+ goto endjob;
+ }
+
+ disk->src = tmp_src;
+ mirr_secinfo = diskPriv->secinfo;
+ diskPriv->secinfo = tmp_secinfo;
+ diskPriv->encinfo = tmp_encinfo;
+
+ if (qemuGetDriveSourceString(mirror, mirr_secinfo, &mirr_path) < 0)
+ goto endjob;
+
/* Actually start the mirroring */
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorDriveMirror(priv->mon, device, mirror->path, format,
+ ret = qemuMonitorDriveMirror(priv->mon, device, mirr_path, format,
bandwidth, granularity, buf_size, flags);
virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
@@ -16775,6 +16819,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
qemuDomainObjEndJob(driver, vm);
cleanup:
+ VIR_FREE(mirr_path);
VIR_FREE(device);
virObjectUnref(cfg);
return ret;
--
1.8.3.1
8 years, 1 month
[libvirt] [PATCH 00/24] docs: Kill useless spaces in <pre/>
by Michal Privoznik
Whilst reviewing patches that reworked our web page I've noticed
couple of overflows in some example XMLs. For instance:
http://libvirt.org/formatnetwork.html#elementsAddress
The problem is we have very long lines sometimes. And to make it
worse we have a lot of spaces at the beginning of some <pre/>
sections. Remove them.
Michal Privoznik (24):
aclpolkit.html.in: Kill useless spaces in <pre/>
cgroups.html.in: Kill useless spaces in <pre/>
compiling.html.in: Kill useless spaces in <pre/>
devguide.html.in: Kill useless spaces in <pre/>
downloads.html.in: Kill useless spaces in <pre/>
drvbhyve.html.in: Kill useless spaces in <pre/>
drvesx.html.in: Kill useless spaces in <pre/>
drvlxc.html.in: Kill useless spaces in <pre/>
format.html.in: Kill useless spaces in <pre/>
formatcaps.html.in: Kill useless spaces in <pre/>
formatdomain.html.in: Kill useless spaces in <pre/>
formatnetwork.html.in: Kill useless spaces in <pre/>
formatnwfilter.html.in: Kill useless spaces in <pre/>
formatsecret.html.in: Kill useless spaces in <pre/>
formatstorage.html.in: Kill useless spaces in <pre/>
formatstorageencryption.html.in: Kill useless spaces in <pre/>
command.html.in: Kill useless spaces in <pre/>
locking.html.in: Kill useless spaces in <pre/>
rpc.html.in: Kill useless spaces in <pre/>
locking-lockd.html.in: Kill useless spaces in <pre/>
locking-sanlock.html.in: Kill useless spaces in <pre/>
logging.html.in: Kill useless spaces in <pre/>
migration.html.in: Kill useless spaces in <pre/>
storage.html.in: Kill useless spaces in <pre/>
docs/aclpolkit.html.in | 6 +-
docs/cgroups.html.in | 10 +-
docs/compiling.html.in | 34 +-
docs/devguide.html.in | 12 +-
docs/downloads.html.in | 6 +-
docs/drvbhyve.html.in | 34 +-
docs/drvesx.html.in | 44 +-
docs/drvlxc.html.in | 12 +-
docs/format.html.in | 2 +-
docs/formatcaps.html.in | 2 +-
docs/formatdomain.html.in | 2338 +++++++++++++++++-----------------
docs/formatnetwork.html.in | 320 ++---
docs/formatnwfilter.html.in | 210 +--
docs/formatsecret.html.in | 200 +--
docs/formatstorage.html.in | 280 ++--
docs/formatstorageencryption.html.in | 38 +-
docs/internals/command.html.in | 172 +--
docs/internals/locking.html.in | 132 +-
docs/internals/rpc.html.in | 220 ++--
docs/locking-lockd.html.in | 32 +-
docs/locking-sanlock.html.in | 40 +-
docs/logging.html.in | 38 +-
docs/migration.html.in | 48 +-
docs/storage.html.in | 296 ++---
24 files changed, 2263 insertions(+), 2263 deletions(-)
--
2.8.4
8 years, 1 month
[libvirt] [PATCH] BlockCopy support rbd external destination file
by Liu Qing
Currently qemuDomainBlockCopy only support local file. This patch make
the rbd external destination file could be passed to qemu driver_mirror.
If the external rbd file is not exist, qemuDomainBlockCopy will report
an error.
Signed-off-by: Liu Qing <liuqing(a)chinac.com>
---
src/qemu/qemu_driver.c | 82 +++++++++++++++++++++++++++++++-------------------
1 file changed, 51 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 38c8414..ee8db69 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16609,6 +16609,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
virQEMUDriverConfigPtr cfg = NULL;
const char *format = NULL;
int desttype = virStorageSourceGetActualType(mirror);
+ char *mirr_path = NULL;
/* Preliminaries: find the disk we are editing, sanity checks */
virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW |
@@ -16675,42 +16676,50 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
}
/* Prepare the destination file. */
- /* XXX Allow non-file mirror destinations */
- if (!virStorageSourceIsLocalStorage(mirror)) {
+ if (!virStorageSourceIsLocalStorage(mirror) &&
+ (mirror->type != VIR_STORAGE_TYPE_NETWORK ||
+ mirror->protocol != VIR_STORAGE_NET_PROTOCOL_RBD)) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("non-file destination not supported yet"));
goto endjob;
}
- if (stat(mirror->path, &st) < 0) {
- if (errno != ENOENT) {
- virReportSystemError(errno, _("unable to stat for disk %s: %s"),
- disk->dst, mirror->path);
- goto endjob;
- } else if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT ||
- desttype == VIR_STORAGE_TYPE_BLOCK) {
- virReportSystemError(errno,
- _("missing destination file for disk %s: %s"),
- disk->dst, mirror->path);
- goto endjob;
- }
- } else if (!S_ISBLK(st.st_mode)) {
- if (st.st_size && !(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("external destination file for disk %s already "
- "exists and is not a block device: %s"),
- disk->dst, mirror->path);
- goto endjob;
- }
- if (desttype == VIR_STORAGE_TYPE_BLOCK) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("blockdev flag requested for disk %s, but file "
- "'%s' is not a block device"),
- disk->dst, mirror->path);
- goto endjob;
+ if (virStorageSourceIsLocalStorage(mirror)) {
+ if (stat(mirror->path, &st) < 0) {
+ if (errno != ENOENT) {
+ virReportSystemError(errno, _("unable to stat for disk %s: %s"),
+ disk->dst, mirror->path);
+ goto endjob;
+ } else if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT ||
+ desttype == VIR_STORAGE_TYPE_BLOCK) {
+ virReportSystemError(errno,
+ _("missing destination file for disk %s: %s"),
+ disk->dst, mirror->path);
+ goto endjob;
+ }
+ } else if (!S_ISBLK(st.st_mode)) {
+ if (st.st_size && !(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("external destination file for disk %s already "
+ "exists and is not a block device: %s"),
+ disk->dst, mirror->path);
+ goto endjob;
+ }
+ if (desttype == VIR_STORAGE_TYPE_BLOCK) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("blockdev flag requested for disk %s, but file "
+ "'%s' is not a block device"),
+ disk->dst, mirror->path);
+ goto endjob;
+ }
}
+ } else if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("only external destination file is supported for "
+ "rbd protocol"));
+ goto endjob;
}
- if (!mirror->format) {
+ if (!mirror->format && virStorageSourceIsLocalStorage(mirror)) {
if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
mirror->format = disk->src->format;
} else {
@@ -16721,8 +16730,12 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
mirror->format = virStorageFileProbeFormat(mirror->path, cfg->user,
cfg->group);
}
+ } else {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("format is required for %s"),
+ mirror->path);
+ goto endjob;
}
-
/* pre-create the image file */
if (!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)) {
int fd = qemuOpenFile(driver, vm, mirror->path,
@@ -16744,10 +16757,16 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
qemuDomainDiskChainElementRevoke(driver, vm, mirror);
goto endjob;
}
+ if (mirror->protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
+ if (qemuGetDriveSourceString(mirror, conn, &mirr_path) < 0)
+ goto endjob;
+ }
+ else if (VIR_STRDUP(mirr_path, mirror->path) < 0)
+ goto endjob;
/* Actually start the mirroring */
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorDriveMirror(priv->mon, device, mirror->path, format,
+ ret = qemuMonitorDriveMirror(priv->mon, device, mirr_path, format,
bandwidth, granularity, buf_size, flags);
virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
@@ -16775,6 +16794,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
qemuDomainObjEndJob(driver, vm);
cleanup:
+ VIR_FREE(mirr_path);
VIR_FREE(device);
virObjectUnref(cfg);
return ret;
--
1.9.1
8 years, 1 month
[libvirt] Segfault in qemuDomainDefVcpusPostParse:2480
by Nehal J Wani
The man page of qemu(2.6.2), states the following:
-smp
[cpus=]n[,cores=cores][,threads=threads][,sockets=sockets][,maxcpus=maxcpus]
Simulate an SMP system with n CPUs. On the PC target, up to 255
CPUs are supported. On Sparc32 target, Linux limits the number of usable
CPUs to 4. For the PC target, the number of cores per
socket, the number of threads per cores and the total number of
sockets can be specified. Missing values will be computed. *If any on the
three values is given, the total number of CPUs n can be
omitted*. maxcpus specifies the maximum number of hotpluggable
CPUs.
So, I built the master branch of libvirt and tested the following:
Client:
$ ./run ./tools/virsh domxml-from-native qemu-argv <(echo
'/usr/bin/qemu-system-x86_64 -enable-kvm -smp cores=2,threads=1,sockets=1')
error: Disconnected from qemu:///session due to I/O error
error: Cannot recv data: Connection reset by peer
Server:
$ ./run gdb ./daemon/libvirtd
GNU gdb (GDB) Fedora 7.11.1-86.fc24
...
Starting program: /home/wani/libvirt/daemon/.libs/lt-libvirtd
[Thread debugging using libthread_db enabled]
...
[Thread 0x7fffc462c700 (LWP 16850) exited]
...
Thread 4 "lt-libvirtd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe4cf1700 (LWP 16836)]
qemuDomainDefVcpusPostParse (def=0x7fffb8000ec0) at qemu/qemu_domain.c:2480
2480 if (!vcpu->online) {
qemuDomainDefVcpusPostParse() calls vcpu = virDomainDefGetVcpu(def, 0),
which returns NULL.
I'd be happy to send a patch, but I am not sure what the right solution is.
- Should not specifying n to -smp allowed?
- Should -cpus=n also be parsed in qemuParseCommandLineSmp()?
Cheers!
Nehal J Wani
8 years, 1 month