libxl: rename migration APIs to include Src or Dst in their name

Inspired by commit ffb7954f to improve readability of the libxl
migration APIs.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Jim Fehlig 2018-03-20 11:42:56 -06:00
parent 4f28d7f98c
commit 04b4cf5210
3 changed files with 144 additions and 143 deletions

View File

@ -5897,7 +5897,7 @@ libxlDomainMigrateBegin3Params(virDomainPtr domain,
goto cleanup;
}
xmlout = libxlDomainMigrationBegin(domain->conn, vm, xmlin,
xmlout = libxlDomainMigrationSrcBegin(domain->conn, vm, xmlin,
cookieout, cookieoutlen);
cleanup:
@ -5943,13 +5943,13 @@ libxlDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
goto error;
if (!(def = libxlDomainMigrationPrepareDef(driver, dom_xml, dname)))
if (!(def = libxlDomainMigrationDstPrepareDef(driver, dom_xml, dname)))
goto error;
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
goto error;
if (libxlDomainMigrationPrepareTunnel3(dconn, st, &def, cookiein,
if (libxlDomainMigrationDstPrepareTunnel3(dconn, st, &def, cookiein,
cookieinlen, flags) < 0)
goto error;
@ -5998,13 +5998,13 @@ libxlDomainMigratePrepare3Params(virConnectPtr dconn,
goto error;
if (!(def = libxlDomainMigrationPrepareDef(driver, dom_xml, dname)))
if (!(def = libxlDomainMigrationDstPrepareDef(driver, dom_xml, dname)))
goto error;
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
goto error;
if (libxlDomainMigrationPrepare(dconn, &def, uri_in, uri_out,
if (libxlDomainMigrationDstPrepare(dconn, &def, uri_in, uri_out,
cookiein, cookieinlen, flags) < 0)
goto error;
@ -6061,11 +6061,11 @@ libxlDomainMigratePerform3Params(virDomainPtr dom,
goto cleanup;
if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) {
if (libxlDomainMigrationPerformP2P(driver, vm, dom->conn, dom_xml,
if (libxlDomainMigrationSrcPerformP2P(driver, vm, dom->conn, dom_xml,
dconnuri, uri, dname, flags) < 0)
goto cleanup;
} else {
if (libxlDomainMigrationPerform(driver, vm, dom_xml, dconnuri,
if (libxlDomainMigrationSrcPerform(driver, vm, dom_xml, dconnuri,
uri, dname, flags) < 0)
goto cleanup;
}
@ -6127,7 +6127,7 @@ libxlDomainMigrateFinish3Params(virConnectPtr dconn,
return NULL;
}
ret = libxlDomainMigrationFinish(dconn, vm, flags, cancelled);
ret = libxlDomainMigrationDstFinish(dconn, vm, flags, cancelled);
libxlDomainObjEndJob(driver, vm);
@ -6164,7 +6164,7 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,
if (virDomainMigrateConfirm3ParamsEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
ret = libxlDomainMigrationConfirm(driver, vm, flags, cancelled);
ret = libxlDomainMigrationSrcConfirm(driver, vm, flags, cancelled);
cleanup:
virDomainObjEndAPI(&vm);

View File

@ -256,7 +256,7 @@ libxlMigrationDstArgsOnceInit(void)
VIR_ONCE_GLOBAL_INIT(libxlMigrationDstArgs)
static void
libxlDoMigrateReceive(void *opaque)
libxlDoMigrateDstReceive(void *opaque)
{
libxlMigrationDstArgs *args = opaque;
virDomainObjPtr vm = args->vm;
@ -306,7 +306,7 @@ libxlDoMigrateReceive(void *opaque)
static void
libxlMigrateReceive(virNetSocketPtr sock,
libxlMigrateDstReceive(virNetSocketPtr sock,
int events ATTRIBUTE_UNUSED,
void *opaque)
{
@ -335,7 +335,7 @@ libxlMigrateReceive(virNetSocketPtr sock,
*/
args->recvfd = recvfd;
if (virThreadCreate(&thread, false,
libxlDoMigrateReceive, args) < 0) {
libxlDoMigrateDstReceive, args) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to create thread for receiving migration data"));
goto fail;
@ -357,7 +357,7 @@ libxlMigrateReceive(virNetSocketPtr sock,
}
static int
libxlDoMigrateSend(libxlDriverPrivatePtr driver,
libxlDoMigrateSrcSend(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
unsigned long flags,
int sockfd)
@ -395,7 +395,7 @@ libxlDomainMigrationIsAllowed(virDomainDefPtr def)
}
char *
libxlDomainMigrationBegin(virConnectPtr conn,
libxlDomainMigrationSrcBegin(virConnectPtr conn,
virDomainObjPtr vm,
const char *xmlin,
char **cookieout,
@ -449,7 +449,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
}
virDomainDefPtr
libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver,
libxlDomainMigrationDstPrepareDef(libxlDriverPrivatePtr driver,
const char *dom_xml,
const char *dname)
{
@ -554,7 +554,7 @@ libxlDomainMigrationPrepareAny(virConnectPtr dconn,
}
int
libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
virStreamPtr st,
virDomainDefPtr *def,
const char *cookiein,
@ -619,7 +619,7 @@ libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
args->nsocks = 0;
mig = NULL;
if (virThreadCreate(&thread, false, libxlDoMigrateReceive, args) < 0) {
if (virThreadCreate(&thread, false, libxlDoMigrateDstReceive, args) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to create thread for receiving migration data"));
goto error;
@ -645,7 +645,7 @@ libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
}
int
libxlDomainMigrationPrepare(virConnectPtr dconn,
libxlDomainMigrationDstPrepare(virConnectPtr dconn,
virDomainDefPtr *def,
const char *uri_in,
char **uri_out,
@ -782,7 +782,7 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
if (virNetSocketAddIOCallback(socks[i],
VIR_EVENT_HANDLE_READABLE,
libxlMigrateReceive,
libxlMigrateDstReceive,
args,
NULL) < 0)
continue;
@ -834,10 +834,10 @@ struct _libxlTunnelMigrationThread {
/*
* The data flow of tunnel3 migration in the src side:
* libxlDoMigrateSend() -> pipe
* libxlTunnel3MigrationFunc() polls pipe out and then write to dest stream.
* libxlDoMigrateSrcSend() -> pipe
* libxlTunnel3MigrationSrcFunc() polls pipe out and then write to dest stream.
*/
static void libxlTunnel3MigrationFunc(void *arg)
static void libxlTunnel3MigrationSrcFunc(void *arg)
{
libxlTunnelMigrationThread *data = (libxlTunnelMigrationThread *)arg;
char *buffer = NULL;
@ -858,7 +858,7 @@ static void libxlTunnel3MigrationFunc(void *arg)
if (errno == EAGAIN || errno == EINTR)
continue;
virReportError(errno, "%s",
_("poll failed in libxlTunnel3MigrationFunc"));
_("poll failed in libxlTunnel3MigrationSrcFunc"));
goto cleanup;
}
@ -904,7 +904,7 @@ struct libxlTunnelControl {
};
static int
libxlMigrationStartTunnel(libxlDriverPrivatePtr driver,
libxlMigrationSrcStartTunnel(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
unsigned long flags,
virStreamPtr st,
@ -931,7 +931,7 @@ libxlMigrationStartTunnel(libxlDriverPrivatePtr driver,
/* Write to dest stream */
arg->st = st;
if (virThreadCreate(&tc->thread, true,
libxlTunnel3MigrationFunc, arg) < 0) {
libxlTunnel3MigrationSrcFunc, arg) < 0) {
virReportError(errno, "%s",
_("Unable to create tunnel migration thread"));
goto out;
@ -939,16 +939,17 @@ libxlMigrationStartTunnel(libxlDriverPrivatePtr driver,
virObjectUnlock(vm);
/* Send data to pipe */
ret = libxlDoMigrateSend(driver, vm, flags, tc->dataFD[1]);
ret = libxlDoMigrateSrcSend(driver, vm, flags, tc->dataFD[1]);
virObjectLock(vm);
out:
/* libxlMigrationStopTunnel will be called in libxlDoMigrateP2P to free
* all resources for us. */
/* libxlMigrationSrcStopTunnel will be called in libxlDoMigrateSrcP2P
* to free all resources for us.
*/
return ret;
}
static void libxlMigrationStopTunnel(struct libxlTunnelControl *tc)
static void libxlMigrationSrcStopTunnel(struct libxlTunnelControl *tc)
{
if (!tc)
return;
@ -966,7 +967,7 @@ static void libxlMigrationStopTunnel(struct libxlTunnelControl *tc)
* introduced in libxl.
*/
static int
libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
libxlDoMigrateSrcP2P(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virConnectPtr sconn,
const char *xmlin,
@ -992,7 +993,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
virStreamPtr st = NULL;
struct libxlTunnelControl *tc = NULL;
dom_xml = libxlDomainMigrationBegin(sconn, vm, xmlin,
dom_xml = libxlDomainMigrationSrcBegin(sconn, vm, xmlin,
&cookieout, &cookieoutlen);
if (!dom_xml)
goto cleanup;
@ -1048,9 +1049,9 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
VIR_DEBUG("Perform3 uri=%s", NULLSTR(uri_out));
if (flags & VIR_MIGRATE_TUNNELLED)
ret = libxlMigrationStartTunnel(driver, vm, flags, st, &tc);
ret = libxlMigrationSrcStartTunnel(driver, vm, flags, st, &tc);
else
ret = libxlDomainMigrationPerform(driver, vm, NULL, NULL,
ret = libxlDomainMigrationSrcPerform(driver, vm, NULL, NULL,
uri_out, NULL, flags);
if (ret < 0)
orig_err = virSaveLastError();
@ -1082,7 +1083,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
orig_err = virSaveLastError();
VIR_DEBUG("Confirm3 cancelled=%d vm=%p", cancelled, vm);
ret = libxlDomainMigrationConfirm(driver, vm, flags, cancelled);
ret = libxlDomainMigrationSrcConfirm(driver, vm, flags, cancelled);
if (ret < 0)
VIR_WARN("Guest %s probably left in 'paused' state on source",
@ -1090,7 +1091,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr driver,
cleanup:
if (flags & VIR_MIGRATE_TUNNELLED) {
libxlMigrationStopTunnel(tc);
libxlMigrationSrcStopTunnel(tc);
virObjectUnref(st);
}
@ -1129,7 +1130,7 @@ static virConnectAuth virConnectAuthConfig = {
* the migration process with an established virConnectPtr to the destination.
*/
int
libxlDomainMigrationPerformP2P(libxlDriverPrivatePtr driver,
libxlDomainMigrationSrcPerformP2P(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virConnectPtr sconn,
const char *xmlin,
@ -1170,7 +1171,7 @@ libxlDomainMigrationPerformP2P(libxlDriverPrivatePtr driver,
goto cleanup;
}
ret = libxlDoMigrateP2P(driver, vm, sconn, xmlin, dconn, dconnuri,
ret = libxlDoMigrateSrcP2P(driver, vm, sconn, xmlin, dconn, dconnuri,
dname, uri_str, flags);
cleanup:
@ -1187,7 +1188,7 @@ libxlDomainMigrationPerformP2P(libxlDriverPrivatePtr driver,
}
int
libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
libxlDomainMigrationSrcPerform(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
const char *dom_xml ATTRIBUTE_UNUSED,
const char *dconnuri ATTRIBUTE_UNUSED,
@ -1233,7 +1234,7 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
/* suspend vm and send saved data to dst through socket fd */
virObjectUnlock(vm);
ret = libxlDoMigrateSend(driver, vm, flags, sockfd);
ret = libxlDoMigrateSrcSend(driver, vm, flags, sockfd);
virObjectLock(vm);
if (ret < 0)
@ -1249,7 +1250,7 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
}
virDomainPtr
libxlDomainMigrationFinish(virConnectPtr dconn,
libxlDomainMigrationDstFinish(virConnectPtr dconn,
virDomainObjPtr vm,
unsigned int flags,
int cancelled)
@ -1350,7 +1351,7 @@ libxlDomainMigrationFinish(virConnectPtr dconn,
}
int
libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
libxlDomainMigrationSrcConfirm(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
unsigned int flags,
int cancelled)
@ -1361,7 +1362,7 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
int ret = -1;
if (cancelled) {
/* Resume lock process that was paused in MigrationPerform */
/* Resume lock process that was paused in MigrationSrcPerform */
virDomainLockProcessResume(driver->lockManager,
"xen:///system",
vm,

View File

@ -42,19 +42,19 @@
NULL
char *
libxlDomainMigrationBegin(virConnectPtr conn,
libxlDomainMigrationSrcBegin(virConnectPtr conn,
virDomainObjPtr vm,
const char *xmlin,
char **cookieout,
int *cookieoutlen);
virDomainDefPtr
libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver,
libxlDomainMigrationDstPrepareDef(libxlDriverPrivatePtr driver,
const char *dom_xml,
const char *dname);
int
libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dconn,
virStreamPtr st,
virDomainDefPtr *def,
const char *cookiein,
@ -62,7 +62,7 @@ libxlDomainMigrationPrepareTunnel3(virConnectPtr dconn,
unsigned int flags);
int
libxlDomainMigrationPrepare(virConnectPtr dconn,
libxlDomainMigrationDstPrepare(virConnectPtr dconn,
virDomainDefPtr *def,
const char *uri_in,
char **uri_out,
@ -71,7 +71,7 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
unsigned int flags);
int
libxlDomainMigrationPerformP2P(libxlDriverPrivatePtr driver,
libxlDomainMigrationSrcPerformP2P(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virConnectPtr sconn,
const char *dom_xml,
@ -81,7 +81,7 @@ libxlDomainMigrationPerformP2P(libxlDriverPrivatePtr driver,
unsigned int flags);
int
libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
libxlDomainMigrationSrcPerform(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
const char *dom_xml,
const char *dconnuri,
@ -90,13 +90,13 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
unsigned int flags);
virDomainPtr
libxlDomainMigrationFinish(virConnectPtr dconn,
libxlDomainMigrationDstFinish(virConnectPtr dconn,
virDomainObjPtr vm,
unsigned int flags,
int cancelled);
int
libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
libxlDomainMigrationSrcConfirm(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
unsigned int flags,
int cancelled);