[libvirt] [PATCH 0/5] fix multiple leasehelper bugs
by Peter Krempa
Found while reviewing Pavel's patch.
Peter Krempa (5):
util: json: Unify function header formatting
util: json: Add helpers for manipulating json arrays
net: leasehelper: Don't crash if DNSMASQ doesn't provide lease expiry
leasehelper: Ignore corrupted lease file and rewrite it
leasehelper: Refactor copying of old entries to avoid double free
src/network/leaseshelper.c | 90 +++++++------
src/util/virjson.c | 316 ++++++++++++++++++++++++++++++++++-----------
src/util/virjson.h | 2 +
3 files changed, 295 insertions(+), 113 deletions(-)
--
1.9.3
10 years, 5 months
[libvirt] checking smtp server issue
by Jim Fehlig
I've been having problems lately with an internal MTA connecting to an
external one that apparently serves the libvirt list. E.g. I recently
responded to "[PATCH v2 4/4] libxl: Add a test suite for libxl option
generator", which includes the xen-devel list. The response made it to
xen-devel, but I received the following wrt the libvirt list
The attached file had the following undeliverable recipient(s):
Information about your message:
Message log tag: 661753
Number of send attempts: 1
Time of initial send attempt: 06-16-14 17:11:53
Transcript of session follows:
Command: EHLO victor.provo.novell.com
Response: 550 TLS negotiation failure
Seems like a certificate problem on the victor host. I'm trying a
different smtp server for another data point in my report to internal
IS&T folks. Thanks for your patience.
Regards,
Jim
10 years, 5 months
[libvirt] [PATCH v2] Added example script on how to convert LXC container config
by Cédric Bosdonnat
---
Makefile.am | 2 +-
configure.ac | 1 +
examples/lxcconvert/Makefile.am | 18 ++++++
examples/lxcconvert/virt-lxc-convert | 108 +++++++++++++++++++++++++++++++++++
4 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 examples/lxcconvert/Makefile.am
create mode 100644 examples/lxcconvert/virt-lxc-convert
diff --git a/Makefile.am b/Makefile.am
index 9847ff0..0ef983f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,7 @@ SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
tests po examples/object-events examples/hellolibvirt \
examples/dominfo examples/domsuspend examples/apparmor \
examples/xml/nwfilter examples/openauth examples/systemtap \
- tools/wireshark
+ examples/lxcconvert tools/wireshark
ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 73efffa..f84d4bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2699,6 +2699,7 @@ AC_CONFIG_FILES([\
examples/hellolibvirt/Makefile \
examples/systemtap/Makefile \
examples/xml/nwfilter/Makefile \
+ examples/lxcconvert/Makefile \
tools/wireshark/Makefile \
tools/wireshark/src/Makefile])
AC_OUTPUT
diff --git a/examples/lxcconvert/Makefile.am b/examples/lxcconvert/Makefile.am
new file mode 100644
index 0000000..09cf5d9
--- /dev/null
+++ b/examples/lxcconvert/Makefile.am
@@ -0,0 +1,18 @@
+## Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library. If not, see
+## <http://www.gnu.org/licenses/>.
+
+EXTRA_DIST= \
+ virt-lxc-convert
diff --git a/examples/lxcconvert/virt-lxc-convert b/examples/lxcconvert/virt-lxc-convert
new file mode 100644
index 0000000..a6c5721
--- /dev/null
+++ b/examples/lxcconvert/virt-lxc-convert
@@ -0,0 +1,108 @@
+#!/bin/sh
+
+handler_cleanup()
+{
+ if ! test -z "$conf_dir"; then
+ # Remove the temporary config
+ rm -r "$conf_dir"
+ fi
+}
+trap handler_cleanup INT EXIT
+
+show_help()
+{
+ cat << EOF
+$0 /path/to/lxc/config/file
+
+Wrapper around virsh domxml-from-native to ease conversion of LXC
+containers configuration to libvirt domain XML.
+EOF
+}
+
+if test $# != 1; then
+ show_help
+ exit 1
+fi
+
+if test "$1" = "--help" || test "$1" = "-h"; then
+ show_help
+ exit $?
+fi
+
+conf=$1
+
+conf_dir=$(mktemp --tmpdir -d virt-lxc-convert-XXX)
+conf_new=$conf_dir/config
+
+cp "$conf" "$conf_new"
+
+# Do we have lxc.mount, and is it pointing to a readable file?
+fstab=$(sed -n '/lxc.mount[[:space:]]*=/ s/[[:space:]]*=[[:space:]]*/=/p' \
+ "$conf_new" | cut -f 2 -d '=')
+if test -n "$fstab" && test -r "$fstab"; then
+ sed 's/^lxc.mount[[:space:]]*=.*$//' "$conf_new" >"${conf_new}.tmp"
+ mv "${conf_new}.tmp" "${conf_new}"
+ sed 's/^\([^#]\)/lxc.mount.entry = \1/' "$fstab" >>"${conf_new}"
+fi
+
+memory=$(free | sed -n '/Mem:/s/ \+/ /gp' | cut -f 2 -d ' ')
+default_tmpfs="size=$((memory/2))"
+
+# Do we have tmpfs without size param?
+lineno=0
+while read line; do
+ lineno=$(expr $lineno + 1)
+ has_rel_size=false
+ case $line in
+ lxc.mount.entry[[:space:]]*=[[:space:]]*tmpfs[[:space:]]*)
+ is_tmpfs=true
+ ;;
+ *)
+ is_tmpfs=false
+ ;;
+ esac
+
+ # We only care about tmpfs mount entries here
+ if ! $is_tmpfs; then
+ continue
+ fi
+
+ case $line in
+ *size=[0-9][0-9]*%*)
+ has_rel_size=true
+ has_size=true
+ ;;
+ *size=*)
+ has_size=true
+ ;;
+ *)
+ has_size=false
+ ;;
+ esac
+
+ # Add the default size here (50%) if no size is given
+ if ! $has_size; then
+ last_option_match="\([[:space:]]*[0-9][[:space:]]*[0-9][::space::]*$\)"
+ sed "${lineno}s/$last_option_match/,$default_tmpfs\1/" \
+ "$conf_new" >"${conf_new}.tmp"
+ mv "${conf_new}.tmp" "${conf_new}"
+ fi
+
+ # Convert relative sizes
+ if $has_rel_size; then
+ percent=$(echo "$line" | sed 's/.*size=\([0-9][0-9]*\)%.*/\1/')
+ size="$((memory*percent/100))"
+ sed "${lineno}s/size=[0-9]*%/size=${size}/" \
+ "$conf_new" >"${conf_new}.tmp"
+ mv "${conf_new}.tmp" "${conf_new}"
+ fi
+done < "$conf_new"
+
+# Do we have any memory limit set?
+mem_limit=$(grep 'lxc.cgroup.memory.limit_in_bytes[[:space:]]*=' $conf_new)
+if test -z "$mem_limit"; then
+ echo "lxc.cgroup.memory.limit_in_bytes = $memory" >> "$conf_new"
+fi
+
+virsh -c lxc:/// domxml-from-native lxc-tools $conf_new
+exit $?
--
1.8.4.5
10 years, 5 months
[libvirt] [PATCH] blockjob: don't remove older-style mirror XML
by Eric Blake
Commit 7c6fc39 introduced a regression in the XML produced for older
clients. The argument at the time was that clients shouldn't be
depending on output-only data for something that is only going to
be triggered for a transient guest; but John Ferlan reported that
the automated testsuite was such a client. It's better to be safe
than sorry by guaranteeing back-compat cruft. Note that later
patches will be using <mirror> for active block commit, but there
we don't have to worry about back-compat.
* src/conf/domain_conf.c (virDomainDiskDefFormat): Restore old
style output when necessary.
* docs/schemas/domaincommon.rng: Validate back-compat style.
* docs/formatdomain.html.in: Update the documentation.
* tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml:
Update tests.
* tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I have to rebase my remaining active commit series on top of this,
but wanted to get this out now so that John can test if this is
sufficient to resolve the test failure without having to modify
things in the automated tester.
docs/formatdomain.html.in | 12 +++++++-----
docs/schemas/domaincommon.rng | 12 ++++++++++--
src/conf/domain_conf.c | 19 +++++++++++++------
tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 4 ++--
.../qemuxml2xmlout-disk-mirror-old.xml | 4 ++--
5 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1b6ced8..13ba541 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1891,11 +1891,13 @@
attribute <code>ready</code> is present, then it is known the
disk is ready to pivot; otherwise, the disk is probably still
copying. For now, this element only valid in output; it is
- ignored on input. <span class="since">Since 1.2.6</span>
- (Older libvirt <span class="since">since 0.9.12</span> allowed
- only mirroring to a file, with the information reported
- in <code>file</code> and <code>format</code> attributes
- of <code>mirror</code> rather than subelements.)
+ ignored on input. The <code>source</code> sub-element exists
+ for all two-phase jobs <span class="since">since 1.2.6</span>.
+ Older libvirt supported only block copy to a
+ file, <span class="since">since 0.9.12</span>; for
+ compatibility with older clients, such jobs include redundant
+ information in the attributes <code>file</code>
+ and <code>format</code> in the <code>mirror</code> element.
</dd>
<dt><code>target</code></dt>
<dd>The <code>target</code> element controls the bus / device
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 6cc922c..33d0308 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4176,7 +4176,7 @@
<define name='diskMirror'>
<element name='mirror'>
<choice>
- <group>
+ <group> <!-- old format, for block copy back-compat -->
<attribute name='file'>
<ref name='absFilePath'/>
</attribute>
@@ -4185,8 +4185,16 @@
<ref name='storageFormat'/>
</attribute>
</optional>
+ <optional>
+ <interleave>
+ <ref name='diskSourceFile'/>
+ <optional>
+ <ref name="diskFormat"/>
+ </optional>
+ </interleave>
+ </optional>
</group>
- <group>
+ <group> <!-- preferred format -->
<interleave>
<ref name="diskSource"/>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index be81dbe..4114289 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15187,19 +15187,26 @@ virDomainDiskDefFormat(virBufferPtr buf,
/* For now, mirroring is currently output-only: we only output it
* for live domains, therefore we ignore it on input except for
- * the internal parse on libvirtd restart. We only output the
- * new style similar to backingStore, even though the parser
- * code still accepts old style across libvirtd upgrades. */
+ * the internal parse on libvirtd restart. We prefer to output
+ * the new style similar to backingStore, but for back-compat on
+ * blockcopy files we also have to output old style attributes.
+ * The parser accepts either style across libvirtd upgrades. */
if (def->mirror && !(flags & VIR_DOMAIN_XML_INACTIVE)) {
+ const char *formatStr = NULL;
+
+ if (def->mirror->format)
+ formatStr = virStorageFileFormatTypeToString(def->mirror->format);
virBufferAsprintf(buf, "<mirror type='%s'",
virStorageTypeToString(def->mirror->type));
+ if (def->mirror->type == VIR_STORAGE_TYPE_FILE) {
+ virBufferEscapeString(buf, " file='%s'", def->mirror->path);
+ virBufferEscapeString(buf, " format='%s'", formatStr);
+ }
if (def->mirroring)
virBufferAddLit(buf, " ready='yes'");
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
- if (def->mirror->format)
- virBufferEscapeString(buf, "<format type='%s'/>\n",
- virStorageFileFormatTypeToString(def->mirror->format));
+ virBufferEscapeString(buf, "<format type='%s'/>\n", formatStr);
if (virDomainDiskSourceFormat(buf, def->mirror, 0, 0) < 0)
return -1;
virBufferAdjustIndent(buf, -2);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml
index a937d0a..72b03c9 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml
@@ -17,7 +17,7 @@
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<backingStore/>
- <mirror type='file' ready='yes'>
+ <mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' ready='yes'>
<source file='/dev/HostVG/QEMUGuest1Copy'/>
</mirror>
<target dev='hda' bus='ide'/>
@@ -33,7 +33,7 @@
<disk type='file' device='disk'>
<source file='/tmp/data.img'/>
<backingStore/>
- <mirror type='file'>
+ <mirror type='file' file='/tmp/copy.img' format='qcow2'>
<format type='qcow2'/>
<source file='/tmp/copy.img'/>
</mirror>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
index a937d0a..72b03c9 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
@@ -17,7 +17,7 @@
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<backingStore/>
- <mirror type='file' ready='yes'>
+ <mirror type='file' file='/dev/HostVG/QEMUGuest1Copy' ready='yes'>
<source file='/dev/HostVG/QEMUGuest1Copy'/>
</mirror>
<target dev='hda' bus='ide'/>
@@ -33,7 +33,7 @@
<disk type='file' device='disk'>
<source file='/tmp/data.img'/>
<backingStore/>
- <mirror type='file'>
+ <mirror type='file' file='/tmp/copy.img' format='qcow2'>
<format type='qcow2'/>
<source file='/tmp/copy.img'/>
</mirror>
--
1.9.3
10 years, 5 months
[libvirt] [PATCH] blockjob: use stable disk string in job event
by Eric Blake
When the block job event was first added, it was for block pull,
where the active layer of the disk remains the same name. It was
also in a day where we only cared about local files, and so we
always had a canonical absolute file name. But two things have
changed since then: we now have network disks, where determining
a single absolute string does not really make sense; and we have
two-phase jobs (copy and active commit) where the name of the
active layer changes between the first event (ready, on the old
name) and second (complete, on the pivoted name).
Adam Litke reported that having an unstable string between events
makes life harder for clients. Furthermore, all of our API that
operate on a particular disk of a domain accept multiple strings:
not only the absolute name of the active layer, but also the
destination device name (such as 'vda'). As this latter name is
stable, even for network sources, it serves as a better string
to supply in block job events.
* include/libvirt/libvirt.h.in
(virConnectDomainEventBlockJobCallback): Document altered semantics.
* src/conf/domain_event.c (_virDomainEventBlockJob): Rename field,
to ensure we catch all clients.
(virDomainEventBlockJobDispose, virDomainEventBlockJobNew)
(virDomainEventBlockJobNewFromObj)
(virDomainEventBlockJobNewFromDom)
(virDomainEventDispatchDefaultFunc): Adjust clients.
* src/conf/domain_event.h: Likewise.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Likewise.
* src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Likewise.
* src/remote/remote_protocol.x
(remote_domain_event_block_job_msg): Likewise.
* src/remote/remote_driver.c
(remoteDomainBuildEventBlockJobHelper): Likewise.
* daemon/remote.c (remoteRelayDomainEventBlockJob): Likewise.
* src/remote_protocol-structs: Regenerate.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
If you think backward compatibility of old clients that expected
and operated on an absolute name is too important to break, I'm
open to suggestions on alternatives how to preserve that. We don't
have a flag argument during event registration, or I would have
used it. Otherwise, I hope this change is okay as-is.
daemon/remote.c | 8 ++++----
include/libvirt/libvirt.h.in | 11 ++++++++++-
src/conf/domain_event.c | 18 +++++++++---------
src/conf/domain_event.h | 4 ++--
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_process.c | 4 +---
src/remote/remote_driver.c | 2 +-
src/remote/remote_protocol.x | 2 +-
src/remote_protocol-structs | 2 +-
9 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 34c96c9..ee1bbbc 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -558,7 +558,7 @@ remoteRelayDomainEventGraphics(virConnectPtr conn,
static int
remoteRelayDomainEventBlockJob(virConnectPtr conn,
virDomainPtr dom,
- const char *path,
+ const char *disk,
int type,
int status,
void *opaque)
@@ -571,11 +571,11 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn,
return -1;
VIR_DEBUG("Relaying domain block job event %s %d %s %i, %i, callback %d",
- dom->name, dom->id, path, type, status, callback->callbackID);
+ dom->name, dom->id, disk, type, status, callback->callbackID);
/* build return data */
memset(&data, 0, sizeof(data));
- if (VIR_STRDUP(data.path, path) < 0)
+ if (VIR_STRDUP(data.disk, disk) < 0)
goto error;
data.type = type;
data.status = status;
@@ -596,7 +596,7 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn,
return 0;
error:
- VIR_FREE(data.path);
+ VIR_FREE(data.disk);
return -1;
}
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index dc88c40..a983046 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -4852,11 +4852,20 @@ typedef enum {
* virConnectDomainEventBlockJobCallback:
* @conn: connection object
* @dom: domain on which the event occurred
- * @disk: fully-qualified filename of the affected disk
+ * @disk: name associated with the affected disk
* @type: type of block job (virDomainBlockJobType)
* @status: status of the operation (virConnectDomainEventBlockJobStatus)
* @opaque: application specified data
*
+ * The string returned for @disk can be used in any of the libvirt API
+ * that operate on a particular disk of the domain. In older versions
+ * of libvirt, this string was the fully-qualified filename of the
+ * active layer of the disk; but as some events can change which file
+ * is the active layer, and because network protocols do not
+ * necessarily have a canonical filename, libvirt 1.2.6 and newer
+ * instead use the device target shorthand (the <target dev='...'/>
+ * sub-element, such as "vda").
+ *
* The callback signature to use when registering for an event of type
* VIR_DOMAIN_EVENT_ID_BLOCK_JOB with virConnectDomainEventRegisterAny()
*/
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index b565732..a2d59fd 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -128,7 +128,7 @@ typedef virDomainEventIOError *virDomainEventIOErrorPtr;
struct _virDomainEventBlockJob {
virDomainEvent parent;
- char *path;
+ char *disk;
int type;
int status;
};
@@ -364,7 +364,7 @@ virDomainEventBlockJobDispose(void *obj)
virDomainEventBlockJobPtr event = obj;
VIR_DEBUG("obj=%p", event);
- VIR_FREE(event->path);
+ VIR_FREE(event->disk);
}
static void
@@ -778,7 +778,7 @@ static virObjectEventPtr
virDomainEventBlockJobNew(int id,
const char *name,
unsigned char *uuid,
- const char *path,
+ const char *disk,
int type,
int status)
{
@@ -792,7 +792,7 @@ virDomainEventBlockJobNew(int id,
id, name, uuid)))
return NULL;
- if (VIR_STRDUP(ev->path, path) < 0) {
+ if (VIR_STRDUP(ev->disk, disk) < 0) {
virObjectUnref(ev);
return NULL;
}
@@ -804,22 +804,22 @@ virDomainEventBlockJobNew(int id,
virObjectEventPtr
virDomainEventBlockJobNewFromObj(virDomainObjPtr obj,
- const char *path,
+ const char *disk,
int type,
int status)
{
return virDomainEventBlockJobNew(obj->def->id, obj->def->name,
- obj->def->uuid, path, type, status);
+ obj->def->uuid, disk, type, status);
}
virObjectEventPtr
virDomainEventBlockJobNewFromDom(virDomainPtr dom,
- const char *path,
+ const char *disk,
int type,
int status)
{
return virDomainEventBlockJobNew(dom->id, dom->name, dom->uuid,
- path, type, status);
+ disk, type, status);
}
virObjectEventPtr
@@ -1255,7 +1255,7 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
blockJobEvent = (virDomainEventBlockJobPtr)event;
((virConnectDomainEventBlockJobCallback)cb)(conn, dom,
- blockJobEvent->path,
+ blockJobEvent->disk,
blockJobEvent->type,
blockJobEvent->status,
cbopaque);
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 9c41090..e107cc4 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -117,12 +117,12 @@ virDomainEventControlErrorNewFromObj(virDomainObjPtr obj);
virObjectEventPtr
virDomainEventBlockJobNewFromObj(virDomainObjPtr obj,
- const char *path,
+ const char *disk,
int type,
int status);
virObjectEventPtr
virDomainEventBlockJobNewFromDom(virDomainPtr dom,
- const char *path,
+ const char *disk,
int type,
int status);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b4bf561..c866557 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15135,7 +15135,7 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
* active commit, so we can hardcode the event to pull */
int type = VIR_DOMAIN_BLOCK_JOB_TYPE_PULL;
int status = VIR_DOMAIN_BLOCK_JOB_CANCELED;
- event = virDomainEventBlockJobNewFromObj(vm, disk->src->path, type,
+ event = virDomainEventBlockJobNewFromObj(vm, disk->dst, type,
status);
} else if (!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC)) {
while (1) {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e4845ba..68cfd4c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1013,15 +1013,13 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
{
virQEMUDriverPtr driver = opaque;
virObjectEventPtr event = NULL;
- const char *path;
virDomainDiskDefPtr disk;
virObjectLock(vm);
disk = qemuProcessFindDomainDiskByAlias(vm, diskAlias);
if (disk) {
- path = virDomainDiskGetSource(disk);
- event = virDomainEventBlockJobNewFromObj(vm, path, type, status);
+ event = virDomainEventBlockJobNewFromObj(vm, disk->dst, type, status);
/* XXX If we completed a block pull or commit, then recompute
* the cached backing chain to match. Better would be storing
* the chain ourselves rather than reprobing, but this
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 85fe597..8a83a41 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5023,7 +5023,7 @@ remoteDomainBuildEventBlockJobHelper(virConnectPtr conn,
if (!dom)
return;
- event = virDomainEventBlockJobNewFromDom(dom, msg->path, msg->type,
+ event = virDomainEventBlockJobNewFromDom(dom, msg->disk, msg->type,
msg->status);
virDomainFree(dom);
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 1f9d583..e9a23cf 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2352,7 +2352,7 @@ struct remote_domain_event_callback_graphics_msg {
struct remote_domain_event_block_job_msg {
remote_nonnull_domain dom;
- remote_nonnull_string path;
+ remote_nonnull_string disk;
int type;
int status;
};
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 5b22049..9904f3d 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1797,7 +1797,7 @@ struct remote_domain_event_callback_graphics_msg {
};
struct remote_domain_event_block_job_msg {
remote_nonnull_domain dom;
- remote_nonnull_string path;
+ remote_nonnull_string disk;
int type;
int status;
};
--
1.9.3
10 years, 5 months
[libvirt] [PATCH] blockjob: avoid compiler uncertainty in info sizing
by Eric Blake
We have a policy of avoiding enum types in structs in our public
API, because it is possible for a client to choose compiler options
that can change the in-memory ABI of that struct based on whether
the enum value occupies an int or a minimal size. But we missed
this for virDomainBlockJobInfo. We got lucky on little-endian
machines - if the enum fits minimal size (a char), we still end
up padding to the next long before the next field; but on
big-endian, a client interpreting the enum as a char would always
see 0 when the server supplies contents as an int.
While at it, I noticed that the web page lacked documentation:
http://libvirt.org/html/libvirt-libvirt.html#virDomainBlockJobType
not only for the recently added active commit, but also for all
the other job types.
* include/libvirt/libvirt.h.in (virDomainBlockJobInfo): Enforce
particular sizing.
(virDomainBlockJobType): Document recent addition.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
include/libvirt/libvirt.h.in | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 127de11..dc88c40 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2501,19 +2501,26 @@ int virDomainUpdateDeviceFlags(virDomainPtr domain,
/**
* virDomainBlockJobType:
*
- * VIR_DOMAIN_BLOCK_JOB_TYPE_PULL: Block Pull (virDomainBlockPull, or
- * virDomainBlockRebase without flags), job ends on completion
- * VIR_DOMAIN_BLOCK_JOB_TYPE_COPY: Block Copy (virDomainBlockRebase with
- * flags), job exists as long as mirroring is active
- * VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT: Block Commit (virDomainBlockCommit),
- * job ends on completion
+ * Describes various possible block jobs.
*/
typedef enum {
- VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0,
+ VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0, /* Placeholder */
+
VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1,
+ /* Block Pull (virDomainBlockPull, or virDomainBlockRebase without
+ * flags), job ends on completion */
+
VIR_DOMAIN_BLOCK_JOB_TYPE_COPY = 2,
+ /* Block Copy (virDomainBlockRebase with flags), job exists as
+ * long as mirroring is active */
+
VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT = 3,
+ /* Block Commit (virDomainBlockCommit without flags), job ends on
+ * completion */
+
VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4,
+ /* Active Block Commit (virDomainBlockCommit with flags), job
+ * exists as long as sync is active */
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_BLOCK_JOB_TYPE_LAST
@@ -2537,7 +2544,7 @@ typedef unsigned long long virDomainBlockJobCursor;
typedef struct _virDomainBlockJobInfo virDomainBlockJobInfo;
struct _virDomainBlockJobInfo {
- virDomainBlockJobType type;
+ int type; /* virDomainBlockJobType */
unsigned long bandwidth;
/*
* The following fields provide an indication of block job progress. @cur
--
1.9.3
10 years, 5 months
Re: [libvirt] [Qemu-devel] [PATCH v4 04/29] NUMA: convert -numa option to use OptsVisitor
by Eduardo Habkost
On Mon, Jun 09, 2014 at 06:25:09PM +0800, Hu Tao wrote:
> From: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
>
> Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
> Signed-off-by: Igor Mammedov <imammedo(a)redhat.com>
> Tested-by: Eduardo Habkost <ehabkost(a)redhat.com>
> Reviewed-by: Eduardo Habkost <ehabkost(a)redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini(a)redhat.com>
> Signed-off-by: Hu Tao <hutao(a)cn.fujitsu.com>
So, this is when the ability to use multiple "cpus" ranges on -numa is
finally enabled, right?
Is there some capability probing mechanism that can be used by
management to detect the new feature?
--
Eduardo
10 years, 5 months
[libvirt] [PATCH] Increase the size of REMOTE_MIGRATE_COOKIE_MAX to REMOTE_STRING_MAX
by Shivaprasad G Bhat
During guest migration, if the domain xml is bigger than 16384 which is
easily possible for a guest with good number of disks, message encode fails
for xdr_remote_domain_migrate_perform3_ret().
So, Increase the COOKIE_MAX to STRING_MAX value.
Signed-off-by: Shivaprasad G Bhat <shivaprasadbhat(a)gmail.com>
---
src/remote/remote_protocol.x | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 1f9d583..ab9b83d 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -86,7 +86,7 @@ const REMOTE_VCPUINFO_MAX = 16384;
const REMOTE_CPUMAPS_MAX = 8388608;
/* Upper limit on migrate cookie. */
-const REMOTE_MIGRATE_COOKIE_MAX = 16384;
+const REMOTE_MIGRATE_COOKIE_MAX = 4194304;
/* Upper limit on lists of networks. */
const REMOTE_NETWORK_LIST_MAX = 16384;
10 years, 5 months
[libvirt] [PATCH v2 00/10] active commit to backing file
by Eric Blake
This enables active commit (collapsing a temporary qcow2 wrapper
file back into the permanent backing file), when the destination
is a regular file or block device. Further plans for this work
before 1.2.6 is released: figure out how to add a qemu capability
probe (qemu 2.0 supports active commit but did a lousy job of
advertising it, and I found a corner case bug in it that won't be
fixed until 2.1), and integrate with Peter's work to allow active
commit into a network backing file.
Earlier posts related to this series:
https://www.redhat.com/archives/libvir-list/2014-May/msg00564.html
https://www.redhat.com/archives/libvir-list/2014-May/msg00723.html
There are definitely some merge conflicts to still work out (both
Peter and I are adding a new flag to virDomainBlockCommit, so it
is touching some of the same code). I can rebase again on top of
Peter's pending patches, if needed. I also think the switch from
nested struct to pointer for a disk definition's source will make
it easier for Benoit's desire to implement quorums.
Eric Blake (10):
conf: store snapshot source as pointer, for easier manipulation
conf: consolidate disk def allocation
conf: store disk source as pointer, for easier manipulation
conf: store mirroring information in virStorageSource
conf: alter disk mirror xml output
blockcommit: document semantics of committing active layer
virsh: expose new active commit controls
blockcommit: update error messages related to block jobs
blockcommit: track job type in xml
blockcommit: turn on active commit
docs/formatdomain.html.in | 25 +-
docs/schemas/domaincommon.rng | 35 +-
include/libvirt/libvirt.h.in | 12 +-
src/conf/domain_conf.c | 275 ++++++++-----
src/conf/domain_conf.h | 7 +-
src/conf/snapshot_conf.c | 56 +--
src/conf/snapshot_conf.h | 2 +-
src/libvirt.c | 55 ++-
src/libvirt_private.syms | 1 +
src/lxc/lxc_controller.c | 8 +-
src/lxc/lxc_driver.c | 8 +-
src/parallels/parallels_driver.c | 2 +-
src/qemu/qemu_command.c | 290 ++++++-------
src/qemu/qemu_conf.c | 88 ++--
src/qemu/qemu_domain.c | 22 +-
src/qemu/qemu_driver.c | 451 ++++++++++++---------
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_migration.c | 4 +-
src/qemu/qemu_process.c | 39 +-
src/security/security_selinux.c | 4 +-
src/vbox/vbox_tmpl.c | 6 +-
src/vmx/vmx.c | 2 +-
src/xenxs/xen_sxpr.c | 8 +-
src/xenxs/xen_xm.c | 4 +-
.../qemuxml2argv-disk-active-commit.xml | 37 ++
.../qemuxml2argv-disk-mirror-old.xml | 47 +++
.../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 9 +-
.../qemuxml2xmlout-disk-mirror-old-inactive.xml | 41 ++
.../qemuxml2xmlout-disk-mirror-old.xml | 52 +++
tests/qemuxml2xmltest.c | 2 +
tests/securityselinuxlabeltest.c | 6 +-
tools/virsh-domain.c | 57 ++-
tools/virsh.pod | 27 +-
33 files changed, 1072 insertions(+), 612 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old-inactive.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml
--
1.9.3
10 years, 5 months
[libvirt] [PATCH 0/4] catch bogus 'blockcommit --base=a --top=a'
by Eric Blake
This patch series was first hinted at here:
https://www.redhat.com/archives/libvir-list/2014-June/msg00589.html
It fixes a minor bug that has existed since blockcommit was first
added, where we had an off-by-one that caused us to generate
different error messages in some cases where a user was passing an
impossible request to blockcommit (basically, we tried to filter
bogus cases up front to give a nice message, but missed one case
that resulted in reporting a different message from qemu instead).
I apologize in advance for the conflicts this creates with Peter's
pending series, but think that the testsuite is both more legible
and more thorough with the changes added in this series. It's
split into several patches to make review easier.
And can I just add that it is annoying dealing with gcc's:
virstoragetest.c:1076:1: error: the frame size of 6608 bytes is larger than 4096 bytes [-Werror=frame-larger-than=]
(although I agree with the need for keeping that warning)
Eric Blake (4):
storage: add alias for less typing
storage: renumber lookup tests
storage: better tests of lookup
blockcommit: require base below top
src/qemu/qemu_driver.c | 3 +-
src/util/virstoragefile.c | 33 +++++----
tests/virstoragetest.c | 184 ++++++++++++++++++++++++++++------------------
3 files changed, 135 insertions(+), 85 deletions(-)
--
1.9.3
10 years, 5 months