[libvirt] [PATCH] examples: Fix balloon event callback
by Jiri Denemark
---
examples/domain-events/events-python/event-test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index 3fb046e..3095e94 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -490,7 +490,7 @@ def myDomainEventPMWakeupCallback(conn, dom, reason, opaque):
def myDomainEventPMSuspendCallback(conn, dom, reason, opaque):
print "myDomainEventPMSuspendCallback: Domain %s(%s) system pmsuspend" % (
dom.name(), dom.ID())
-def myDomainEventBalloonChangeCallback(conn, dom, utcoffset, actual):
+def myDomainEventBalloonChangeCallback(conn, dom, actual, opaque):
print "myDomainEventBalloonChangeCallback: Domain %s(%s) %d" % (dom.name(), dom.ID(), actual)
def myDomainEventPMSuspendDiskCallback(conn, dom, reason, opaque):
print "myDomainEventPMSuspendDiskCallback: Domain %s(%s) system pmsuspend_disk" % (
--
1.8.0
12 years
[libvirt] [PATCHv4 0/2] DHCPv6; put dnsmasq parameters in conf-file
by Gene Czarcinski
Updated based on Laine Stump review and rebased 6 December 2012
Note to Laine: I "ignored" one of your comments involving moving
the order of some dnsmasq parameters in the spirit of "what is done is done."
Changing that would have required more changes to test files as well as
the conf-file patch file.
These two patch files are packaged together because they serially
depend on each other.
The DHCPv6 support checks dnsmasq's version and requires a minimum of 2.64.
Also, using dnsmasq for providing the RA service is checked against the
dnsmasq version and is currently 2.64. There are separate checks for DHCPv6
and Router Advertising support by dnsmasq.
Dnsmasq version 2.64 final is not released and staged for both Fedora 18 and
Fedora 17.
As with IPv4, IPv6 DHCP is only one subnetwork on an interface. Additionally,
if other IPv6 addresses are defined, a warning message is issued since
the Router Advertisement service will support only state-full (DHCP) or
state-less (SLAAC) addressing on a network interface (not both). Thus, the
additional subnetworks will need to be manually configured to properly function.
If dnsmasq provides the RA service, it also points to itself as a RDNSS
(Recursive DNS Server) as part of the information is supplies.
If IPv6 DHCP is not being run, then SLAAC addressing is supported for
any IPv6 addresses specified.
Gene Czarcinski (2):
v8.3 add support for DHCPv6
v8.0: put dnsmasq parameters into conf-file
docs/formatnetwork.html.in | 108 +++-
docs/schemas/network.rng | 12 +-
src/conf/network_conf.c | 96 ++--
src/network/bridge_driver.c | 556 ++++++++++++++-------
src/network/bridge_driver.h | 13 +-
src/util/dnsmasq.c | 29 +-
src/util/dnsmasq.h | 17 +-
tests/networkxml2argvdata/dhcp6-nat-network.conf | 19 +
tests/networkxml2argvdata/dhcp6-nat-network.xml | 24 +
tests/networkxml2argvdata/dhcp6-network.conf | 19 +
tests/networkxml2argvdata/dhcp6-network.xml | 14 +
.../dhcp6host-routed-network.conf | 17 +
.../dhcp6host-routed-network.xml | 19 +
tests/networkxml2argvdata/isolated-network.argv | 10 -
tests/networkxml2argvdata/isolated-network.conf | 20 +
.../networkxml2argvdata/nat-network-dns-hosts.argv | 5 -
.../networkxml2argvdata/nat-network-dns-hosts.conf | 14 +
.../nat-network-dns-srv-record-minimal.argv | 16 -
.../nat-network-dns-srv-record-minimal.conf | 23 +
.../nat-network-dns-srv-record.argv | 11 -
.../nat-network-dns-srv-record.conf | 18 +
.../nat-network-dns-txt-record.argv | 9 -
.../nat-network-dns-txt-record.conf | 18 +
tests/networkxml2argvdata/nat-network.argv | 8 -
tests/networkxml2argvdata/nat-network.conf | 19 +
tests/networkxml2argvdata/netboot-network.argv | 10 -
tests/networkxml2argvdata/netboot-network.conf | 23 +
.../networkxml2argvdata/netboot-proxy-network.argv | 10 -
.../networkxml2argvdata/netboot-proxy-network.conf | 21 +
tests/networkxml2argvdata/routed-network.argv | 4 -
tests/networkxml2argvdata/routed-network.conf | 12 +
tests/networkxml2argvtest.c | 49 +-
32 files changed, 865 insertions(+), 378 deletions(-)
create mode 100644 tests/networkxml2argvdata/dhcp6-nat-network.conf
create mode 100644 tests/networkxml2argvdata/dhcp6-nat-network.xml
create mode 100644 tests/networkxml2argvdata/dhcp6-network.conf
create mode 100644 tests/networkxml2argvdata/dhcp6-network.xml
create mode 100644 tests/networkxml2argvdata/dhcp6host-routed-network.conf
create mode 100644 tests/networkxml2argvdata/dhcp6host-routed-network.xml
delete mode 100644 tests/networkxml2argvdata/isolated-network.argv
create mode 100644 tests/networkxml2argvdata/isolated-network.conf
delete mode 100644 tests/networkxml2argvdata/nat-network-dns-hosts.argv
create mode 100644 tests/networkxml2argvdata/nat-network-dns-hosts.conf
delete mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.conf
delete mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv
create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.conf
delete mode 100644 tests/networkxml2argvdata/nat-network-dns-txt-record.argv
create mode 100644 tests/networkxml2argvdata/nat-network-dns-txt-record.conf
delete mode 100644 tests/networkxml2argvdata/nat-network.argv
create mode 100644 tests/networkxml2argvdata/nat-network.conf
delete mode 100644 tests/networkxml2argvdata/netboot-network.argv
create mode 100644 tests/networkxml2argvdata/netboot-network.conf
delete mode 100644 tests/networkxml2argvdata/netboot-proxy-network.argv
create mode 100644 tests/networkxml2argvdata/netboot-proxy-network.conf
delete mode 100644 tests/networkxml2argvdata/routed-network.argv
create mode 100644 tests/networkxml2argvdata/routed-network.conf
--
1.7.11.7
12 years
[libvirt] [PATCHv4 00/17] new VIR_(APPEND|INSERT|DELETE)_ELEMENT macros
by Laine Stump
DO NOT BE SCARED OFF BY THE PATCH COUNT!! Most of these are very
short, and they all follow the same pattern; beyond that, 01/17 and
02/17 are the only ones that I really want to push now; the others are
so far only for informational purposes (although you can apply them
locally if you want :-)
The first patch in this series adds new macros to insert/append/delete
elements from the arrays of variously-sized structs that are commonly
used in libvirt. The intent is to eliminate the arithmetic mistakes
associated with calling memmove() directly, and shorten application
code. A full description of the added macros and their functions is
included in 01/17.
Patches 02..17 convert various bits of hand-coded array manipulation
in libvirt to use the new macros. They can be taken now, later, or
never (although I'd like to have at least 02/17 taken now, since other
similar functions will be added in an upcoming patch series, and I
want them to all use the same logic). Mostly I went through all of
those conversions to see just how useful/usable the new macros were
(and they led to a couple of rewrites).
Changes from V3 - fixed things in 01/17 according to Eric's comments
on V3 (including changing from passing &newelem to passing newelem,
which we separately discussed on IRC). 02-17 just have their calling
sequences adjusted to replace all "&item" with "item" to account for
the change.
I will be (re)posting another series momentarily that has a dependency on
01/17.
Laine Stump (17):
util: add VIR_(APPEND|INSERT|DELETE)_ELEMENT
conf: use VIR_(INSERT|DELETE)_ELEMENT in virNetworkUpdate backend
conf: use VIR_DELETE_ELEMENT for conf object lists
conf: use VIR_(APPEND|DELETE)_ELEMENT for domain device lists
conf: use VIR_(APPEND|DELETE)_ELEMENT for domain event lists
conf: use VIR_(APPEND|DELETE)_ELEMENT for vcpupin list
xen: Use VIR_DELETE_ELEMENT for disk/net devices
xen: use VIR_DELETE_ELEMENT for xen domain and watch lists
util: use VIR_(APPEND|DELETE)_ELEMENT for pci/usb device lists
util: use VIR_(APPEND|DELETE)_ELEMENT for win32 waiting events list
rpc: use VIR_DELETE_ELEMENT for list of netclient streams
rpc: use VIR_(APPEND|DELETE)_ELEMENT for netserver client lists
test: use VIR_(APPEND|DELETE)_ELEMENT for qemuMonitorTest list
nwfilter: use VIR_(APPEND|DELETE)_ELEMENT for lists
util: eliminate leak in ebtables
util: use VIR_(APPEND|DELETE)_ELEMENT for ebtables rule lists
util: use VIR_(APPEND|DELETE)_ELEMENT for lock owners lists
cfg.mk | 2 +-
src/conf/domain_conf.c | 152 ++++++------------------------
src/conf/domain_conf.h | 12 +--
src/conf/domain_event.c | 51 ++--------
src/conf/interface_conf.c | 13 +--
src/conf/interface_conf.h | 4 +-
src/conf/network_conf.c | 102 +++++---------------
src/conf/network_conf.h | 6 +-
src/conf/node_device_conf.c | 11 +--
src/conf/node_device_conf.h | 4 +-
src/conf/nwfilter_conf.c | 46 +++------
src/conf/nwfilter_conf.h | 8 +-
src/conf/nwfilter_params.c | 8 +-
src/conf/storage_conf.c | 11 +--
src/conf/storage_conf.h | 4 +-
src/libvirt_private.syms | 2 +
src/nwfilter/nwfilter_gentech_driver.c | 15 ++-
src/parallels/parallels_storage.c | 14 +--
src/qemu/qemu_cgroup.c | 2 +-
src/qemu/qemu_cgroup.h | 2 +-
src/qemu/qemu_domain.c | 6 +-
src/qemu/qemu_driver.c | 4 +-
src/rpc/virnetclient.c | 21 +----
src/rpc/virnetserver.c | 14 +--
src/storage/storage_backend_rbd.c | 2 +-
src/storage/storage_driver.c | 12 +--
src/test/test_driver.c | 14 +--
src/util/ebtables.c | 29 ++----
src/util/ebtables.h | 4 +-
src/util/hostusb.c | 26 ++---
src/util/memory.c | 106 ++++++++++++++++++++-
src/util/memory.h | 167 ++++++++++++++++++++++++++++++++-
src/util/pci.c | 18 +---
src/util/threads-win32.c | 15 +--
src/util/virlockspace.c | 20 +---
src/xen/xen_driver.c | 14 +--
src/xen/xen_driver.h | 4 +-
src/xen/xen_inotify.c | 16 +---
src/xen/xm_internal.c | 14 +--
src/xen/xs_internal.c | 13 +--
src/xen/xs_internal.h | 2 +-
tests/qemumonitortestutils.c | 23 +----
42 files changed, 437 insertions(+), 576 deletions(-)
--
1.7.11.7
12 years
[libvirt] [PATCHv2 0/7] refactoring network xml parsing + net-update additions
by Laine Stump
Patches 1,2, and 4-7 refactor the network XML parsing functions to
have a more uniform calling sequence for different subelements of
<network>. This makes it simpler to write new virNetworkUpdate*()
backend functions for those bits (because they're then more similar to
existing functions.)
Patch 3 actually adds some new backends for updating subelements that
weren't previously implemented - <dns> host/srv/txt records.
The intent is to followup on patched 4-7 with backends for updating
<ip>, <forward>, and <bridge>; while I haven't gotten to those yet,
I'd rather get these changes in sooner than later, both for more
testing, and to make future backports simpler.
Difference from V1: simply rebased and modified for change in calling
sequence of VIR_INSERT_ELEMENT. No other changes.
Laine Stump (7):
conf: rename network dns host/srv/txt arrays
conf: clear and parse functions for dns host/srv/txt records
network: backend functions for updating network dns host/srv/txt
conf: rename some labels and functions in network_conf
conf: make virNetworkIpDefClear consistent with other functions
conf: put data for network <forward> element into its own struct
conf: split <forward> parser/clear into separate functions
src/conf/network_conf.c | 1382 ++++++++++++++++++++++++++----------------
src/conf/network_conf.h | 74 ++-
src/esx/esx_network_driver.c | 30 +-
src/network/bridge_driver.c | 283 +++++----
src/vbox/vbox_tmpl.c | 4 +-
5 files changed, 1056 insertions(+), 717 deletions(-)
--
1.7.11.7
12 years
[libvirt] [PATCH v4 00/13] parallels: implement operations with hard disks
by Dmitry Guryanov
This patch series adds ability to list existing disk images,
create a new ones and add or remove hard disk devices to the VM.
Changes in v2:
rebased to current sources
Changes in v3:
fixed errors in make syntax-check
Changes in v4:
fixed rebase errors
Dmitry Guryanov (13):
parallels: add info about hard disk devices
parallels: handle disk devices in parallelsDomainDefineXML
parallels: split parallelsStorageOpen function
parallels: remove unused code from storage driver
parallels: create storage pools by VM list
parallels: fix leaks in parallelsFindVolumes
parallels: add info about volumes
parallels: fill volumes capacity parameter
parallels: split parallelsStorageVolumeDelete function
parallels: add function parallelsGetDiskBusName
parallels: add support of disks creation
parallels: apply config after VM creation
parallels: add support of removing disks
src/parallels/parallels_driver.c | 346 +++++++++++++++++++++++++--
src/parallels/parallels_storage.c | 479 +++++++++++++++++++++++++++++++------
src/parallels/parallels_utils.h | 3 +
3 files changed, 731 insertions(+), 97 deletions(-)
--
1.7.7.6
12 years
[libvirt] [PATCH 0/4] Add new APIs and virsh commands to get/set cpu mode
by Ichikawa, Ken
Hello.
This patchset adds new APIs virDomainGetCPUMode and virDomainSetCPUMode,
and adds new virsh commands cpu-getmode and cpu-setmode by using these APIs.
virDomainGetCPUMode allows to get cpu mode of a running or persistent domain.
virDomainSetCPUMode allows to set cpu mode of a persistent domain.
These APIs and virsh commands are useful because:
- No longer need to mess around with XML for changing cpu mode.
- People who want more performance can change cpu mode easily.
- If there is a person who has a trouble with host-mode and
host-passthrough, we can help easily by one-liner like
"# virsh cpu-setmode <domain> custom"
Then, default cpu is used after next boot.
Ken ICHIKAWA (4):
API: Introduce new public APIs virDomainGetCPUMode and virDomainSetCPUMode
qemu: Add support for virDomainGetCPUMode and virDomainSetCPUMode
remote: Add support for virDomainGetCPUMode and virDomainSetCPUMode
virsh: Add cpu-getmode and cpu-setmode command
include/libvirt/libvirt.h.in | 9 +++
src/driver.h | 11 ++++
src/libvirt.c | 112 +++++++++++++++++++++++++++++++++++++
src/libvirt_private.syms | 1 +
src/libvirt_public.syms | 2 +
src/qemu/qemu_driver.c | 129 +++++++++++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 19 ++++++-
src/remote_protocol-structs | 14 +++++
tools/virsh-domain.c | 109 ++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 19 +++++++
11 files changed, 426 insertions(+), 1 deletion(-)
--
1.7.11.7
12 years
[libvirt] [PATCH v16] support offline migration
by Jiri Denemark
From: liguang <lig.fnst(a)cn.fujitsu.com>
original migration did not aware of offline case,
so, try to support offline migration quietly
(did not disturb original migration) by pass
VIR_MIGRATE_OFFLINE flag to migration APIs if only
the domain is really inactive, and
migration process will not puzzled by domain
offline and exit unexpectedly.
these changes did not take care of disk images the
domain required, for them could be transferred by
other APIs as suggested, then VIR_MIGRATE_OFFLINE
must not combined with VIR_MIGRATE_NON_SHARED_*.
and you must do a persistent migration at same time,
do "virsh migrate --offline --persistent ...".
Signed-off-by: liguang <lig.fnst(a)cn.fujitsu.com>
---
This patch is a combination of v15 from liguang and my changes I sent as
review comments to that v15. Since I had to do quite a few changes, I
didn't push the result right away even though this has my ACK now. I'll
wait until next week and if no comments appear, I'll push this patch at
the beginning of next week.
include/libvirt/libvirt.h.in | 1 +
src/libvirt.c | 51 +++++++++++++
src/libvirt_internal.h | 5 ++
src/qemu/qemu_driver.c | 15 ++--
src/qemu/qemu_migration.c | 170 +++++++++++++++++++++++++++++++++----------
src/qemu/qemu_migration.h | 9 ++-
tools/virsh-domain.c | 5 ++
tools/virsh.pod | 5 +-
8 files changed, 209 insertions(+), 52 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 17804ca..c6739d7 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1092,6 +1092,7 @@ typedef enum {
* whole migration process; this will be used automatically
* when supported */
VIR_MIGRATE_UNSAFE = (1 << 9), /* force migration even if it is considered unsafe */
+ VIR_MIGRATE_OFFLINE = (1 << 10), /* offline migrate */
} virDomainMigrateFlags;
/* Domain migration. */
diff --git a/src/libvirt.c b/src/libvirt.c
index 6a7a817..4215971 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4829,6 +4829,14 @@ virDomainMigrateVersion3(virDomainPtr domain,
if (uri_out)
uri = uri_out; /* Did domainMigratePrepare3 change URI? */
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ VIR_DEBUG("Offline migration, skipping Perform phase");
+ VIR_FREE(cookieout);
+ cookieoutlen = 0;
+ cancelled = 0;
+ goto finish;
+ }
+
/* Perform the migration. The driver isn't supposed to return
* until the migration is complete. The src VM should remain
* running, but in paused state until the destination can
@@ -5199,6 +5207,23 @@ virDomainMigrate(virDomainPtr domain,
goto error;
}
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
+ virLibConnError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the source host"));
+ goto error;
+ }
+ if (!VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
+ virLibConnError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the destination host"));
+ goto error;
+ }
+ }
+
if (flags & VIR_MIGRATE_PEER2PEER) {
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
VIR_DRV_FEATURE_MIGRATION_P2P)) {
@@ -5404,6 +5429,23 @@ virDomainMigrate2(virDomainPtr domain,
goto error;
}
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
+ virLibConnError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the source host"));
+ goto error;
+ }
+ if (!VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
+ virLibConnError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the destination host"));
+ goto error;
+ }
+ }
+
if (flags & VIR_MIGRATE_PEER2PEER) {
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
VIR_DRV_FEATURE_MIGRATION_P2P)) {
@@ -5581,6 +5623,15 @@ virDomainMigrateToURI(virDomainPtr domain,
virCheckNonNullArgGoto(duri, error);
+ if (flags & VIR_MIGRATE_OFFLINE &&
+ !VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
+ virLibConnError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the source host"));
+ goto error;
+ }
+
if (flags & VIR_MIGRATE_PEER2PEER) {
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
VIR_DRV_FEATURE_MIGRATION_P2P)) {
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 2eda156..595d2db 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -105,6 +105,11 @@ enum {
* Support for VIR_DOMAIN_XML_MIGRATABLE flag in domainGetXMLDesc
*/
VIR_DRV_FEATURE_XML_MIGRATABLE = 11,
+
+ /*
+ * Support for offline migration.
+ */
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE = 12,
};
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e099c5c..d449579 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1208,6 +1208,7 @@ qemuSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
case VIR_DRV_FEATURE_FD_PASSING:
case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
case VIR_DRV_FEATURE_XML_MIGRATABLE:
+ case VIR_DRV_FEATURE_MIGRATION_OFFLINE:
return 1;
default:
return 0;
@@ -9698,7 +9699,7 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
ret = qemuMigrationPrepareTunnel(driver, dconn,
NULL, 0, NULL, NULL, /* No cookies in v2 */
- st, dname, dom_xml);
+ st, dname, dom_xml, flags);
cleanup:
qemuDriverUnlock(driver);
@@ -9758,7 +9759,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
ret = qemuMigrationPrepareDirect(driver, dconn,
NULL, 0, NULL, NULL, /* No cookies */
uri_in, uri_out,
- dname, dom_xml);
+ dname, dom_xml, flags);
cleanup:
qemuDriverUnlock(driver);
@@ -9900,7 +9901,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
asyncJob = QEMU_ASYNC_JOB_NONE;
}
- if (!virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
@@ -9909,8 +9910,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
/* Check if there is any ejected media.
* We don't want to require them on the destination.
*/
-
- if (qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0)
+ if (!(flags & VIR_MIGRATE_OFFLINE) &&
+ qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0)
goto endjob;
if (!(xml = qemuMigrationBegin(driver, vm, xmlin, dname,
@@ -9995,7 +9996,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
uri_in, uri_out,
- dname, dom_xml);
+ dname, dom_xml, flags);
cleanup:
qemuDriverUnlock(driver);
@@ -10040,7 +10041,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
ret = qemuMigrationPrepareTunnel(driver, dconn,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- st, dname, dom_xml);
+ st, dname, dom_xml, flags);
qemuDriverUnlock(driver);
cleanup:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 86060dc..0ca7dd4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1442,6 +1442,28 @@ char *qemuMigrationBegin(virQEMUDriverPtr driver,
QEMU_MIGRATION_COOKIE_LOCKSTATE) < 0)
goto cleanup;
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
+ VIR_MIGRATE_NON_SHARED_INC)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("offline migration cannot handle "
+ "non-shared storage"));
+ goto cleanup;
+ }
+ if (!(flags & VIR_MIGRATE_PERSIST_DEST)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("offline migration must be specified with "
+ "the persistent flag set"));
+ goto cleanup;
+ }
+ if (flags & VIR_MIGRATE_TUNNELLED) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("tunnelled offline migration does not "
+ "make sense"));
+ goto cleanup;
+ }
+ }
+
if (xmlin) {
if (!(def = virDomainDefParseString(driver->caps, xmlin,
QEMU_EXPECTED_VIRT_TYPES,
@@ -1499,7 +1521,8 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
const char *dname,
const char *dom_xml,
const char *migrateFrom,
- virStreamPtr st)
+ virStreamPtr st,
+ unsigned long flags)
{
virDomainDefPtr def = NULL;
virDomainObjPtr vm = NULL;
@@ -1512,10 +1535,33 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
bool tunnel = !!st;
char *origname = NULL;
char *xmlout = NULL;
+ unsigned int cookieFlags;
if (virTimeMillisNow(&now) < 0)
return -1;
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
+ VIR_MIGRATE_NON_SHARED_INC)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("offline migration cannot handle "
+ "non-shared storage"));
+ goto cleanup;
+ }
+ if (!(flags & VIR_MIGRATE_PERSIST_DEST)) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("offline migration must be specified with "
+ "the persistent flag set"));
+ goto cleanup;
+ }
+ if (tunnel) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("tunnelled offline migration does not "
+ "make sense"));
+ goto cleanup;
+ }
+ }
+
if (!(def = virDomainDefParseString(driver->caps, dom_xml,
QEMU_EXPECTED_VIRT_TYPES,
VIR_DOMAIN_XML_INACTIVE)))
@@ -1599,6 +1645,9 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
/* Domain starts inactive, even if the domain XML had an id field. */
vm->def->id = -1;
+ if (flags & VIR_MIGRATE_OFFLINE)
+ goto done;
+
if (tunnel &&
(pipe(dataFD) < 0 || virSetCloseExec(dataFD[1]) < 0)) {
virReportSystemError(errno, "%s",
@@ -1640,8 +1689,14 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
VIR_DEBUG("Received no lockstate");
}
+done:
+ if (flags & VIR_MIGRATE_OFFLINE)
+ cookieFlags = 0;
+ else
+ cookieFlags = QEMU_MIGRATION_COOKIE_GRAPHICS;
+
if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
- QEMU_MIGRATION_COOKIE_GRAPHICS) < 0) {
+ cookieFlags) < 0) {
/* We could tear down the whole guest here, but
* cookie data is (so far) non-critical, so that
* seems a little harsh. We'll just warn for now.
@@ -1652,10 +1707,12 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
if (qemuDomainCleanupAdd(vm, qemuMigrationPrepareCleanup) < 0)
goto endjob;
- virDomainAuditStart(vm, "migrated", true);
- event = virDomainEventNewFromObj(vm,
- VIR_DOMAIN_EVENT_STARTED,
- VIR_DOMAIN_EVENT_STARTED_MIGRATED);
+ if (!(flags & VIR_MIGRATE_OFFLINE)) {
+ virDomainAuditStart(vm, "migrated", true);
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STARTED,
+ VIR_DOMAIN_EVENT_STARTED_MIGRATED);
+ }
/* We keep the job active across API calls until the finish() call.
* This prevents any other APIs being invoked while incoming
@@ -1708,7 +1765,8 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
int *cookieoutlen,
virStreamPtr st,
const char *dname,
- const char *dom_xml)
+ const char *dom_xml,
+ unsigned long flags)
{
int ret;
@@ -1722,7 +1780,7 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
*/
ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
cookieout, cookieoutlen, dname, dom_xml,
- "stdio", st);
+ "stdio", st, flags);
return ret;
}
@@ -1737,7 +1795,8 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
const char *uri_in,
char **uri_out,
const char *dname,
- const char *dom_xml)
+ const char *dom_xml,
+ unsigned long flags)
{
static int port = 0;
int this_port;
@@ -1833,7 +1892,7 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
cookieout, cookieoutlen, dname, dom_xml,
- migrateFrom, NULL);
+ migrateFrom, NULL, flags);
cleanup:
VIR_FREE(hostname);
if (ret != 0)
@@ -2679,6 +2738,14 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
if (ret == -1)
goto cleanup;
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ VIR_DEBUG("Offline migration, skipping Perform phase");
+ VIR_FREE(cookieout);
+ cookieoutlen = 0;
+ cancelled = 0;
+ goto finish;
+ }
+
if (!(flags & VIR_MIGRATE_TUNNELLED) &&
(uri_out == NULL)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2817,6 +2884,7 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
virConnectPtr dconn = NULL;
bool p2p;
virErrorPtr orig_err = NULL;
+ bool offline;
VIR_DEBUG("driver=%p, sconn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
"uri=%s, flags=%lx, dname=%s, resource=%lu",
@@ -2849,6 +2917,9 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
*/
*v3proto = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
VIR_DRV_FEATURE_MIGRATION_V3);
+ if (flags & VIR_MIGRATE_OFFLINE)
+ offline = VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE);
qemuDomainObjExitRemoteWithDriver(driver, vm);
if (!p2p) {
@@ -2857,8 +2928,15 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
goto cleanup;
}
+ if (flags & VIR_MIGRATE_OFFLINE && !offline) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the destination host"));
+ goto cleanup;
+ }
+
/* domain may have been stopped while we were talking to remote daemon */
- if (!virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
goto cleanup;
@@ -2921,7 +2999,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
@@ -3245,26 +3323,27 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
* object, but if no, clean up the empty qemu process.
*/
if (retcode == 0) {
- if (!virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
goto endjob;
}
- if (qemuMigrationVPAssociatePortProfiles(vm->def) < 0) {
- qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
- VIR_QEMU_PROCESS_STOP_MIGRATED);
- virDomainAuditStop(vm, "failed");
- event = virDomainEventNewFromObj(vm,
- VIR_DOMAIN_EVENT_STOPPED,
- VIR_DOMAIN_EVENT_STOPPED_FAILED);
- goto endjob;
+ if (!(flags & VIR_MIGRATE_OFFLINE)) {
+ if (qemuMigrationVPAssociatePortProfiles(vm->def) < 0) {
+ qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
+ VIR_QEMU_PROCESS_STOP_MIGRATED);
+ virDomainAuditStop(vm, "failed");
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STOPPED,
+ VIR_DOMAIN_EVENT_STOPPED_FAILED);
+ goto endjob;
+ }
+ if (mig->network)
+ if (qemuDomainMigrateOPDRelocate(driver, vm, mig) < 0)
+ VIR_WARN("unable to provide network data for relocation");
}
- if (mig->network)
- if (qemuDomainMigrateOPDRelocate(driver, vm, mig) < 0)
- VIR_WARN("unable to provide network data for relocation");
-
if (flags & VIR_MIGRATE_PERSIST_DEST) {
virDomainDefPtr vmdef;
if (vm->persistent)
@@ -3290,9 +3369,11 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
* to restart during confirm() step, so we kill it off now.
*/
if (v3proto) {
- qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
- VIR_QEMU_PROCESS_STOP_MIGRATED);
- virDomainAuditStop(vm, "failed");
+ if (!(flags & VIR_MIGRATE_OFFLINE)) {
+ qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
+ VIR_QEMU_PROCESS_STOP_MIGRATED);
+ virDomainAuditStop(vm, "failed");
+ }
if (newVM)
vm->persistent = 0;
}
@@ -3312,7 +3393,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
event = NULL;
}
- if (!(flags & VIR_MIGRATE_PAUSED)) {
+ if (!(flags & VIR_MIGRATE_PAUSED) && !(flags & VIR_MIGRATE_OFFLINE)) {
/* run 'cont' on the destination, which allows migration on qemu
* >= 0.10.6 to work properly. This isn't strictly necessary on
* older qemu's, but it also doesn't hurt anything there
@@ -3350,25 +3431,30 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
- event = virDomainEventNewFromObj(vm,
- VIR_DOMAIN_EVENT_RESUMED,
- VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
- if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
- virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
- if (event)
- qemuDomainEventQueue(driver, event);
+ if (!(flags & VIR_MIGRATE_OFFLINE)) {
event = virDomainEventNewFromObj(vm,
- VIR_DOMAIN_EVENT_SUSPENDED,
- VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
+ VIR_DOMAIN_EVENT_RESUMED,
+ VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
+ if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
+ virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
+ VIR_DOMAIN_PAUSED_USER);
+ if (event)
+ qemuDomainEventQueue(driver, event);
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
+ }
}
- if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
+
+ if (virDomainObjIsActive(vm) &&
+ virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
VIR_WARN("Failed to save status on vm %s", vm->def->name);
goto endjob;
}
/* Guest is successfully running, so cancel previous auto destroy */
qemuProcessAutoDestroyRemove(driver, vm);
- } else {
+ } else if (!(flags & VIR_MIGRATE_OFFLINE)) {
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
VIR_QEMU_PROCESS_STOP_MIGRATED);
virDomainAuditStop(vm, "failed");
@@ -3430,6 +3516,9 @@ int qemuMigrationConfirm(virQEMUDriverPtr driver,
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0)))
return -1;
+ if (flags & VIR_MIGRATE_OFFLINE)
+ goto done;
+
/* Did the migration go as planned? If yes, kill off the
* domain object, but if no, resume CPUs
*/
@@ -3465,6 +3554,7 @@ int qemuMigrationConfirm(virQEMUDriverPtr driver,
}
}
+done:
qemuMigrationCookieFree(mig);
rv = 0;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 62e39a0..eb30f06 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -36,7 +36,8 @@
VIR_MIGRATE_NON_SHARED_DISK | \
VIR_MIGRATE_NON_SHARED_INC | \
VIR_MIGRATE_CHANGE_PROTECTION | \
- VIR_MIGRATE_UNSAFE)
+ VIR_MIGRATE_UNSAFE | \
+ VIR_MIGRATE_OFFLINE)
enum qemuMigrationJobPhase {
QEMU_MIGRATION_PHASE_NONE = 0,
@@ -97,7 +98,8 @@ int qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
int *cookieoutlen,
virStreamPtr st,
const char *dname,
- const char *dom_xml);
+ const char *dom_xml,
+ unsigned long flags);
int qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
virConnectPtr dconn,
@@ -108,7 +110,8 @@ int qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
const char *uri_in,
char **uri_out,
const char *dname,
- const char *dom_xml);
+ const char *dom_xml,
+ unsigned long flags);
int qemuMigrationPerform(virQEMUDriverPtr driver,
virConnectPtr conn,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 96e62fc..39ac9b5 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6803,6 +6803,7 @@ static const vshCmdInfo info_migrate[] = {
static const vshCmdOptDef opts_migrate[] = {
{"live", VSH_OT_BOOL, 0, N_("live migration")},
+ {"offline", VSH_OT_BOOL, 0, N_("offline (domain's inactive) migration")},
{"p2p", VSH_OT_BOOL, 0, N_("peer-2-peer migration")},
{"direct", VSH_OT_BOOL, 0, N_("direct migration")},
{"tunneled", VSH_OT_ALIAS, 0, "tunnelled"},
@@ -6888,6 +6889,10 @@ doMigrate(void *opaque)
if (vshCommandOptBool(cmd, "unsafe"))
flags |= VIR_MIGRATE_UNSAFE;
+ if (vshCommandOptBool(cmd, "offline")) {
+ flags |= VIR_MIGRATE_OFFLINE;
+ }
+
if (xmlfile &&
virFileReadAll(xmlfile, 8192, &xml) < 0) {
vshError(ctl, _("file '%s' doesn't exist"), xmlfile);
diff --git a/tools/virsh.pod b/tools/virsh.pod
index b0e7064..0ada19a 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1040,13 +1040,14 @@ 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<migrate> [I<--live>] [I<--direct>] [I<--p2p> [I<--tunnelled>]]
+=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>]
I<domain> I<desturi> [I<migrateuri>] [I<dname>]
[I<--timeout> B<seconds>] [I<--xml> B<file>]
-Migrate domain to another host. Add I<--live> for live migration; I<--p2p>
+Migrate domain to another host. Add I<--live> for live migration;
+I<--offline> for offline (domain's inactive) migration; <--p2p>
for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
for tunnelled migration. I<--persistent> leaves the domain persistent on
destination host, I<--undefinesource> undefines the domain on the source host,
--
1.8.0
12 years
[libvirt] [PATCH] qemu: eliminate bogus error log when changing netdev's bridge
by Laine Stump
This fixes a problem that showed up during testing of:
https://bugzilla.redhat.com/show_bug.cgi?id=881480
Due to a logic error in the function that gets the name of the bridge
an interface connects to, any time a bridge was specified directly
(type='bridge') rather than indirectly (type='network'), An error
would be logged (although the operation would then complete
successfully):
Network type 6 is not supported
The final virReportError() in the function
qemuDomainNetGetBridgeName() was apparently avoided in the past with a
"goto cleanup" at the end of each case, but the case of bridge somehow
no longer has that final goto cleanup.
The proper solution is anyway to not rely on goto's, but put the error
log inside an else {} clause, so that it's executed only if the type
is neither bridge nor network (in reality, this function should only
ever be called for those two types, that's why this is an internal
error).
While making this change, the error message was also tuned to be more
correct (since it's not really the type of the network, but the type
of the interface, and it *is* otherwise supported, it's just that the
interface type in question doesn't *have* a bridge device associated
with it, or at least we don't know how to get it).
---
src/qemu/qemu_hotplug.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fbd60de..3dfdb65 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1268,13 +1268,13 @@ qemuDomainNetGetBridgeName(virConnectPtr conn, virDomainNetDefPtr net)
virNetworkFree(network);
virSetError(errobj);
virFreeError(errobj);
- goto cleanup;
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Interface type %d has no bridge name"),
+ virDomainNetGetActualType(net));
}
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Network type %d is not supported"),
- virDomainNetGetActualType(net));
cleanup:
return brname;
}
--
1.7.11.7
12 years
[libvirt] [PATCH RESEND] S390: Assign default model "virtio" for network interfaces
by Viktor Mihajlovski
If a network interface model is not specified, libvirt will run
into an unchecked NULL pointer coredump. On the other hand if
the empty model is ignored, a PCI bus address would be generated,
which is not supported by S390.
Since the only valid network type model for S390 is virtio,
we use this as the default value, which is the same for QEMU.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_command.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5335dcf..9009bd2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -810,9 +810,14 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
}
for (i = 0; i < def->nnets ; i++) {
+ if (STRPREFIX(def->os.arch, "s390") &&
+ def->nets[i]->model == NULL) {
+ def->nets[i]->model = strdup("virtio");
+ }
if (STREQ(def->nets[i]->model,"virtio") &&
- def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
+ def->nets[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
def->nets[i]->info.type = type;
+ }
}
for (i = 0; i < def->ncontrollers ; i++) {
--
1.7.0.4
12 years