[libvirt] [PATCH v3 0/4] Try several possible default network devices
by Andrea Bolognani
Changes in v3:
* detect rtl8139 and e1000 availability as well
* don't try to use virtio-net based on availability alone:
try rtl8139, e1000 and virtio-net in this order instead
* patch 4/4 contains an ugly bit we'll be able to get rid of
once capabilities can be properly mocked in the test suite
Changes in v2[1]:
* detect virtio-net availability
* try to user it if available
Cheers.
[1] https://www.redhat.com/archives/libvir-list/2015-September/msg00058.html
Andrea Bolognani (4):
qemu: Introduce QEMU_CAPS_DEVICE_RTL8139
qemu: Introduce QEMU_CAPS_DEVICE_E1000
qemu: Introduce QEMU_CAPS_DEVICE_VIRTIO_NET
qemu: Try several network devices when looking for a default
src/qemu/qemu_capabilities.c | 12 +++++++++-
src/qemu/qemu_capabilities.h | 3 +++
src/qemu/qemu_domain.c | 32 +++++++++++++++++++++++----
tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 3 +++
tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 +++
tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 +++
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 +++
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 +++
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 +++
tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 3 +++
tests/qemuhelptest.c | 30 ++++++++++++++++++++-----
11 files changed, 87 insertions(+), 11 deletions(-)
--
2.4.3
9 years, 2 months
[libvirt] [PATCH sandbox v5 00/20] Docker image support
by Daniel P. Berrange
This is an update of Eren's v4 patch series to provide
Docker image support. In this v5 I have incorporated
fixes for all of the feedback I gave Eren against the
v4, so I think this series is ready for merging now.
One thing I still want to look at separately is how
applicable this design is to other container formats,
in particular the 'appc' specification
https://github.com/appc/spec/blob/master/spec/discovery.md
Before we make a release containing the docker impl, I
want to be confident we've not done anything silly
which will cause us compat problems if we want to
extend to cover appc later.
Daniel P Berrange (1):
Add virt-sandbox-image
Daniel P. Berrange (1):
Rename 'name' to 'template' to disambiguate
Eren Yagdiran (18):
Fix docker authentication handling
Image: Add Hooking Mechanism
Image: virt-sandbox-image default dir constants
Image: Add download function
Image: Refactor create function
Image: Add delete function
Image: Add get_command function to Source
Image: Add run args
Image: Add check_connect function
Image: Add get_disk function to Source
Image: Add run function
Image: Add network support
Image: man file for virt-sandbox-image
Add config for environment variables
Add environment parameter to virt-sandbox
init-common: Exporting custom environment variables
Image: Add custom environment support
Image: Add Volume Support
.gitignore | 1 +
bin/Makefile.am | 8 +-
bin/virt-sandbox-image | 8 +
bin/virt-sandbox-image.pod | 169 +++++++++++
bin/virt-sandbox.c | 14 +
configure.ac | 3 +
libvirt-sandbox.spec.in | 3 +
libvirt-sandbox/Makefile.am | 2 +-
libvirt-sandbox/image/Makefile.am | 10 +
libvirt-sandbox/image/__init__.py | 0
libvirt-sandbox/image/cli.py | 293 ++++++++++++++++++
libvirt-sandbox/image/sources/DockerSource.py | 416 ++++++++++++++++++++++++++
libvirt-sandbox/image/sources/Makefile.am | 9 +
libvirt-sandbox/image/sources/Source.py | 117 ++++++++
libvirt-sandbox/image/sources/__init__.py | 0
libvirt-sandbox/libvirt-sandbox-config.c | 171 ++++++++++-
libvirt-sandbox/libvirt-sandbox-config.h | 13 +
libvirt-sandbox/libvirt-sandbox-init-common.c | 18 ++
libvirt-sandbox/libvirt-sandbox.sym | 9 +
libvirt-sandbox/tests/test-config.c | 10 +
po/POTFILES.in | 1 +
21 files changed, 1272 insertions(+), 3 deletions(-)
create mode 100644 bin/virt-sandbox-image
create mode 100644 bin/virt-sandbox-image.pod
create mode 100644 libvirt-sandbox/image/Makefile.am
create mode 100644 libvirt-sandbox/image/__init__.py
create mode 100755 libvirt-sandbox/image/cli.py
create mode 100644 libvirt-sandbox/image/sources/DockerSource.py
create mode 100644 libvirt-sandbox/image/sources/Makefile.am
create mode 100644 libvirt-sandbox/image/sources/Source.py
create mode 100644 libvirt-sandbox/image/sources/__init__.py
--
2.4.3
9 years, 2 months
[libvirt] [PATCH] target-i386: Enable "check" mode by default
by Eduardo Habkost
Current default behavior of QEMU is to silently disable features that
are not supported by the host when a CPU model is requested in the
command-line. This means that in addition to risking breaking guest ABI
by default, we are silent about it.
I would like to enable "enforce" by default, but this can easily break
existing production systems because of the way libvirt makes assumptions
about CPU models today (this will change in the future, once QEMU
provide a proper interface for checking if a CPU model is runnable).
But there's no reason we should be silent about it. So, change
target-i386 to enable "check" mode by default so at least we have some
warning printed to stderr (and hopefully logged somewhere) when QEMU
disables a feature that is not supported by the host system.
Signed-off-by: Eduardo Habkost <ehabkost(a)redhat.com>
---
target-i386/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index cfb8aa7..32fee00 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -3121,7 +3121,7 @@ static Property x86_cpu_properties[] = {
DEFINE_PROP_BOOL("hv-relaxed", X86CPU, hyperv_relaxed_timing, false),
DEFINE_PROP_BOOL("hv-vapic", X86CPU, hyperv_vapic, false),
DEFINE_PROP_BOOL("hv-time", X86CPU, hyperv_time, false),
- DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, false),
+ DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true),
DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false),
DEFINE_PROP_BOOL("kvm", X86CPU, expose_kvm, true),
DEFINE_PROP_UINT32("level", X86CPU, env.cpuid_level, 0),
--
2.1.0
9 years, 2 months
[libvirt] [PATCH RFC 0/2] libxl: migration v3 and p2p support
by Joao Martins
Hey Jim,
These series introduce support for peer2peer and plain v3 migration without
extensible parameters. This patch series is organized as follows:
The first patch introduces the P2P where the source host must take care of
connection handling with destination libvirtd and is responsible for performing
the migration. I introduced an additional method for the P2P Perform phase
since the default Perform of libxl is then reused. The sequence is the same as
v3 so it is possible to migrate to non-P2P host. libxlDoMigrateP2P actually
does the migration using a virConnectPtr to the destination and thus
The second patch is mostly mechanical, and functional wise is very much the
same as the Params variant. The added value of introducing plain v3 is having
access to older APIs such virDomainMigrateToURI2 and virDomainMigrate (in P2P
mode) which are currently in use by Openstack/virt-manager.
My testing was performed in xen stable-4.5 and 4.4.3 (with the added patches in
the Xen CI loop) plus Openstack Kilo. In addition I backported the patches and
tested also on libvirt 1.2.14 (whic is also ran by the Xen CI Openstack loop).
Any comments or suggestions are welcome,
Thanks!
Joao
Joao Martins (2):
libxl: add p2p migration
libxl: add v3 migration w/o params
src/libxl/libxl_driver.c | 226 +++++++++++++++++++++++++++++++++++++++++++-
src/libxl/libxl_migration.c | 220 ++++++++++++++++++++++++++++++++++++++++++
src/libxl/libxl_migration.h | 11 +++
3 files changed, 454 insertions(+), 3 deletions(-)
--
2.1.4
9 years, 2 months
[libvirt] [PATCH] migration: support all toURI and proto combos
by Nikolay Shirokovskiy
Current implementation of 'toURI' migration interfaces does not support all
combinations of interface versions and protocol versions. For example 'toURI2'
with p2p flag will not migrate if driver supports only v3params proto.
This is not convinient as drivers that starts to support migration have to
manually support older versions of protocol. I guess this should be done in
one place, namely here.
Another issue is that there are a lot of code duplication in implementation of
toURI interfaces and it is not obvious from code how are they related.
This implementation uses extensible parameters as intermediate parameters
representation. This is possible as interfaces are done backward compatible in
terms of parameters and later versions supports all parameters of former
versions.
Another change that is convinient to add here is reusing the code for p2p and
direct migration. The only major difference between them is how URIs are passed
in places that supports both connection and migration uri. Now this difference
is plain in code. See comments in code for details.
Minor p2p vs direct difference is that direct not support proto with extensible
parameters. This behaviour is saved.
Unobvious check of migration dconnuri in case of p2p migration is actually
protection from migration to localhost (from cover letter to patch 59d13aae
that introduced it). So reformat this check to make it goal obvious.
==Behaviour changes
Previous implementation of direct migration demands that proto v1 is
implemented even if proto v3 is used. As this is somewhat against the purpuse
of this patch this behaviour is dropped.
Another behavior change that introduced is that now offline flag examined
against driver migration capabilities for all api version not only for toURI1.
It was odd taking into account that all toURI uses common peer2peer and direct
implementation.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/libvirt-domain.c | 564 +++++++++++++++++++++-----------------------------
1 files changed, 232 insertions(+), 332 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index cbf08fc..721d820 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -3291,181 +3291,209 @@ virDomainMigrateVersion3Params(virDomainPtr domain,
params, nparams, true, flags);
}
-
-/*
- * In normal migration, the libvirt client co-ordinates communication
- * between the 2 libvirtd instances on source & dest hosts.
- *
- * In this peer-2-peer migration alternative, the libvirt client
- * only talks to the source libvirtd instance. The source libvirtd
- * then opens its own connection to the destination and co-ordinates
- * migration itself.
- *
- * If useParams is true, params and nparams contain migration parameters and
- * we know it's safe to call the API which supports extensible parameters.
- * Otherwise, we have to use xmlin, dname, uri, and bandwidth and pass them
- * to the old-style APIs.
- */
static int
-virDomainMigratePeer2PeerFull(virDomainPtr domain,
- const char *dconnuri,
- const char *xmlin,
- const char *dname,
- const char *uri,
- unsigned long long bandwidth,
- virTypedParameterPtr params,
- int nparams,
- bool useParams,
- unsigned int flags)
+virDomainMigrateURIproto3(virDomainPtr domain,
+ const char *dconnuri,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
{
- virURIPtr tempuri = NULL;
+ const char *compatParams[] = { VIR_MIGRATE_PARAM_URI,
+ VIR_MIGRATE_PARAM_DEST_NAME,
+ VIR_MIGRATE_PARAM_DEST_XML,
+ VIR_MIGRATE_PARAM_BANDWIDTH };
+ const char *uri = NULL;
+ const char *dname = NULL;
+ const char *dxml = NULL;
+ unsigned long long bandwidth = 0;
- VIR_DOMAIN_DEBUG(domain,
- "dconnuri=%s, xmlin=%s, dname=%s, uri=%s, bandwidth=%llu "
- "params=%p, nparams=%d, useParams=%d, flags=%x",
- dconnuri, NULLSTR(xmlin), NULLSTR(dname), NULLSTR(uri),
- bandwidth, params, nparams, useParams, flags);
- VIR_TYPED_PARAMS_DEBUG(params, nparams);
+ if (!virTypedParamsCheck(params, nparams, compatParams,
+ ARRAY_CARDINALITY(compatParams))) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("Migration does not support some of parameters."));
+ return -1;
+ }
- if ((useParams && !domain->conn->driver->domainMigratePerform3Params) ||
- (!useParams &&
- !domain->conn->driver->domainMigratePerform &&
- !domain->conn->driver->domainMigratePerform3)) {
- virReportUnsupportedError();
+ if (virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_URI, &uri) < 0 ||
+ virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0 ||
+ virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_DEST_XML, &dxml) < 0 ||
+ virTypedParamsGetULLong(params, nparams,
+ VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0) {
return -1;
}
- if (!(tempuri = virURIParse(dconnuri)))
+ VIR_DEBUG("Using migration protocol 3");
+ return domain->conn->driver->domainMigratePerform3
+ (domain, dxml,
+ NULL, /* cookiein */
+ 0, /* cookieinlen */
+ NULL, /* cookieoutlen */
+ NULL, /* cookieoutlen */
+ dconnuri, uri, flags, dname, bandwidth);
+}
+
+static int
+virDomainMigrateURIproto1(virDomainPtr domain,
+ const char *dconnuri,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
+{
+ /* uri parameter is added for direct case */
+ const char *compatParams[] = { VIR_MIGRATE_PARAM_DEST_NAME,
+ VIR_MIGRATE_PARAM_BANDWIDTH,
+ VIR_MIGRATE_PARAM_URI };
+ const char *dname = NULL;
+ const char *miguri = NULL;
+ unsigned long long bandwidth = 0;
+ const char *duri = NULL;
+
+ if (!virTypedParamsCheck(params, nparams, compatParams,
+ ARRAY_CARDINALITY(compatParams))) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("Migration does not support some of parameters."));
return -1;
- if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
- virReportInvalidArg(dconnuri, "%s",
- _("unable to parse server from dconnuri"));
- virURIFree(tempuri);
+ }
+
+ if (virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0 ||
+ virTypedParamsGetULLong(params, nparams,
+ VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0 ||
+ virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_URI, &miguri) < 0) {
return -1;
}
- virURIFree(tempuri);
- if (useParams) {
- VIR_DEBUG("Using migration protocol 3 with extensible parameters");
- return domain->conn->driver->domainMigratePerform3Params
- (domain, dconnuri, params, nparams,
- NULL, 0, NULL, NULL, flags);
- } else if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_V3)) {
- VIR_DEBUG("Using migration protocol 3");
- return domain->conn->driver->domainMigratePerform3
- (domain, xmlin, NULL, 0, NULL, NULL, dconnuri,
- uri, flags, dname, bandwidth);
- } else {
- VIR_DEBUG("Using migration protocol 2");
- if (xmlin) {
+ /* see explanation in correspondent part of virDomainMigrateToURI */
+ if ((flags & VIR_MIGRATE_PEER2PEER)) {
+ if (miguri) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("Unable to change target guest XML during "
- "migration"));
+ _("Migration does not support some of parameters."));
return -1;
}
- if (uri) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to override peer2peer migration URI"));
- return -1;
- }
- return domain->conn->driver->domainMigratePerform
- (domain, NULL, 0, dconnuri, flags, dname, bandwidth);
+ duri = dconnuri;
+ } else {
+ duri = miguri;
}
-}
+ VIR_DEBUG("Using migration protocol 2");
+ return domain->conn->driver->domainMigratePerform
+ (domain,
+ NULL, /* cookie */
+ 0, /* cookielen */
+ duri, flags, dname, bandwidth);
+}
static int
-virDomainMigratePeer2Peer(virDomainPtr domain,
- const char *xmlin,
- unsigned long flags,
- const char *dname,
- const char *dconnuri,
- const char *uri,
- unsigned long bandwidth)
+virDomainMigrateCheckNotLocal(const char *dconnuri)
{
- return virDomainMigratePeer2PeerFull(domain, dconnuri, xmlin, dname, uri,
- bandwidth, NULL, 0, false, flags);
-}
+ virURIPtr tempuri = NULL;
+ int ret = -1;
+
+ if (!(tempuri = virURIParse(dconnuri)))
+ goto cleanup;
+ if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
+ virReportInvalidArg(dconnuri, "%s",
+ _("Attempt to migrate guest to the same host %s"));
+ goto cleanup;
+ }
+ ret = 0;
+ cleanup:
-static int
-virDomainMigratePeer2PeerParams(virDomainPtr domain,
- const char *dconnuri,
- virTypedParameterPtr params,
- int nparams,
- unsigned int flags)
-{
- return virDomainMigratePeer2PeerFull(domain, dconnuri, NULL, NULL, NULL, 0,
- params, nparams, true, flags);
+ virURIFree(tempuri);
+ return ret;
}
-
/*
* In normal migration, the libvirt client co-ordinates communication
* between the 2 libvirtd instances on source & dest hosts.
*
- * Some hypervisors support an alternative, direct migration where
- * there is no requirement for a libvirtd instance on the dest host.
- * In this case
- *
- * eg, XenD can talk direct to XenD, so libvirtd on dest does not
- * need to be involved at all, or even running
+ * In this peer-2-peer migration alternative, the libvirt client
+ * only talks to the source libvirtd instance. The source libvirtd
+ * then opens its own connection to the destination and co-ordinates
+ * migration itself.
*/
static int
-virDomainMigrateDirect(virDomainPtr domain,
- const char *xmlin,
- unsigned long flags,
- const char *dname,
- const char *uri,
- unsigned long bandwidth)
+virDomainMigrateToURI_(virDomainPtr domain,
+ const char *dconnuri,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
{
- VIR_DOMAIN_DEBUG(domain,
- "xmlin=%s, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
- NULLSTR(xmlin), flags, NULLSTR(dname), NULLSTR(uri),
- bandwidth);
+ int ret = -1;
- if (!domain->conn->driver->domainMigratePerform) {
- virReportUnsupportedError();
- return -1;
+ /* First checkout the source */
+ virCheckDomainReturn(domain, -1);
+ virCheckReadOnlyGoto(domain->conn->flags, cleanup);
+
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
+ VIR_MIGRATE_NON_SHARED_INC,
+ cleanup);
+
+ if (flags & VIR_MIGRATE_OFFLINE &&
+ !VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("offline migration is not supported by "
+ "the source host"));
+ goto cleanup;
}
- /* Perform the migration. The driver isn't supposed to return
- * until the migration is complete.
- */
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_V3)) {
- VIR_DEBUG("Using migration protocol 3");
- /* dconn URI not relevant in direct migration, since no
- * target libvirtd is involved */
- return domain->conn->driver->domainMigratePerform3(domain,
- xmlin,
- NULL, /* cookiein */
- 0, /* cookieinlen */
- NULL, /* cookieoutlen */
- NULL, /* cookieoutlen */
- NULL, /* dconnuri */
- uri,
- flags,
- dname,
- bandwidth);
+ if (flags & VIR_MIGRATE_PEER2PEER) {
+ if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_P2P)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("Peer-to-peer migration is not supported by "
+ "the connection driver"));
+ goto cleanup;
+ }
+ if (virDomainMigrateCheckNotLocal(dconnuri))
+ goto cleanup;
+
} else {
- VIR_DEBUG("Using migration protocol 2");
- if (xmlin) {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("Unable to change target guest XML during migration"));
- return -1;
+ if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
+ /* Cannot do a migration with only the perform step */
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("Direct migration is not supported by the"
+ " connection driver"));
+ goto cleanup;
}
- return domain->conn->driver->domainMigratePerform(domain,
- NULL, /* cookie */
- 0, /* cookielen */
- uri,
- flags,
- dname,
- bandwidth);
+
+ VIR_DEBUG("Using direct migration");
}
-}
+ /* for some reason direct migration is not supported thru migration
+ with extensible parameters */
+ if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_PARAMS) &&
+ domain->conn->driver->domainMigratePerform3Params &&
+ (flags & VIR_MIGRATE_PEER2PEER)) {
+ VIR_DEBUG("Using migration protocol 3 with extensible parameters");
+ ret = domain->conn->driver->domainMigratePerform3Params
+ (domain, dconnuri, params, nparams,
+ NULL, /* cookiein */
+ 0, /* cookieinlen */
+ NULL, /* cookieoutlen */
+ NULL, /* cookieoutlen */
+ flags);
+ } else if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
+ VIR_DRV_FEATURE_MIGRATION_V3) &&
+ domain->conn->driver->domainMigratePerform3) {
+ ret = virDomainMigrateURIproto3(domain, dconnuri, params, nparams, flags);
+ } else if (domain->conn->driver->domainMigratePerform) {
+ ret = virDomainMigrateURIproto1(domain, dconnuri, params, nparams, flags);
+ } else {
+ virReportUnsupportedError();
+ }
+
+ cleanup:
+ return ret;
+}
/**
* virDomainMigrate:
@@ -3594,29 +3622,22 @@ virDomainMigrate(virDomainPtr domain,
}
if (flags & VIR_MIGRATE_PEER2PEER) {
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_P2P)) {
- char *dstURI = NULL;
- if (uri == NULL) {
- dstURI = virConnectGetURI(dconn);
- if (!dstURI)
- return NULL;
- }
+ char *dstURI = NULL;
+ if (uri == NULL) {
+ dstURI = virConnectGetURI(dconn);
+ if (!dstURI)
+ return NULL;
+ }
- VIR_DEBUG("Using peer2peer migration");
- if (virDomainMigratePeer2Peer(domain, NULL, flags, dname,
- uri ? uri : dstURI, NULL, bandwidth) < 0) {
- VIR_FREE(dstURI);
- goto error;
- }
+ VIR_DEBUG("Using peer2peer migration");
+ if (virDomainMigrateToURI(domain, uri ? uri : dstURI, flags,
+ dname, bandwidth) < 0) {
VIR_FREE(dstURI);
-
- ddomain = virDomainLookupByName(dconn, dname ? dname : domain->name);
- } else {
- /* This driver does not support peer to peer migration */
- virReportUnsupportedError();
goto error;
}
+ VIR_FREE(dstURI);
+
+ ddomain = virDomainLookupByName(dconn, dname ? dname : domain->name);
} else {
/* Change protection requires support only on source side, and
* is only needed in v3 migration, which automatically re-adds
@@ -3825,8 +3846,8 @@ virDomainMigrate2(virDomainPtr domain,
return NULL;
VIR_DEBUG("Using peer2peer migration");
- if (virDomainMigratePeer2Peer(domain, dxml, flags, dname,
- dstURI, uri, bandwidth) < 0) {
+ if (virDomainMigrateToURI2(domain, dstURI, uri, dxml, flags, dname,
+ bandwidth) < 0) {
VIR_FREE(dstURI);
goto error;
}
@@ -4099,7 +4120,6 @@ virDomainMigrate3(virDomainPtr domain,
return NULL;
}
-
/**
* virDomainMigrateToURI:
* @domain: a domain object
@@ -4178,65 +4198,45 @@ virDomainMigrateToURI(virDomainPtr domain,
const char *dname,
unsigned long bandwidth)
{
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ int maxparams = 0;
+ int ret = -1;
+ const char *dconnuri = NULL;
+
VIR_DOMAIN_DEBUG(domain, "duri=%p, flags=%lx, dname=%s, bandwidth=%lu",
NULLSTR(duri), flags, NULLSTR(dname), bandwidth);
virResetLastError();
- /* First checkout the source */
- virCheckDomainReturn(domain, -1);
- virCheckReadOnlyGoto(domain->conn->flags, error);
-
- virCheckNonNullArgGoto(duri, error);
-
- VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
- VIR_MIGRATE_NON_SHARED_INC,
- error);
-
- if (flags & VIR_MIGRATE_OFFLINE &&
- !VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_OFFLINE)) {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("offline migration is not supported by "
- "the source host"));
- goto error;
- }
+ if (virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_DEST_NAME, dname) < 0 ||
+ virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_BANDWIDTH, bandwidth) < 0)
+ goto cleanup;
+ /* Later versions of migration to uri interface use 2 uris, dconnuri and miguri.
+ And they have different meaning in p2p and direct case. In p2p case
+ dconnuri has meaining of duri and must be set while miguri is optional.
+ In direct case miguri has meaning of duri and dconnuri is not used. We follow
+ this conventions here. */
if (flags & VIR_MIGRATE_PEER2PEER) {
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_P2P)) {
- VIR_DEBUG("Using peer2peer migration");
- if (virDomainMigratePeer2Peer(domain, NULL, flags,
- dname, duri, NULL, bandwidth) < 0)
- goto error;
- } else {
- /* No peer to peer migration supported */
- virReportUnsupportedError();
- goto error;
- }
+ dconnuri = duri;
} else {
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
- VIR_DEBUG("Using direct migration");
- if (virDomainMigrateDirect(domain, NULL, flags,
- dname, duri, bandwidth) < 0)
- goto error;
- } else {
- /* Cannot do a migration with only the perform step */
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("direct migration is not supported by the"
- " connection driver"));
- goto error;
- }
+ if (virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_URI, duri) < 0)
+ goto cleanup;
}
- return 0;
+ ret = virDomainMigrateToURI_(domain, dconnuri, params, nparams, flags);
- error:
- virDispatchError(domain->conn);
- return -1;
-}
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ if (ret)
+ virDispatchError(domain->conn);
+ return ret;
+}
/**
* virDomainMigrateToURI2:
@@ -4333,6 +4333,11 @@ virDomainMigrateToURI2(virDomainPtr domain,
const char *dname,
unsigned long bandwidth)
{
+ int ret = -1;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ int maxparams = 0;
+
VIR_DOMAIN_DEBUG(domain, "dconnuri=%s, miguri=%s, dxml=%s, "
"flags=%lx, dname=%s, bandwidth=%lu",
NULLSTR(dconnuri), NULLSTR(miguri), NULLSTR(dxml),
@@ -4340,47 +4345,25 @@ virDomainMigrateToURI2(virDomainPtr domain,
virResetLastError();
- /* First checkout the source */
- virCheckDomainReturn(domain, -1);
- virCheckReadOnlyGoto(domain->conn->flags, error);
+ if (virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_URI, miguri) < 0 ||
+ virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_DEST_NAME, dname) < 0 ||
+ virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_DEST_XML, dxml) < 0 ||
+ virTypedParamsAddULLong(¶ms, &nparams, &maxparams,
+ VIR_MIGRATE_PARAM_BANDWIDTH, bandwidth) < 0)
+ goto cleanup;
- VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
- VIR_MIGRATE_NON_SHARED_INC,
- error);
+ ret = virDomainMigrateToURI_(domain, dconnuri, params, nparams, flags);
- if (flags & VIR_MIGRATE_PEER2PEER) {
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_P2P)) {
- VIR_DEBUG("Using peer2peer migration");
- if (virDomainMigratePeer2Peer(domain, dxml, flags,
- dname, dconnuri, miguri, bandwidth) < 0)
- goto error;
- } else {
- /* No peer to peer migration supported */
- virReportUnsupportedError();
- goto error;
- }
- } else {
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
- VIR_DEBUG("Using direct migration");
- if (virDomainMigrateDirect(domain, dxml, flags,
- dname, miguri, bandwidth) < 0)
- goto error;
- } else {
- /* Cannot do a migration with only the perform step */
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("direct migration is not supported by the"
- " connection driver"));
- goto error;
- }
- }
+ cleanup:
+ virTypedParamsFree(params, nparams);
- return 0;
+ if (ret)
+ virDispatchError(domain->conn);
- error:
- virDispatchError(domain->conn);
- return -1;
+ return ret;
}
@@ -4428,99 +4411,16 @@ virDomainMigrateToURI3(virDomainPtr domain,
unsigned int nparams,
unsigned int flags)
{
- bool compat;
- const char *compatParams[] = { VIR_MIGRATE_PARAM_URI,
- VIR_MIGRATE_PARAM_DEST_NAME,
- VIR_MIGRATE_PARAM_DEST_XML,
- VIR_MIGRATE_PARAM_BANDWIDTH };
- const char *uri = NULL;
- const char *dname = NULL;
- const char *dxml = NULL;
- unsigned long long bandwidth = 0;
-
+ int ret = -1;
VIR_DOMAIN_DEBUG(domain, "dconnuri=%s, params=%p, nparms=%u flags=%x",
NULLSTR(dconnuri), params, nparams, flags);
VIR_TYPED_PARAMS_DEBUG(params, nparams);
virResetLastError();
+ if ((ret = virDomainMigrateToURI_(domain, dconnuri, params, nparams, flags)) < 0)
+ virDispatchError(domain->conn);
- /* First checkout the source */
- virCheckDomainReturn(domain, -1);
- virCheckReadOnlyGoto(domain->conn->flags, error);
-
- VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MIGRATE_NON_SHARED_DISK,
- VIR_MIGRATE_NON_SHARED_INC,
- error);
-
- compat = virTypedParamsCheck(params, nparams, compatParams,
- ARRAY_CARDINALITY(compatParams));
-
- if (virTypedParamsGetString(params, nparams,
- VIR_MIGRATE_PARAM_URI, &uri) < 0 ||
- virTypedParamsGetString(params, nparams,
- VIR_MIGRATE_PARAM_DEST_NAME, &dname) < 0 ||
- virTypedParamsGetString(params, nparams,
- VIR_MIGRATE_PARAM_DEST_XML, &dxml) < 0 ||
- virTypedParamsGetULLong(params, nparams,
- VIR_MIGRATE_PARAM_BANDWIDTH, &bandwidth) < 0) {
- goto error;
- }
-
- if (flags & VIR_MIGRATE_PEER2PEER) {
- if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_P2P)) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("Peer-to-peer migration is not supported by "
- "the connection driver"));
- goto error;
- }
-
- if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_PARAMS)) {
- VIR_DEBUG("Using peer2peer migration with extensible parameters");
- if (virDomainMigratePeer2PeerParams(domain, dconnuri, params,
- nparams, flags) < 0)
- goto error;
- } else if (compat) {
- VIR_DEBUG("Using peer2peer migration");
- if (virDomainMigratePeer2Peer(domain, dxml, flags, dname,
- dconnuri, uri, bandwidth) < 0)
- goto error;
- } else {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("Peer-to-peer migration with extensible "
- "parameters is not supported but extended "
- "parameters were passed"));
- goto error;
- }
- } else {
- if (!VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
- VIR_DRV_FEATURE_MIGRATION_DIRECT)) {
- /* Cannot do a migration with only the perform step */
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("Direct migration is not supported by the"
- " connection driver"));
- goto error;
- }
-
- if (!compat) {
- virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("Direct migration does not support extensible "
- "parameters"));
- goto error;
- }
-
- VIR_DEBUG("Using direct migration");
- if (virDomainMigrateDirect(domain, dxml, flags,
- dname, uri, bandwidth) < 0)
- goto error;
- }
-
- return 0;
-
- error:
- virDispatchError(domain->conn);
- return -1;
+ return ret;
}
--
1.7.1
9 years, 2 months
[libvirt] [PATCH v2 0/3] Implement mockup capabilities cache in QEMU tests
by Pavel Fedin
Since commit e8d55172544c1fafe31a9e09346bdebca4f0d6f9 qemu driver checks
emulator capabilities during domain XML post-parse. However, test suite
does not initialize it, therefore a condition to skip all checks if there
is no cache supplied was added. This is actually a hack, whose sole
purpose is to make existing test suite working. Additionally, it prevents
from writing new tests for this particular functionality.
This series solves this problem by implementing proper cache mockup in test
suite. The main idea is to create a cache in standard way and put there
pre-defined capabilities sets (which tests already have).
In this implementation we introduce "test capability sets", which are named
entities. virQEMUCapsCacheLookup() now has a test mode, which is enabled
by setting qemuTestCapsName variable to the name of capability set which
we want to use in current test. This is based on Martin Kletzander's idea
to implement test mode with assertions. Currently, since name of capability
set is different from /usr/bin/something, we will get errors if we try to
do something with the host filesystem. This is achieved by setting cacheDir
and libDir of our mockup cache to "/dev/null".
The concept of using named capability sets allows us to further improve the
test suite. Now it is possibe to get rid of hardcoded capability sets
and replace them with XML files, readable by virQEMUCapsInitCached().
This will allow us to better exercise our capabilities parser. Taking this
into account, qemuTestCapsCacheInsert() is actually temporary. It will not
be needed any more when capabilities are moved to XML files.
Additionally, some small refactoring is done, and common driver
initialization and cleanup sequence is put into two functions:
qemuTestDriverInit() and qemuTestDriverFree().
V1 => V2
- Fix also domainsnapshotxml2xmltest
RFC => v1
- Major rework, almost everything changed.
Pavel Fedin (3):
Implement infrastracture for mocking up QEMU capabilities cache
Use mockup cache
Removed unneeded check
src/qemu/qemu_capabilities.c | 16 +++++-----
src/qemu/qemu_capspriv.h | 36 +++++++++++++++++++++++
src/qemu/qemu_domain.c | 5 +---
tests/domainsnapshotxml2xmltest.c | 15 +++++-----
tests/qemuagenttest.c | 18 ++++++++----
tests/qemuargv2xmltest.c | 19 ++++++------
tests/qemuhotplugtest.c | 32 ++++++++++----------
tests/qemuxml2argvtest.c | 17 +++++------
tests/qemuxml2xmltest.c | 16 ++++++----
tests/qemuxmlnstest.c | 17 ++++++-----
tests/testutilsqemu.c | 62 +++++++++++++++++++++++++++++++++++++++
tests/testutilsqemu.h | 9 ++++++
12 files changed, 190 insertions(+), 72 deletions(-)
mode change 100644 => 100755 src/qemu/qemu_capabilities.c
create mode 100644 src/qemu/qemu_capspriv.h
mode change 100644 => 100755 tests/qemuagenttest.c
mode change 100644 => 100755 tests/qemuargv2xmltest.c
mode change 100644 => 100755 tests/qemuhotplugtest.c
mode change 100644 => 100755 tests/qemuxml2argvtest.c
mode change 100644 => 100755 tests/qemuxml2xmltest.c
mode change 100644 => 100755 tests/qemuxmlnstest.c
mode change 100644 => 100755 tests/testutilsqemu.c
mode change 100644 => 100755 tests/testutilsqemu.h
--
2.1.4
9 years, 2 months
[libvirt] [PATCH 0/2] Recursively lock backing chain
by Michal Privoznik
This is how I tested the feature:
Create couple of disks:
qemu-img create -f qcow2 /var/lib/libvirt/images/test1.qcow2 1G
qemu-img create -f qcow2 /var/lib/libvirt/images/test2.qcow2 -b /var/lib/libvirt/images/test1.qcow2
qemu-img create -f qcow2 /var/lib/libvirt/images/test3.qcow2 -b /var/lib/libvirt/images/test1.qcow2
Then adjust configuration of two domains:
virsh # domblklist gentoo
Target Source
------------------------------------------------
fda /var/lib/libvirt/images/fd.img
vda /var/lib/libvirt/images/gentoo.qcow2
vdb /var/lib/libvirt/images/test1.qcow2
hdc /home/zippy/tmp/install-amd64-minimal-20150402.iso
virsh # domblklist fedora
Target Source
------------------------------------------------
sda /var/lib/libvirt/images/fedora.qcow2
sdb /var/lib/libvirt/images/test2.qcow2
hda -
With this configuration, fedora and gentoo should not be able to run at the same time:
virsh # start fedora
Domain fedora started
virsh # start gentoo
error: Failed to start domain gentoo
error: resource busy: Lockspace resource '/var/lib/libvirt/images/test1.qcow2' is locked
Cool!
But with slight change, gentoo should be able to run:
virsh # domblklist gentoo
Target Source
------------------------------------------------
fda /var/lib/libvirt/images/fd.img
vda /var/lib/libvirt/images/gentoo.qcow2
vdb /var/lib/libvirt/images/test3.qcow2
hdc /home/zippy/tmp/install-amd64-minimal-20150402.iso
virsh # start gentoo
Domain gentoo started
virsh # list
Id Name State
----------------------------------------------------
10 fedora running
11 gentoo running
Awesome!
Michal Privoznik (2):
qemuProcessStart: Parse backingStore for all disks
virDomainLockManagerAddImage: Recursively lock backing chain
src/locking/domain_lock.c | 53 +++++++++++++++++++++++++++++------------------
src/qemu/qemu_domain.c | 11 +++-------
src/qemu/qemu_process.c | 6 +++++-
3 files changed, 41 insertions(+), 29 deletions(-)
--
2.4.6
9 years, 2 months
[libvirt] Who wants to mentor for Outreachy Dec-Mar?
by Stefan Hajnoczi
We are now looking for mentors for the next round of Outreachy running
from December 7, 2015 to March 7, 2016. I have set up a wiki page
here:
http://qemu-project.org/Outreachy_2015_DecemberMarch
Our communities have participated in previous years to mentor people
from underrepresented groups and help them get involved in open source
software. To learn more, see the Outreachy website:
https://www.gnome.org/outreachy/
If you are a regular contributor to QEMU, libvirt, or the KVM kernel
module then you can become an Outreachy mentor. Information on what's
involved is here:
https://wiki.gnome.org/Outreachy/Admin/InfoForMentors
Mentoring summary:
1. Post your project ideas here:
http://qemu-project.org/Outreachy_2015_DecemberMarch
2. You give each applicant a different small task so they can submit a
patch upstream. You also interview promising candidates on IRC to get
a better picture. Then you select a candidate you wish to work with
(or none).
3. Requires 5 hours/week from December 2015 to March 2016 to mentor
your intern, review their code, answer their questions, etc.
If you'd like to become a mentor, please let me know.
We are also looking for sponsors who wish to fund Outreachy interns
for QEMU, libvirt, and the KVM kernel module. The sponsorship for one
intern is $6,500. Learn more about sponsorship:
https://wiki.gnome.org/Outreachy/Admin/InfoForOrgs
Stefan
9 years, 2 months
[libvirt] [PATCH] Revert "docs: Drop unused rule for internals/%.html.tmp target"
by Martin Kletzander
This reverts commit e5470dd0e0a5be02cbf18a882cfc676b39d1c1a5.
This has been ACK'd by the original author in the original mail thread:
https://www.redhat.com/archives/libvir-list/2015-September/msg00310.html
The reason to revert this is due to the patch breaking the generation of
internal subsites. The original issue still needs to be dealt with,
though.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
configure.ac | 1 -
docs/Makefile.am | 9 +++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index ef7fbdbed32c..03463b048c3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2777,7 +2777,6 @@ AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash]
AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack to avoid symbol clash])
-AC_CONFIG_COMMANDS([mkdir], [$MKDIR_P docs/internals])
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([\
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 263daae448ca..bfae35e0ddba 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -218,6 +218,15 @@ $(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
%.png: %.fig
convert -rotate 90 $< $@
+internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
+ @if [ -x $(XSLTPROC) ] ; then \
+ echo "Generating $@"; \
+ $(MKDIR_P) internals; \
+ name=`echo $@ | sed -e 's/.tmp//'`; \
+ $(XSLTPROC) --stringparam pagename $$name --nonet \
+ $(top_srcdir)/docs/subsite.xsl $< > $@ \
+ || { rm $@ && exit 1; }; fi
+
%.html.tmp: %.html.in site.xsl page.xsl sitemap.html.in $(acl_generated)
@if [ -x $(XSLTPROC) ] ; then \
echo "Generating $@"; \
--
2.5.1
9 years, 2 months