From: nshirokovskiy(a)virtuozzo.com <nshirokovskiy(a)virtuozzo.com>
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/vz/vz_driver.c | 12 ++++++++++--
src/vz/vz_sdk.c | 16 +++++++++-------
src/vz/vz_sdk.h | 5 ++++-
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index f3fd599..2760e63 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1465,7 +1465,9 @@ vzMakeVzUri(const char *connuri_str)
#define VZ_MIGRATION_FLAGS (VIR_MIGRATE_PEER2PEER)
-#define VZ_MIGRATION_PARAMETERS (NULL)
+#define VZ_MIGRATION_PARAMETERS \
+ VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_STRING, \
+ NULL
static int
vzDomainMigratePerform3Params(virDomainPtr domain,
@@ -1486,6 +1488,7 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
vzConnPtr privconn = domain->conn->privateData;
char *cookie = NULL;
int cookielen = 0;
+ const char *dname = NULL;
virCheckFlags(VZ_MIGRATION_FLAGS, -1);
@@ -1495,6 +1498,11 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
if (!(vzuri = vzMakeVzUri(dconnuri)))
goto cleanup;
+ if (virTypedParamsGetString(params, nparams,
+ VIR_MIGRATE_PARAM_DEST_NAME,
+ &dname) < 0)
+ goto cleanup;
+
if (!(dom = vzDomObjFromDomain(domain)))
goto cleanup;
@@ -1514,7 +1522,7 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
if (vzParseCookie(cookie, session_uuid) < 0)
goto cleanup;
- if (prlsdkMigrate(dom, vzuri, session_uuid) < 0)
+ if (prlsdkMigrate(dom, vzuri, session_uuid, dname) < 0)
goto cleanup;
virDomainObjListRemove(privconn->domains, dom);
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 783438d..89a2429 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -4064,7 +4064,8 @@ prlsdkGetMemoryStats(virDomainObjPtr dom,
#define PRLSDK_MIGRATION_FLAGS (PSL_HIGH_SECURITY)
int prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri,
- const unsigned char *session_uuid)
+ const unsigned char *session_uuid,
+ const char *dname)
{
int ret = -1;
vzDomObjPtr privdom = dom->privateData;
@@ -4072,12 +4073,13 @@ int prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri,
char uuidstr[VIR_UUID_STRING_BUFLEN + 2];
prlsdkUUIDFormat(session_uuid, uuidstr);
- job = PrlVm_MigrateEx(privdom->sdkdom, uri->server, uri->port, uuidstr,
- "", /* use default dir for migrated instance bundle
*/
- PRLSDK_MIGRATION_FLAGS,
- 0, /* reserved flags */
- PRL_TRUE /* don't ask for confirmations */
- );
+ job = PrlVm_MigrateWithRenameEx(privdom->sdkdom, uri->server, uri->port,
uuidstr,
+ dname == NULL ? "" : dname,
+ "", /* use default dir for migrated
instance bundle */
+ PRLSDK_MIGRATION_FLAGS,
+ 0, /* reserved flags */
+ PRL_TRUE /* don't ask for confirmations */
+ );
if (PRL_FAILED(waitJob(job)))
goto cleanup;
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index d3f0caf..0aa70b3 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -77,4 +77,7 @@ prlsdkGetVcpuStats(virDomainObjPtr dom, int idx, unsigned long long
*time);
int
prlsdkGetMemoryStats(virDomainObjPtr dom, virDomainMemoryStatPtr stats, unsigned int
nr_stats);
int
-prlsdkMigrate(virDomainObjPtr dom, virURIPtr uri, const char unsigned *session_uuid);
+prlsdkMigrate(virDomainObjPtr dom,
+ virURIPtr uri,
+ const char unsigned *session_uuid,
+ const char *dname);
--
1.7.1