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

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

 



From: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>

---
 src/vz/vz_driver.c |   12 +++++++++---
 src/vz/vz_sdk.c    |    5 +++--
 src/vz/vz_sdk.h    |    5 ++++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index d5cbdc6..a42597c 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -1354,7 +1354,9 @@ vzConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
     }
 }
 
-#define VZ_MIGRATION_PARAMETERS NULL
+#define VZ_MIGRATION_PARAMETERS                                 \
+    VIR_MIGRATE_PARAM_DEST_NAME,        VIR_TYPED_PARAM_STRING, \
+    NULL
 
 static char *
 vzDomainMigrateBegin3Params(virDomainPtr domain,
@@ -1558,12 +1560,16 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
     virDomainObjPtr dom = NULL;
     const char *uri = NULL;
     unsigned char session_uuid[VIR_UUID_BUFLEN];
+    const char *dname = NULL;
 
     *cookieout = NULL;
 
     if (virTypedParamsGetString(params, nparams,
                                 VIR_MIGRATE_PARAM_URI,
-                                &uri) < 0)
+                                &uri) < 0 ||
+        virTypedParamsGetString(params, nparams,
+                                VIR_MIGRATE_PARAM_DEST_NAME,
+                                &dname) < 0)
         goto cleanup;
 
     if (!(dom = vzDomObjFromDomain(domain)))
@@ -1578,7 +1584,7 @@ vzDomainMigratePerform3Params(virDomainPtr domain,
     if (vzParseCookie1(cookiein, session_uuid) < 0)
         goto cleanup;
 
-    if (prlsdkMigrate(dom, uri, session_uuid) < 0)
+    if (prlsdkMigrate(dom, uri, session_uuid, dname) < 0)
         goto cleanup;
 
     if (!(*cookieout = vzFormatCookie2(dom->def->uuid)))
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index a329c68..f1fa6da 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -4067,7 +4067,7 @@ prlsdkGetMemoryStats(virDomainObjPtr dom,
 #define PRLSDK_MIGRATION_FLAGS (PSL_HIGH_SECURITY)
 
 int prlsdkMigrate(virDomainObjPtr dom, const char* uri_str,
-                  const unsigned char *session_uuid)
+                  const unsigned char *session_uuid, const char *dname)
 {
     int ret = -1;
     vzDomObjPtr privdom = dom->privateData;
@@ -4081,7 +4081,8 @@ int prlsdkMigrate(virDomainObjPtr dom, const char* uri_str,
         goto cleanup;
 
     prlsdkUUIDFormat(session_uuid, uuidstr);
-    job = PrlVm_MigrateEx(privdom->sdkdom, uri->server, uri->port, uuidstr,
+    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 */
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index 1a90eca..971f913 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, const char* uri_str, const char unsigned *session_uuid);
+prlsdkMigrate(virDomainObjPtr dom,
+              const char* uri_str,
+              const unsigned char *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]