[PATCH v2 4/7] vz: support domain rename on migrate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 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 d7b93fb..8087165 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1395,7 +1395,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,
@@ -1414,6 +1416,7 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
     virURIPtr vzuri = NULL;
     unsigned char session_uuid[VIR_UUID_BUFLEN];
     vzConnPtr privconn = domain->conn->privateData;
+    const char *dname = NULL;
 
     virCheckFlags(flags, -1);
 
@@ -1423,6 +1426,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;
 
@@ -1437,7 +1445,7 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
     if (virConnectVzGetSessionUUID(dconn, 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]