[libvirt] [PATCH] cmdMigrate: move vshConnect before vshWatchJob
by Chunyan Liu
A possible fix to issue:
http://www.redhat.com/archives/libvir-list/2014-August/thread.html#00227
While doing migration on KVM host, found problem sometimes:
VM is already running on the target host and disappears from source
host, but 'virsh migrate' command line hangs, cannot exit normally.
If pressing "ENTER" key, it will exit.
The code hangs at tools/virsh-domain.c: cmdMigrate
->vshWatchJob->poll():
poll() is trying to select pipe_fd, which is used to receive message
from doMigrate thread. In debugging, found that doMigrate finishes
and at the end it does call safewrite() to write the retval ('0' or
'1') to pipe_fd, and the write is completed. But cmdMigrate poll()
cannot get the event. If pressing "ENTER" key, poll() can get the
event and select pipe_fd, then command line can exit.
In current code, authentication thread which is called by vshConnect
will use stdin, and at the same time, in cmdMigrate main process,
poll() is listening to stdin, that probably affect poll() to get
pipe_fd event. Better to move authentication before vshWatchJob. With
this change, above problem does not exist.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
tools/virsh-domain.c | 26 ++++++++++++++++++++------
tools/virsh.h | 1 +
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index f7193cb..2562326 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8965,6 +8965,7 @@ doMigrate(void *opaque)
virTypedParameterPtr params = NULL;
int nparams = 0;
int maxparams = 0;
+ virConnectPtr dconn = data->dconn;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
@@ -9079,18 +9080,12 @@ doMigrate(void *opaque)
ret = '0';
} else {
/* For traditional live migration, connect to the destination host directly. */
- virConnectPtr dconn = NULL;
virDomainPtr ddom = NULL;
- dconn = vshConnect(ctl, desturi, false);
- if (!dconn)
- goto out;
-
if ((ddom = virDomainMigrate3(dom, dconn, params, nparams, flags))) {
virDomainFree(ddom);
ret = '0';
}
- virConnectClose(dconn);
}
out:
@@ -9152,6 +9147,23 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
data.cmd = cmd;
data.writefd = p[1];
+ if (vshCommandOptBool(cmd, "p2p") || vshCommandOptBool(cmd, "direct")) {
+ data.dconn = NULL;
+ } else {
+ /* For traditional live migration, connect to the destination host. */
+ virConnectPtr dconn = NULL;
+ const char *desturi = NULL;
+
+ if (vshCommandOptStringReq(ctl, cmd, "desturi", &desturi) < 0)
+ goto cleanup;
+
+ dconn = vshConnect(ctl, desturi, false);
+ if (!dconn)
+ goto cleanup;
+
+ data.dconn = dconn;
+ }
+
if (virThreadCreate(&workerThread,
true,
doMigrate,
@@ -9163,6 +9175,8 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
virThreadJoin(&workerThread);
cleanup:
+ if (data.dconn)
+ virConnectClose(data.dconn);
virDomainFree(dom);
VIR_FORCE_CLOSE(p[0]);
VIR_FORCE_CLOSE(p[1]);
diff --git a/tools/virsh.h b/tools/virsh.h
index 7656407..b4df24b 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -371,6 +371,7 @@ struct _vshCtrlData {
vshControl *ctl;
const vshCmd *cmd;
int writefd;
+ virConnectPtr dconn;
};
/* error handling */
--
1.8.4.5
10 years, 3 months
[libvirt] Virtual box storage and network sub-drivers
by Michal Privoznik
Dear list,
Virtualbox driver has its own implementation of storage and network
sub-drivers. But as of commit ba5f3c7c8ecc1037e44904916989a1c65777a9d5
(contained in the 1.0.6 release) when the VBox moved from client to
daemon, the storage and network sub-drivers are indeed registered but in
fact never called. It's due to our virConnectOpen function where the
general network and storage drivers take precedence. So I guess my
question is: should we drop the VBox sub-drivers or perhaps fix the
virConnectOpen function?
Reported-by: Taowei Luo
Michal
10 years, 3 months
[libvirt] [PATCH 0/5] rework layout of src/xenxs directory
by Jim Fehlig
This series reworks the layout of src/xenxs directory, changing
it to src/xenconfig and moving common XM and XL config
parsing/formatting functions to src/xenconfig/xen_common.[ch].
Jim Fehlig (3):
xen: rename xenxs to xenconfig
src/xenconfig: remove dead code
src/xenconfig: move common parsing/formatting to xen_common
Kiarie Kahurani (2):
src/xenconfig: wrap common parsing code
src/xenconfig: wrap common formatting code
cfg.mk | 2 +-
configure.ac | 2 +-
po/POTFILES.in | 5 +-
src/Makefile.am | 39 +-
src/{libvirt_xenxs.syms => libvirt_xenconfig.syms} | 4 +-
src/{xenxs/xen_xm.c => xenconfig/xen_common.c} | 874 +++++++--------------
src/xenconfig/xen_common.h | 46 ++
src/{xenxs => xenconfig}/xen_sxpr.c | 2 +-
src/{xenxs => xenconfig}/xen_sxpr.h | 0
src/xenconfig/xen_xm.c | 421 ++++++++++
src/{xenxs => xenconfig}/xen_xm.h | 0
src/{xenxs => xenconfig}/xenxs_private.h | 0
tests/sexpr2xmltest.c | 2 +-
tests/xmconfigdata/test-escape-paths.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-force-hpet.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-force-nohpet.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-localtime.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-net-ioemu.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-net-netfront.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-new-cdrom.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-old-cdrom.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg | 2 +-
.../test-fullvirt-serial-dev-2-ports.cfg | 2 +-
.../test-fullvirt-serial-dev-2nd-port.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-file.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-null.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-pipe.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-pty.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-stdio.cfg | 2 +-
.../test-fullvirt-serial-tcp-telnet.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-tcp.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-udp.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-serial-unix.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-sound.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-usbmouse.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-usbtablet.cfg | 2 +-
tests/xmconfigdata/test-fullvirt-utc.cfg | 2 +-
tests/xmconfigdata/test-no-source-cdrom.cfg | 2 +-
tests/xmconfigdata/test-paravirt-net-e1000.cfg | 2 +-
tests/xmconfigdata/test-paravirt-net-vifname.cfg | 2 +-
.../test-paravirt-new-pvfb-vncdisplay.cfg | 2 +-
tests/xmconfigdata/test-paravirt-new-pvfb.cfg | 2 +-
.../test-paravirt-old-pvfb-vncdisplay.cfg | 2 +-
tests/xmconfigdata/test-paravirt-old-pvfb.cfg | 2 +-
tests/xmconfigdata/test-paravirt-vcpu.cfg | 2 +-
tests/xmconfigdata/test-pci-devs.cfg | 2 +-
tests/xmconfigtest.c | 2 +-
tests/xml2sexprtest.c | 2 +-
48 files changed, 796 insertions(+), 671 deletions(-)
rename src/{libvirt_xenxs.syms => libvirt_xenconfig.syms} (91%)
rename src/{xenxs/xen_xm.c => xenconfig/xen_common.c} (72%)
create mode 100644 src/xenconfig/xen_common.h
rename src/{xenxs => xenconfig}/xen_sxpr.c (99%)
rename src/{xenxs => xenconfig}/xen_sxpr.h (100%)
create mode 100644 src/xenconfig/xen_xm.c
rename src/{xenxs => xenconfig}/xen_xm.h (100%)
rename src/{xenxs => xenconfig}/xenxs_private.h (100%)
--
1.8.4.5
10 years, 3 months
[libvirt] [PATCH 0/5] Fix vcpu pinning info propagation on vcpu cold-unplug
by Peter Krempa
Remove the vcpupin info on cold cpuunplug. Also refactor a few unpleasant-to-look-at
functions found while looking for the problem.
Peter Krempa (5):
qemu: process: Remove unnecessary argument and rename function
conf: cpupin: Remove useless checking of vcpupin element count
conf: Refactor virDomainVcpuPinDefParseXML
qemu: cpu: unplug: Remove vcpu pinning on cold cpu unplug
qemu: process: Pin on per-vcpu basis instead of per-vcpupin element
src/conf/domain_conf.c | 64 +++++++++++++++++++++----------------------------
src/qemu/qemu_driver.c | 7 ++++++
src/qemu/qemu_process.c | 20 +++++++++-------
3 files changed, 46 insertions(+), 45 deletions(-)
--
2.0.2
10 years, 3 months
[libvirt] [PATCH] virsh: man: Crosslink "desc" and "metadata" sections
by Peter Krempa
Those two commands work with a single API so cross-link them.
---
tools/virsh.pod | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index d072a7f..da68c08 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -656,6 +656,7 @@ effect on the next boot.
Show or modify description and title of a domain. These values are user
fields that allow to store arbitrary textual data to allow easy
identification of domains. Title should be short, although it's not enforced.
+(See also B<metadata> that works with XML based domain metadata.)
Flags I<--live> or I<--config> select whether this command works on live
or persistent definitions of the domain. If both I<--live> and I<--config>
@@ -1261,7 +1262,8 @@ Show or modify custom XML metadata of a domain. The metadata is a user
defined XML that allows to store arbitrary XML data in the domain definition.
Multiple separate custom metadata pieces can be stored in the domain XML.
The pieces are identified by a private XML namespace provided via the
-I<uri> argument.
+I<uri> argument. (See also B<desc> that works with textual metadata of
+a domain.)
Flags I<--live> or I<--config> select whether this command works on live
or persistent definitions of the domain. If both I<--live> and I<--config>
--
2.0.2
10 years, 3 months
[libvirt] [PATCH] man: virsh: Add man page for "virsh metadata"
by Peter Krempa
Patch adding the command forgot to add the man page entry.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1130379
---
tools/virsh.pod | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f07deec..d072a7f 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1254,6 +1254,36 @@ I<--total> for only the total stats, I<start> for only the per-cpu
stats of the CPUs from I<start>, I<count> for only I<count> CPUs'
stats.
+=item B<metadata> I<domain> [[I<--live>] [I<--config>] | [I<--current>]]
+[I<--edit>] [I<uri>] [I<key>] [I<set>] [I<--remove>]
+
+Show or modify custom XML metadata of a domain. The metadata is a user
+defined XML that allows to store arbitrary XML data in the domain definition.
+Multiple separate custom metadata pieces can be stored in the domain XML.
+The pieces are identified by a private XML namespace provided via the
+I<uri> argument.
+
+Flags I<--live> or I<--config> select whether this command works on live
+or persistent definitions of the domain. If both I<--live> and I<--config>
+are specified, the I<--config> option takes precedence on getting the current
+description and both live configuration and config are updated while setting
+the description. I<--current> is exclusive and implied if none of these was
+specified.
+
+Flag I<--remove> specifies that the metadata element specified by the I<uri>
+argument should be removed rather than updated.
+
+Flag I<--edit> specifies that an editor with the metadata identified by the
+I<uri> argument should be opened and the contents saved back afterwards.
+Otherwise the new contents can be provided via the I<set> argument.
+
+When setting metadata via I<--edit> or I<set> the I<key> argument must be
+specified and is used to prefix the custom elements to bind them
+to the private namespace.
+
+If neither of I<--edit> and I<set> are specified the XML metadata corresponding
+to the I<uri> namespace is displayed instead of being modified.
+
=item B<migrate> [I<--live>] [I<--offline>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
[I<--persistent>] [I<--undefinesource>] [I<--suspend>] [I<--copy-storage-all>]
[I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
--
2.0.2
10 years, 3 months
[libvirt] [PATCH] man: virsh: Add 'vcpu_period' and 'vcpu_quota' support info for LXC
by Li Yang
Signed-off-by: Li Yang <liyang.fnst(a)cn.fujitsu.com>
---
tools/virsh.pod | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f07deec..a2d89b2 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1570,7 +1570,7 @@ I<domain>
Allows you to show (and set) the domain scheduler parameters. The parameters
available for each hypervisor are:
-LXC (posix scheduler) : cpu_shares
+LXC (posix scheduler) : cpu_shares, vcpu_period, vcpu_quota
QEMU/KVM (posix scheduler): cpu_shares, vcpu_period, vcpu_quota,
emulator_period, emulator_quota
--
1.7.1
10 years, 3 months
[libvirt] [libvirt-glib] [PATCH 0/4] Add some async versions of synchronous snapshot API
by Timm Bäder
This adds async versions of a few snapshot related functions and a patch that
cleans up some doc comments I crewed up in earlier commits. All the sync
versions don't seem cancellable to me since we can't just throw the
result away like we do when fetching snapshots in case the operation
gets cancelled, so none of them take a GCancellable.
Timm Bäder (4):
GVirDomain: Fix some doc comments of the snapshot API
GVirDomainSnapshot: Add async version of _revert_to
GVirDomain: Add async version of _create_snapshot
GVirDomainSnapshot: Add async version of _delete
libvirt-gobject/libvirt-gobject-domain-snapshot.c | 112 ++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain-snapshot.h | 19 ++++
libvirt-gobject/libvirt-gobject-domain.c | 77 ++++++++++++++-
libvirt-gobject/libvirt-gobject-domain.h | 11 +++
libvirt-gobject/libvirt-gobject.sym | 6 ++
5 files changed, 220 insertions(+), 5 deletions(-)
--
2.0.4
10 years, 3 months
[libvirt] [PATCHv3] qemu: Redundant listen address entry in quest xml
by Erik Skultety
When editing guest's XML (on QEMU), it was possible to add multiple
listen elements into graphics parent element. However QEMU does not
support listening on multiple addresses. Configuration is tested for
multiple 'listen address' and if positive, an error is raised.
---
src/qemu/qemu_process.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 52d9052..f3a6af5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3950,6 +3950,11 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
}
graphics->listens[0].fromConfig = true;
+ } else if (graphics->nListens > 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("QEMU does not support multiple listen "
+ "addresses for one graphics device."));
+ goto cleanup;
}
}
}
--
1.9.3
10 years, 3 months