[libvirt] [PATCH 1/1] Add support for serial number in HAL storage

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

 



---
 src/node_device_conf.c |    5 +++++
 src/node_device_conf.h |    1 +
 src/node_device_hal.c  |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/node_device_conf.c b/src/node_device_conf.c
index 2360427..e37295a 100644
--- a/src/node_device_conf.c
+++ b/src/node_device_conf.c
@@ -325,6 +325,9 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
             if (data->storage.vendor)
                 virBufferVSprintf(&buf, "    <vendor>%s</vendor>\n",
                                   data->storage.vendor);
+            if (data->storage.serial)
+                virBufferVSprintf(&buf, "    <serial>%s</serial>\n",
+                                  data->storage.serial);
             if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) {
                 int avl = data->storage.flags &
                     VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
@@ -439,6 +442,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
     data->storage.drive_type = virXPathString(conn, "string(./drive_type[1])", ctxt);
     data->storage.model      = virXPathString(conn, "string(./model[1])", ctxt);
     data->storage.vendor     = virXPathString(conn, "string(./vendor[1])", ctxt);
+    data->storage.serial     = virXPathString(conn, "string(./serial[1])", ctxt);
 
     if ((n = virXPathNodeSet(conn, "./capability", ctxt, &nodes)) < 0) {
         virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -1091,6 +1095,7 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
         VIR_FREE(data->storage.drive_type);
         VIR_FREE(data->storage.model);
         VIR_FREE(data->storage.vendor);
+        VIR_FREE(data->storage.serial);
         break;
     case VIR_NODE_DEV_CAP_LAST:
         /* This case is here to shutup the compiler */
diff --git a/src/node_device_conf.h b/src/node_device_conf.h
index 26e5558..8919335 100644
--- a/src/node_device_conf.h
+++ b/src/node_device_conf.h
@@ -124,6 +124,7 @@ struct _virNodeDevCapsDef {
             char *drive_type;
             char *model;
             char *vendor;
+            char *serial;
             unsigned flags;	/* virNodeDevStorageCapFlags bits */
         } storage;
     } data;
diff --git a/src/node_device_hal.c b/src/node_device_hal.c
index 2f7ca8d..2998b02 100644
--- a/src/node_device_hal.c
+++ b/src/node_device_hal.c
@@ -240,6 +240,7 @@ static int gather_storage_cap(LibHalContext *ctx, const char *udi,
     (void)get_str_prop(ctx, udi, "storage.drive_type", &d->storage.drive_type);
     (void)get_str_prop(ctx, udi, "storage.model", &d->storage.model);
     (void)get_str_prop(ctx, udi, "storage.vendor", &d->storage.vendor);
+    (void)get_str_prop(ctx, udi, "storage.serial", &d->storage.serial);
     if (get_bool_prop(ctx, udi, "storage.removable", &val) == 0 && val) {
         d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE;
         if (get_bool_prop(ctx, udi, "storage.removable.media_available",
-- 
1.6.0.6

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