On 05/11/2011 03:09 AM, Daniel P. Berrange wrote: > Migration just seems togo from bad to worse. We already had to s/togo/to go/ > introduce a second migration protocol when adding the QEMU driver, > since the one from Xen was insufficiently flexible to cope with > passing the data the QEMU driver required. > > @@ -643,6 +712,12 @@ struct _virDriver { > virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand; > virDrvDomainOpenConsole domainOpenConsole; > virDrvDomainInjectNMI domainInjectNMI; > + virDrvDomainMigrateBegin3 domainMigrateBegin3; > + virDrvDomainMigratePrepare3 domainMigratePrepare3; > + virDrvDomainMigratePrepareTunnel3 domainMigratePrepareTunnel3; > + virDrvDomainMigratePerform3 domainMigratePerform3; > + virDrvDomainMigrateFinish3 domainMigrateFinish3; > + virDrvDomainMigrateConfirm3 domainMigrateConfirm3; Should we group these callbacks next door to their version2 counterparts to make it easier to find all the migration callbacks next to one another? Up to you; I didn't do it below... > @@ -3691,6 +3898,7 @@ virDomainMigrate (virDomainPtr domain, > return NULL; > } > > + VIR_DEBUG0("Using peer2peer migration"); Recent patch flurry means this won't compile. Isn't rebasing fun? :) > +int > +virDomainMigratePerform3(virDomainPtr domain, > + const char *cookiein, > + int cookieinlen, > + char **cookieout, > + int *cookieoutlen, > + const char *uri, > + unsigned long flags, > + const char *dname, > + unsigned long bandwidth) > +{ > + virConnectPtr conn; > + > + VIR_DOMAIN_DEBUG(domain, "cookiein=%p, cookieinlen=%d, cookieout=%p, cookieoutlen=%p," > + "uri=%s, flags=%lu, dname=%s, bandwidth=%lu", > + cookiein, cookieinlen, cookieout, cookieoutlen, > + uri, flags, NULLSTR(dname), bandwidth); Oh my; 10 arguments. You broke my < 10-argument assumption in one blow :) > + > + virResetLastError(); > + > + if (!VIR_IS_CONNECT (dconn)) { Still some spaces before ( if you want to clean that up. ACK with this squashed in: diff --git i/src/libvirt.c w/src/libvirt.c index ec888b2..aa72fb3 100644 --- i/src/libvirt.c +++ w/src/libvirt.c @@ -312,15 +312,17 @@ static struct gcry_thread_cbs virTLSThreadImpl = { }; /* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This - * assumes you pass fewer than 10 arguments to VIR_DOMAIN_DEBUG, but + * assumes you pass fewer than 15 arguments to VIR_DOMAIN_DEBUG, but * can easily be expanded if needed. * * Note that gcc provides extensions of "define a(b...) b" or * "define a(b,...) b,##__VA_ARGS__" as a means of eliding a comma * when no var-args are present, but we don't want to require gcc. */ -#define VIR_ARG10(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) _10 -#define VIR_HAS_COMMA(...) VIR_ARG10(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 0) +#define VIR_ARG15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ + _11, _12, _13, _14, _15, ...) _15 +#define VIR_HAS_COMMA(...) \ + VIR_ARG15(__VA_ARGS__, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0) /* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro, * according to how many arguments are present. Two-phase due to @@ -3439,7 +3441,7 @@ virDomainMigrateVersion1 (virDomainPtr domain, ddomain = dconn->driver->domainMigrateFinish (dconn, dname, cookie, cookielen, uri, flags); else - ddomain = virDomainLookupByName (dconn, dname); + ddomain = virDomainLookupByName(dconn, dname); done: VIR_FREE (uri_out); @@ -3930,14 +3932,14 @@ virDomainMigrate (virDomainPtr domain, return NULL; } - VIR_DEBUG0("Using peer2peer migration"); + VIR_DEBUG("Using peer2peer migration"); if (virDomainMigratePeer2Peer(domain, flags, dname, uri ? uri : dstURI, bandwidth) < 0) { VIR_FREE(dstURI); goto error; } VIR_FREE(dstURI); - ddomain = virDomainLookupByName (dconn, dname ? dname : domain->name); + ddomain = virDomainLookupByName(dconn, dname ? dname : domain->name); } else { /* This driver does not support peer to peer migration */ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); @@ -3955,19 +3957,19 @@ virDomainMigrate (virDomainPtr domain, VIR_DRV_FEATURE_MIGRATION_V3) && VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, VIR_DRV_FEATURE_MIGRATION_V3)) { - VIR_DEBUG0("Using migration protocol 3"); + VIR_DEBUG("Using migration protocol 3"); ddomain = virDomainMigrateVersion3(domain, dconn, flags, dname, uri, bandwidth); } else if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_V2) && VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, VIR_DRV_FEATURE_MIGRATION_V2)) { - VIR_DEBUG0("Using migration protocol 2"); + VIR_DEBUG("Using migration protocol 2"); ddomain = virDomainMigrateVersion2(domain, dconn, flags, dname, uri, bandwidth); } else if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, VIR_DRV_FEATURE_MIGRATION_V1) && VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn, VIR_DRV_FEATURE_MIGRATION_V1)) { - VIR_DEBUG0("Using migration protocol 1"); + VIR_DEBUG("Using migration protocol 1"); ddomain = virDomainMigrateVersion1(domain, dconn, flags, dname, uri, bandwidth); } else { /* This driver does not support any migration method */ @@ -4122,7 +4124,7 @@ virDomainMigratePrepare (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -4135,9 +4137,9 @@ virDomainMigratePrepare (virConnectPtr dconn, if (dconn->driver->domainMigratePrepare) { int ret; - ret = dconn->driver->domainMigratePrepare (dconn, cookie, cookielen, - uri_in, uri_out, - flags, dname, bandwidth); + ret = dconn->driver->domainMigratePrepare(dconn, cookie, cookielen, + uri_in, uri_out, + flags, dname, bandwidth); if (ret < 0) goto error; return ret; @@ -4218,7 +4220,7 @@ virDomainMigrateFinish (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -4231,9 +4233,9 @@ virDomainMigrateFinish (virConnectPtr dconn, if (dconn->driver->domainMigrateFinish) { virDomainPtr ret; - ret = dconn->driver->domainMigrateFinish (dconn, dname, - cookie, cookielen, - uri, flags); + ret = dconn->driver->domainMigrateFinish(dconn, dname, + cookie, cookielen, + uri, flags); if (!ret) goto error; return ret; @@ -4269,7 +4271,7 @@ virDomainMigratePrepare2 (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -4282,10 +4284,10 @@ virDomainMigratePrepare2 (virConnectPtr dconn, if (dconn->driver->domainMigratePrepare2) { int ret; - ret = dconn->driver->domainMigratePrepare2 (dconn, cookie, cookielen, - uri_in, uri_out, - flags, dname, bandwidth, - dom_xml); + ret = dconn->driver->domainMigratePrepare2(dconn, cookie, cookielen, + uri_in, uri_out, + flags, dname, bandwidth, + dom_xml); if (ret < 0) goto error; return ret; @@ -4317,7 +4319,7 @@ virDomainMigrateFinish2 (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -4330,10 +4332,10 @@ virDomainMigrateFinish2 (virConnectPtr dconn, if (dconn->driver->domainMigrateFinish2) { virDomainPtr ret; - ret = dconn->driver->domainMigrateFinish2 (dconn, dname, - cookie, cookielen, - uri, flags, - retcode); + ret = dconn->driver->domainMigrateFinish2(dconn, dname, + cookie, cookielen, + uri, flags, + retcode); if (!ret) goto error; return ret; @@ -4474,7 +4476,7 @@ virDomainMigratePrepare3(virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -4643,7 +4645,7 @@ virDomainMigrateFinish3(virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list