[PATCH 2/4] conf: Parse and format disk <wwn>

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

 



* src/conf/domain_conf.h: New member 'wwn' for disk def.
* src/conf/domain_conf.c: Parse and format disk <wwn>
---
 src/conf/domain_conf.c |    8 ++++++++
 src/conf/domain_conf.h |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 224aec5..1ed54a6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -950,6 +950,7 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
     VIR_FREE(def->mirror);
     VIR_FREE(def->mirrorFormat);
     VIR_FREE(def->auth.username);
+    VIR_FREE(def->wwn);
     if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_USAGE)
         VIR_FREE(def->auth.secret.usage);
     virStorageEncryptionFree(def->encryption);
@@ -3398,6 +3399,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
     char *authUUID = NULL;
     char *usageType = NULL;
     char *tray = NULL;
+    char *wwn = NULL;
 
     if (VIR_ALLOC(def) < 0) {
         virReportOOMError();
@@ -3700,6 +3702,9 @@ virDomainDiskDefParseXML(virCapsPtr caps,
             } else if (!serial &&
                        xmlStrEqual(cur->name, BAD_CAST "serial")) {
                 serial = (char *)xmlNodeGetContent(cur);
+            } else if (!wwn &&
+                       xmlStrEqual(cur->name, BAD_CAST "wwn")) {
+                wwn = (char *)xmlNodeGetContent(cur);
             } else if (xmlStrEqual(cur->name, BAD_CAST "boot")) {
                 /* boot is parsed as part of virDomainDeviceInfoParseXML */
             }
@@ -3996,6 +4001,8 @@ virDomainDiskDefParseXML(virCapsPtr caps,
     encryption = NULL;
     def->serial = serial;
     serial = NULL;
+    def->wwn = wwn;
+    wwn = NULL;
 
     if (!def->driverType &&
         caps->defaultDiskDriverType &&
@@ -11557,6 +11564,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
     if (def->transient)
         virBufferAddLit(buf, "      <transient/>\n");
     virBufferEscapeString(buf, "      <serial>%s</serial>\n", def->serial);
+    virBufferEscapeString(buf, "      <wwn>%s</wwn>\n", def->wwn);
     if (def->encryption) {
         virBufferAdjustIndent(buf, 6);
         if (virStorageEncryptionFormat(buf, def->encryption) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9ee57e1..9a05f4e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -571,6 +571,7 @@ struct _virDomainDiskDef {
     virDomainBlockIoTuneInfo blkdeviotune;
 
     char *serial;
+    char *wwn;
     int cachemode;
     int error_policy;  /* enum virDomainDiskErrorPolicy */
     int rerror_policy; /* enum virDomainDiskErrorPolicy */
-- 
1.7.7.3

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