Re: [PATCH 2/2] vz: support setting disk serial number

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

 



On 20.10.2016 14:09, Maxim Nestratov wrote:
Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
---
  src/vz/vz_sdk.c   | 19 +++++++++++++++++++
  src/vz/vz_utils.c |  5 -----
  2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index b5b0197..f27441d 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -590,6 +590,7 @@ prlsdkGetDiskInfo(vzDriverPtr driver,
                    bool isCt)
  {
      char *buf = NULL;
+    char *serial = NULL;
      PRL_RESULT pret;
      PRL_UINT32 emulatedType;
      virDomainDeviceDriveAddressPtr address;
@@ -626,6 +627,18 @@ prlsdkGetDiskInfo(vzDriverPtr driver,
      if (*buf != '\0' && virDomainDiskSetSource(disk, buf) < 0)
          goto cleanup;
+ serial = prlsdkGetStringParamVar(PrlVmDevHd_GetSerialNumber, prldisk);
+    if (serial) {
+        if (virSafeSerialParamValue(serial) < 0)
+            goto cleanup;
+
+        if (*serial == '\0')
+            VIR_FREE(serial);
+        else
+            disk->serial = serial;
+        serial = NULL;
+    }
+
      if (prlsdkGetDiskId(prldisk, &disk->bus, &disk->dst) < 0)
          goto cleanup;
@@ -643,6 +656,7 @@ prlsdkGetDiskInfo(vzDriverPtr driver, cleanup:
      VIR_FREE(buf);
+    VIR_FREE(serial);
      return ret;
  }
@@ -3489,6 +3503,11 @@ static int prlsdkConfigureDisk(vzDriverPtr driver,
      pret = PrlVmDev_SetIfaceType(sdkdisk, sdkbus);
      prlsdkCheckRetGoto(pret, cleanup);
+ if (disk->serial) {
+        pret = PrlVmDevHd_SetSerialNumber(sdkdisk, disk->serial);
+        prlsdkCheckRetGoto(pret, cleanup);
+    }
+
      pret = PrlVmDev_SetStackIndex(sdkdisk, idx);
      prlsdkCheckRetGoto(pret, cleanup);
diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c
index eaf09f2..f68b3a1 100644
--- a/src/vz/vz_utils.c
+++ b/src/vz/vz_utils.c
@@ -323,11 +323,6 @@ vzCheckDiskUnsupportedParams(virDomainDiskDefPtr disk)
          return -1;
      }
- if (disk->serial) {
-        VIR_INFO("%s", _("Setting disk serial number is not "
-                         "supported by vz driver."));
-    }
-
      if (disk->wwn) {
          virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("Setting disk wwn id is not "

ACK

--
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]