[libvirt] [PATCH] Add hw random number generator (/dev/hwrng) to default qemu cgroup ACL
by Pradipta Kr. Banerjee
Creating a qemu VM with /dev/hwrng as backed RNG device throws the
following error - "Could not open '/dev/hwrng': Operation not permitted"
This patch fixes the issue
Signed-off-by: Pradipta Kr. Banerjee <bpradip(a)in.ibm.com>
---
src/qemu/qemu_cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index ace7e35..d9ebb30 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -39,7 +39,7 @@
static const char *const defaultDeviceACL[] = {
"/dev/null", "/dev/full", "/dev/zero",
- "/dev/random", "/dev/urandom",
+ "/dev/random", "/dev/urandom", "/dev/hwrng",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc", "/dev/hpet", "/dev/vfio/vfio",
NULL,
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH] build: silence a clang warning in virsh.c
by Ryota Ozaki
This patch shuts up the following warning of clang:
virsh.c:2761:22: error: assigning to 'char *' from 'const char [6]' discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
rl_readline_name = "virsh";
^ ~~~~~~~
Tested on Mac OS X 10.8.5 (clang-500.2.75) and
Fedora 19 (gcc 4.8.1).
Signed-off-by: Ryota Ozaki <ozaki.ryota(a)gmail.com>
---
tools/virsh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 241c5b8..f45ee0a 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2758,7 +2758,7 @@ vshReadlineInit(vshControl *ctl)
const char *histsize_str;
/* Allow conditional parsing of the ~/.inputrc file. */
- rl_readline_name = "virsh";
+ rl_readline_name = (char *) "virsh";
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = vshReadlineCompletion;
--
1.8.4
11 years, 1 month
[libvirt] [PATCH] Properly unref a connection with a close callback
by Ján Tomko
The connection pointer in the closeCallback data was never
initialized, making the unref in remoteClientCloseFunc a no-op.
This fixes the following leak in virsh when the daemon closes
the connection unexpectedly:
1,179 (288 direct, 891 indirect) bytes in 1 blocks are
definitely lost in loss record 745 of 792
at 0x4C2A6D0: calloc (in vgpreload_memcheck-amd64-linux.so)
by 0x4E9643D: virAllocVar (viralloc.c:558)
by 0x4ED2425: virObjectNew (virobject.c:190)
by 0x4F675AC: virGetConnect (datatypes.c:116)
by 0x4F6EA06: do_open (libvirt.c:1136)
by 0x4F71017: virConnectOpenAuth (libvirt.c:1481)
by 0x129FFA: vshReconnect (virsh.c:337)
by 0x128310: main (virsh.c:2470)
---
src/libvirt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libvirt.c b/src/libvirt.c
index 90608ab..4beb40a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -21452,6 +21452,7 @@ int virConnectRegisterCloseCallback(virConnectPtr conn,
goto error;
}
+ conn->closeCallback->conn = conn;
conn->closeCallback->callback = cb;
conn->closeCallback->opaque = opaque;
conn->closeCallback->freeCallback = freecb;
--
1.8.3.2
11 years, 1 month
[libvirt] [PATCH] Fix migration with QEMU 1.6
by Michael Avdienko
QEMU 1.6.0 introduced new migration status: setup
Libvirt does not expect such string in QMP and refuses to migrate with error
"unexpected migration status in setup"
This patch fixes it.
Sorry for previous bad try.
Unfortunately I have seen Serge Hallyn's patch too late.
Now I think it's better to include following code into my patch:
if (setting_up) {
priv->job.info.fileTotal = -1;
priv->job.info.fileRemaining = -1;
priv->job.info.fileProcessed = 0;
priv->job.info.memTotal = -1;
priv->job.info.memRemaining = -1;
priv->job.info.memProcessed = 0;
priv->job.info.dataTotal = -1;
priv->job.info.dataRemaining = -1;
priv->job.info.dataProcessed = 0;
}
But I'm not sure if my patch is good enough.
If it is then I will include aforementioned code in it.
---
src/qemu/qemu_migration.c | 4 ++++
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor.h | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a3d986f..4b5fdba 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1644,6 +1644,10 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
_("%s: %s"), job, _("is not active"));
break;
+ case QEMU_MONITOR_MIGRATION_STATUS_SETUP:
+ ret = 0;
+ break;
+
case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE:
priv->job.info.fileTotal = priv->job.status.disk_total;
priv->job.info.fileRemaining = priv->job.status.disk_remaining;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 30315b3..0d4598e 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -114,7 +114,7 @@ VIR_ONCE_GLOBAL_INIT(qemuMonitor)
VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
QEMU_MONITOR_MIGRATION_STATUS_LAST,
- "inactive", "active", "completed", "failed", "cancelled")
+ "inactive", "active", "completed", "failed", "cancelled", "setup")
VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
QEMU_MONITOR_MIGRATION_CAPS_LAST,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index f893b1f..eabf000 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -397,6 +397,7 @@ enum {
QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
QEMU_MONITOR_MIGRATION_STATUS_ERROR,
QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,
+ QEMU_MONITOR_MIGRATION_STATUS_SETUP,
QEMU_MONITOR_MIGRATION_STATUS_LAST
};
--
1.7.10.4
11 years, 1 month
[libvirt] [PATCH] conf/interface_conf.c: allow "yes" and "no" for STP
by Martin Wilck
The error message "XML error: bridge stp shold be on or off got yes"
is displayed after configuring a bridge interface with NetworkManager
(Fedora 19).
Reported as: https://bugzilla.redhat.com/show_bug.cgi?id=1031053
Problem description from BZ:
Steps to Reproduce:
1. create bridge configuration with NetworkManager
2. run virt-manager and open "Network Interfaces" tab in localhost
connection details, or run virt-install
Actual results:
"XML error: bridge stp shold be on or off got yes"
Expected results:
No error message
Additional info:
NM puts "yes" or "no" in the ifcfg file depending on the user STP setting:
# grep STP /etc/sysconfig/network-scripts/ifcfg-br0
STP=no
the brctl tool accepts both "on"/"off" and "yes"/"no". But libvirt handles only "on" and "off".
---
src/conf/interface_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 7ca9c86..f13fef9 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -741,9 +741,9 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
tmp = virXMLPropString(bridge, "stp");
def->data.bridge.stp = -1;
if (tmp != NULL) {
- if (STREQ(tmp, "on")) {
+ if (STREQ(tmp, "on") || STREQ(tmp, "yes")) {
def->data.bridge.stp = 1;
- } else if (STREQ(tmp, "off")) {
+ } else if (STREQ(tmp, "off") || STREQ(tmp, "no")) {
def->data.bridge.stp = 0;
} else {
virReportError(VIR_ERR_XML_ERROR,
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH] RBD Support via storage pool in domain XML
by Adam Walters
The following patch adds support for RBD devices to be specified in the domain XML via storage pools. This allows centralization of Ceph configuration in the storage pool definition.
The code written could be copied fairly easily to support additional network disks, but I lack the environment in which to test such changes. Most notably, I found it necessary to set the ac
cess mode for the volume to be direct. Without that change, QEMU would bork on setting up cgroup access for the RBD path (which does not exist on the host physically). Beyond that, the code
should be pretty clean, being a modified copy of the iSCSI storage volume code.
Adam Walters (1):
Implementing RBD support for QEMU via Storage API (Storage pools)
src/qemu/qemu_command.c | 11 ++++++---
src/qemu/qemu_conf.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 71 insertions(+), 6 deletions(-)
--
1.8.4.2
11 years, 1 month
[libvirt] [PATCH] LXC: do setxid before lxc controller creates fuse thread
by Gao feng
I met a problem that container blocked by seteuid/setegid
which is call in lxcContainerSetID on UP system and libvirt
compiled with --with-fuse=yes.
I looked into the glibc's codes, and found setxid in glibc
calls futex() to wait for other threads to change their
setxid_futex to 0(see setxid_mark_thread in glibc).
since the process created by clone system call will not
share the memory with the other threads and the context
of memory doesn't changed until we call execl.(COW)
So if the process which created by clone is called before
fuse thread being stated, the new setxid_futex of fuse
thread will not be saw in this process, it will be blocked
forever.
This patch makes sure the cloned process calls setxid first,
and then the lxc controller creates fuse thread.
Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 29 +++++++++++++++--------------
src/lxc/lxc_controller.c | 10 +++++++++-
src/lxc/lxc_fuse.c | 21 +++++++++++++++------
src/lxc/lxc_fuse.h | 1 +
4 files changed, 40 insertions(+), 21 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c000a82..27bdcc0 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1844,9 +1844,24 @@ static int lxcContainerChild(void *data)
cmd = lxcContainerBuildInitCmd(vmDef);
virCommandWriteArgLog(cmd, 1);
+ /* call setxid before libvirt controller creates fuse thread. */
if (lxcContainerSetID(vmDef) < 0)
goto cleanup;
+ /* rename and enable interfaces */
+ if (lxcContainerRenameAndEnableInterfaces(!!(vmDef->features &
+ (1 << VIR_DOMAIN_FEATURE_PRIVNET)),
+ argv->nveths,
+ argv->veths) < 0) {
+ goto cleanup;
+ }
+
+ if (lxcContainerSendContinue(argv->handshakefd) < 0) {
+ virReportSystemError(errno, "%s",
+ _("Failed to send continue signal to controller"));
+ goto cleanup;
+ }
+
root = virDomainGetRootFilesystem(vmDef);
if (argv->nttyPaths) {
@@ -1886,24 +1901,10 @@ static int lxcContainerChild(void *data)
goto cleanup;
}
- /* rename and enable interfaces */
- if (lxcContainerRenameAndEnableInterfaces(!!(vmDef->features &
- (1 << VIR_DOMAIN_FEATURE_PRIVNET)),
- argv->nveths,
- argv->veths) < 0) {
- goto cleanup;
- }
-
/* drop a set of root capabilities */
if (lxcContainerDropCapabilities(!!hasReboot) < 0)
goto cleanup;
- if (lxcContainerSendContinue(argv->handshakefd) < 0) {
- virReportSystemError(errno, "%s",
- _("Failed to send continue signal to controller"));
- goto cleanup;
- }
-
VIR_DEBUG("Setting up security labeling");
if (virSecurityManagerSetProcessLabel(argv->securityDriver, vmDef) < 0)
goto cleanup;
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c8f68c0..5d1ec49 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1981,6 +1981,12 @@ virLXCControllerSetupFuse(virLXCControllerPtr ctrl)
}
static int
+virLXCControllerStartFuse(virLXCControllerPtr ctrl)
+{
+ return lxcStartFuse(ctrl->fuse);
+}
+
+static int
virLXCControllerSetupConsoles(virLXCControllerPtr ctrl,
char **containerTTYPaths)
{
@@ -2197,7 +2203,9 @@ virLXCControllerRun(virLXCControllerPtr ctrl)
goto cleanup;
}
- /* Now the container is fully setup... */
+ /* container has already called setxid, we can create thread now.*/
+ if (virLXCControllerStartFuse(ctrl) < 0)
+ goto cleanup;
/* ...and reduce our privileges */
if (lxcControllerClearCapabilities() < 0)
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index 9d12832..88e122e 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -322,12 +322,6 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def)
goto cleanup1;
}
- if (virThreadCreate(&fuse->thread, false, lxcFuseRun,
- (void *)fuse) < 0) {
- lxcFuseDestroy(fuse);
- goto cleanup1;
- }
-
ret = 0;
cleanup:
fuse_opt_free_args(&args);
@@ -341,6 +335,17 @@ cleanup2:
goto cleanup;
}
+int lxcStartFuse(virLXCFusePtr fuse)
+{
+ if (virThreadCreate(&fuse->thread, false, lxcFuseRun,
+ (void *)fuse) < 0) {
+ lxcFuseDestroy(fuse);
+ return -1;
+ }
+
+ return 0;
+}
+
void lxcFreeFuse(virLXCFusePtr *f)
{
virLXCFusePtr fuse = *f;
@@ -364,6 +369,10 @@ int lxcSetupFuse(virLXCFusePtr *f ATTRIBUTE_UNUSED,
return 0;
}
+int lxcStartFuse(virLXCFusePtr f ATTRIBUTE_UNUSED)
+{
+}
+
void lxcFreeFuse(virLXCFusePtr *f ATTRIBUTE_UNUSED)
{
}
diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h
index b3713af..d60492b 100644
--- a/src/lxc/lxc_fuse.h
+++ b/src/lxc/lxc_fuse.h
@@ -58,6 +58,7 @@ struct virLXCFuse {
typedef struct virLXCFuse *virLXCFusePtr;
extern int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def);
+extern int lxcStartFuse(virLXCFusePtr f);
extern void lxcFreeFuse(virLXCFusePtr *f);
#endif /* LXC_FUSE_H */
--
1.8.3.1
11 years, 1 month
[libvirt] [PATCH v2] virsh domxml-from-native to treat SCSI as the bus type for pseries by default
by Shivaprasad G Bhat
The bus type IDE being enum Zero, the bus type on pseries system appears as IDE for all the disk types. Pseries platform needs this to appear as SCSI instead of IDE.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
---
src/qemu/qemu_domain.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b8aec2d..df06c13 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -827,6 +827,12 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
virDomainDiskDefPtr disk = dev->data.disk;
+ if ((def->os.arch == VIR_ARCH_PPC64) &&
+ def->os.machine && STREQ(def->os.machine, "pseries") &&
+ (disk->bus == VIR_DOMAIN_DISK_BUS_IDE)) {
+ disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
+ }
+
/* both of these require data from the driver config */
if (driver && (cfg = virQEMUDriverGetConfig(driver))) {
/* assign default storage format and driver according to config */
@@ -868,6 +874,11 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
(def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X))
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
+ if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
+ dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_IDE &&
+ def->os.machine && STREQ(def->os.machine, "pseries"))
+ dev->data.controller->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
+
/* set the default USB model to none for s390 unless an address is found */
if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
11 years, 1 month
[libvirt] [PATCH not-for-inclusion] accomodate new qemu migration status 'setup'
by Serge Hallyn
Hi,
newer qemu introduces a new migration state 'setup', which libvirt does
not yet know about. This upsets our qa-regression-tests :) I know
Eric is working on a fix but is short on time, so I thought I would send
the patch that is working for me. I don't expect it to be a proper fix,
as I suspect the proper fix should actually add a new migration state in
libvirt itself. But it appears to be working.
This patch treats the new setup state as as active, but doesn't try to
query for status info yet.
Signed-off-by: Serge Hallyn <serge.hallyn(a)ubuntu.com>
---
src/qemu/qemu_migration.c | 48 ++++++++++++++++++++++++++++----------------
src/qemu/qemu_monitor.c | 8 +++++---
src/qemu/qemu_monitor.h | 3 ++-
src/qemu/qemu_monitor_json.c | 8 +++++++-
src/qemu/qemu_monitor_text.c | 9 ++++++++-
5 files changed, 53 insertions(+), 23 deletions(-)
Index: libvirt-1.1.4/src/qemu/qemu_migration.c
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_migration.c 2013-11-13 20:47:05.100085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_migration.c 2013-11-13 20:47:05.092085000 +0100
@@ -1614,7 +1614,7 @@
enum qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- int ret;
+ int ret, setting_up;
qemuMonitorMigrationStatus status;
memset(&status, 0, sizeof(status));
@@ -1624,7 +1624,7 @@
/* Guest already exited; nothing further to update. */
return -1;
}
- ret = qemuMonitorGetMigrationStatus(priv->mon, &status);
+ ret = qemuMonitorGetMigrationStatus(priv->mon, &status, &setting_up);
qemuDomainObjExitMonitor(driver, vm);
@@ -1645,21 +1645,35 @@
break;
case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE:
- priv->job.info.fileTotal = priv->job.status.disk_total;
- priv->job.info.fileRemaining = priv->job.status.disk_remaining;
- priv->job.info.fileProcessed = priv->job.status.disk_transferred;
-
- priv->job.info.memTotal = priv->job.status.ram_total;
- priv->job.info.memRemaining = priv->job.status.ram_remaining;
- priv->job.info.memProcessed = priv->job.status.ram_transferred;
-
- priv->job.info.dataTotal =
- priv->job.status.ram_total + priv->job.status.disk_total;
- priv->job.info.dataRemaining =
- priv->job.status.ram_remaining + priv->job.status.disk_remaining;
- priv->job.info.dataProcessed =
- priv->job.status.ram_transferred +
- priv->job.status.disk_transferred;
+ if (setting_up) {
+ priv->job.info.fileTotal = -1;
+ priv->job.info.fileRemaining = -1;
+ priv->job.info.fileProcessed = 0;
+
+ priv->job.info.memTotal = -1;
+ priv->job.info.memRemaining = -1;
+ priv->job.info.memProcessed = 0;
+
+ priv->job.info.dataTotal = -1;
+ priv->job.info.dataRemaining = -1;
+ priv->job.info.dataProcessed = 0;
+ } else {
+ priv->job.info.fileTotal = priv->job.status.disk_total;
+ priv->job.info.fileRemaining = priv->job.status.disk_remaining;
+ priv->job.info.fileProcessed = priv->job.status.disk_transferred;
+
+ priv->job.info.memTotal = priv->job.status.ram_total;
+ priv->job.info.memRemaining = priv->job.status.ram_remaining;
+ priv->job.info.memProcessed = priv->job.status.ram_transferred;
+
+ priv->job.info.dataTotal =
+ priv->job.status.ram_total + priv->job.status.disk_total;
+ priv->job.info.dataRemaining =
+ priv->job.status.ram_remaining + priv->job.status.disk_remaining;
+ priv->job.info.dataProcessed =
+ priv->job.status.ram_transferred +
+ priv->job.status.disk_transferred;
+ }
ret = 0;
break;
Index: libvirt-1.1.4/src/qemu/qemu_monitor.c
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_monitor.c 2013-11-13 20:47:05.100085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_monitor.c 2013-11-13 20:57:06.932085000 +0100
@@ -2087,7 +2087,8 @@
int qemuMonitorGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status)
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up)
{
int ret;
VIR_DEBUG("mon=%p", mon);
@@ -2098,10 +2099,11 @@
return -1;
}
+ *setting_up = 0;
if (mon->json)
- ret = qemuMonitorJSONGetMigrationStatus(mon, status);
+ ret = qemuMonitorJSONGetMigrationStatus(mon, status, setting_up);
else
- ret = qemuMonitorTextGetMigrationStatus(mon, status);
+ ret = qemuMonitorTextGetMigrationStatus(mon, status, setting_up);
return ret;
}
Index: libvirt-1.1.4/src/qemu/qemu_monitor.h
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_monitor.h 2013-11-13 20:47:05.100085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_monitor.h 2013-11-13 20:47:05.096085000 +0100
@@ -432,7 +432,8 @@
};
int qemuMonitorGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status);
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up);
int qemuMonitorGetSpiceMigrationStatus(qemuMonitorPtr mon,
bool *spice_migrated);
Index: libvirt-1.1.4/src/qemu/qemu_monitor_json.c
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_monitor_json.c 2013-11-13 20:47:05.100085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_monitor_json.c 2013-11-13 21:02:16.492085000 +0100
@@ -2351,7 +2351,8 @@
static int
qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
- qemuMonitorMigrationStatusPtr status)
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up)
{
virJSONValuePtr ret;
const char *statusstr;
@@ -2369,6 +2370,11 @@
return -1;
}
+ if (strncmp(statusstr, "setup", 5) == 0) {
+ status->status = QEMU_MONITOR_MIGRATION_STATUS_ACTIVE;
+ *setting_up = 1;
+ return 0;
+ }
status->status = qemuMonitorMigrationStatusTypeFromString(statusstr);
if (status->status < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -2509,7 +2515,8 @@
int qemuMonitorJSONGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status)
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up)
{
int ret;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-migrate",
@@ -2527,7 +2534,7 @@
ret = qemuMonitorJSONCheckError(cmd, reply);
if (ret == 0 &&
- qemuMonitorJSONGetMigrationStatusReply(reply, status) < 0)
+ qemuMonitorJSONGetMigrationStatusReply(reply, status, &setting_up) < 0)
ret = -1;
if (ret < 0)
Index: libvirt-1.1.4/src/qemu/qemu_monitor_text.c
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_monitor_text.c 2013-11-13 20:47:05.100085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_monitor_text.c 2013-11-13 20:47:05.096085000 +0100
@@ -1419,7 +1419,8 @@
#define MIGRATION_DISK_TOTAL_PREFIX "total disk: "
int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status)
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up)
{
char *reply;
char *tmp;
@@ -1441,6 +1442,12 @@
}
*end = '\0';
+ if (strncmp(tmp, "setup", 5) == 0) {
+ status->status = QEMU_MONITOR_MIGRATION_STATUS_ACTIVE;
+ *setting_up = 1;
+ goto done;
+ }
+
status->status = qemuMonitorMigrationStatusTypeFromString(tmp);
if (status->status < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
Index: libvirt-1.1.4/tests/qemumonitorjsontest.c
===================================================================
--- libvirt-1.1.4.orig/tests/qemumonitorjsontest.c 2013-10-18 23:15:06.000000000 +0200
+++ libvirt-1.1.4/tests/qemumonitorjsontest.c 2013-11-13 20:58:46.348085000 +0100
@@ -1660,7 +1660,7 @@
{
virDomainXMLOptionPtr xmlopt = (virDomainXMLOptionPtr)data;
qemuMonitorTestPtr test = qemuMonitorTestNewSimple(true, xmlopt);
- int ret = -1;
+ int ret = -1, setting_up;
qemuMonitorMigrationStatus status, expectedStatus;
if (!test)
@@ -1689,7 +1689,7 @@
"}") < 0)
goto cleanup;
- if (qemuMonitorJSONGetMigrationStatus(qemuMonitorTestGetMonitor(test), &status) < 0)
+ if (qemuMonitorJSONGetMigrationStatus(qemuMonitorTestGetMonitor(test), &status, &setting_up) < 0)
goto cleanup;
if (memcmp(&status, &expectedStatus, sizeof(status)) != 0) {
Index: libvirt-1.1.4/src/qemu/qemu_monitor_json.h
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_monitor_json.h 2013-11-13 21:00:07.052085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_monitor_json.h 2013-11-13 21:00:42.028085000 +0100
@@ -130,7 +130,8 @@
unsigned long long cacheSize);
int qemuMonitorJSONGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status);
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up);
int qemuMonitorJSONGetMigrationCapability(qemuMonitorPtr mon,
qemuMonitorMigrationCaps capability);
Index: libvirt-1.1.4/src/qemu/qemu_monitor_text.h
===================================================================
--- libvirt-1.1.4.orig/src/qemu/qemu_monitor_text.h 2013-11-13 21:00:15.432085000 +0100
+++ libvirt-1.1.4/src/qemu/qemu_monitor_text.h 2013-11-13 21:01:00.124085000 +0100
@@ -117,7 +117,8 @@
unsigned long long downtime);
int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
- qemuMonitorMigrationStatusPtr status);
+ qemuMonitorMigrationStatusPtr status,
+ int *setting_up);
int qemuMonitorTextMigrate(qemuMonitorPtr mon,
unsigned int flags,
11 years, 1 month