[PATCH v5 3/5] vz: support domain rename on migrate

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

 



From: nshirokovskiy@xxxxxxxxxxxxx <nshirokovskiy@xxxxxxxxxxxxx>

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/vz/vz_driver.c |    9 ++++++++-
 src/vz/vz_sdk.c    |   16 +++++++++-------
 src/vz/vz_sdk.h    |    5 ++++-
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 36c64e9..e9ca611 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1398,6 +1398,7 @@ vzParseCookie(const char *xml, unsigned char *session_uuid)
 
 #define VZ_MIGRATION_PARAMETERS                                 \
     VIR_MIGRATE_PARAM_URI,              VIR_TYPED_PARAM_STRING, \
+    VIR_MIGRATE_PARAM_DEST_NAME,        VIR_TYPED_PARAM_STRING, \
     NULL
 
 static char*
@@ -1541,12 +1542,18 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
     char *cookie = NULL;
     int cookielen = 0;
     const char *miguri = NULL;
+    const char *dname = NULL;
 
     virCheckFlags(VZ_MIGRATION_FLAGS, -1);
 
     if (virTypedParamsValidate(params, nparams, VZ_MIGRATION_PARAMETERS) < 0)
         goto cleanup;
 
+    if (virTypedParamsGetString(params, nparams,
+                                VIR_MIGRATE_PARAM_DEST_NAME,
+                                &dname) < 0)
+        goto cleanup;
+
     if (!(dom = vzDomObjFromDomain(domain)))
         goto cleanup;
 
@@ -1579,7 +1586,7 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
     if (!(vzuri = vzParseVzURI(miguri)))
         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]