mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
extract serial number from HAL storage backend
* src/node_device_hal.c src/node_device_conf.[ch]: add support for serial number in HAL storage backend, patch by Dave Allan * docs/schemas/nodedev.rng tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml: update the schemas and add a test case, also by Dave Allan Daniel
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,11 @@
|
|||||||
|
Thu Jun 11 16:22:22 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/node_device_hal.c src/node_device_conf.[ch]: add support
|
||||||
|
for serial number in HAL storage backend, patch by Dave Allan
|
||||||
|
* docs/schemas/nodedev.rng
|
||||||
|
tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml:
|
||||||
|
update the schemas and add a test case, also by Dave Allan
|
||||||
|
|
||||||
Thu Jun 11 15:18:44 GMT 2009 Mark McLoughlin <markmc@redhat.com>
|
Thu Jun 11 15:18:44 GMT 2009 Mark McLoughlin <markmc@redhat.com>
|
||||||
|
|
||||||
* src/qemu_conf.[ch]: make qemuParseHelpStr() available
|
* src/qemu_conf.[ch]: make qemuParseHelpStr() available
|
||||||
@@ -13,7 +21,7 @@ Thu Jun 11 15:17:12 GMT 2009 Mark McLoughlin <markmc@redhat.com>
|
|||||||
Thu Jun 11 15:15:02 GMT 2009 Mark McLoughlin <markmc@redhat.com>
|
Thu Jun 11 15:15:02 GMT 2009 Mark McLoughlin <markmc@redhat.com>
|
||||||
|
|
||||||
* src/qemu_conf.c: re-factor qemu version parsing.
|
* src/qemu_conf.c: re-factor qemu version parsing.
|
||||||
|
|
||||||
Thu Jun 11 15:14:37 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
Thu Jun 11 15:14:37 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* configure.in src/libvirt_private.syms src/storage_backend_fs.c
|
* configure.in src/libvirt_private.syms src/storage_backend_fs.c
|
||||||
|
|||||||
@@ -283,6 +283,11 @@
|
|||||||
<text/>
|
<text/>
|
||||||
</element>
|
</element>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name='serial'>
|
||||||
|
<text/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
|
|
||||||
<choice>
|
<choice>
|
||||||
<ref name='capstorageremoveable'/>
|
<ref name='capstorageremoveable'/>
|
||||||
|
|||||||
@@ -365,6 +365,9 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
|
|||||||
if (data->storage.vendor)
|
if (data->storage.vendor)
|
||||||
virBufferVSprintf(&buf, " <vendor>%s</vendor>\n",
|
virBufferVSprintf(&buf, " <vendor>%s</vendor>\n",
|
||||||
data->storage.vendor);
|
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) {
|
if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) {
|
||||||
int avl = data->storage.flags &
|
int avl = data->storage.flags &
|
||||||
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
|
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
|
||||||
@@ -479,6 +482,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
|
|||||||
data->storage.drive_type = virXPathString(conn, "string(./drive_type[1])", ctxt);
|
data->storage.drive_type = virXPathString(conn, "string(./drive_type[1])", ctxt);
|
||||||
data->storage.model = virXPathString(conn, "string(./model[1])", ctxt);
|
data->storage.model = virXPathString(conn, "string(./model[1])", ctxt);
|
||||||
data->storage.vendor = virXPathString(conn, "string(./vendor[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) {
|
if ((n = virXPathNodeSet(conn, "./capability", ctxt, &nodes)) < 0) {
|
||||||
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
@@ -1202,6 +1206,7 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
|
|||||||
VIR_FREE(data->storage.drive_type);
|
VIR_FREE(data->storage.drive_type);
|
||||||
VIR_FREE(data->storage.model);
|
VIR_FREE(data->storage.model);
|
||||||
VIR_FREE(data->storage.vendor);
|
VIR_FREE(data->storage.vendor);
|
||||||
|
VIR_FREE(data->storage.serial);
|
||||||
break;
|
break;
|
||||||
case VIR_NODE_DEV_CAP_LAST:
|
case VIR_NODE_DEV_CAP_LAST:
|
||||||
/* This case is here to shutup the compiler */
|
/* This case is here to shutup the compiler */
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ struct _virNodeDevCapsDef {
|
|||||||
char *drive_type;
|
char *drive_type;
|
||||||
char *model;
|
char *model;
|
||||||
char *vendor;
|
char *vendor;
|
||||||
|
char *serial;
|
||||||
unsigned flags; /* virNodeDevStorageCapFlags bits */
|
unsigned flags; /* virNodeDevStorageCapFlags bits */
|
||||||
} storage;
|
} storage;
|
||||||
} data;
|
} data;
|
||||||
|
|||||||
@@ -255,6 +255,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.drive_type", &d->storage.drive_type);
|
||||||
(void)get_str_prop(ctx, udi, "storage.model", &d->storage.model);
|
(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.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) {
|
if (get_bool_prop(ctx, udi, "storage.removable", &val) == 0 && val) {
|
||||||
d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE;
|
d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE;
|
||||||
if (get_bool_prop(ctx, udi, "storage.removable.media_available",
|
if (get_bool_prop(ctx, udi, "storage.removable.media_available",
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<device>
|
||||||
|
<name>storage_serial_3600c0ff000d7a2a5d463ff4902000000</name>
|
||||||
|
<parent>pci_10df_fe00_scsi_host_scsi_device_lun8</parent>
|
||||||
|
<capability type='storage'>
|
||||||
|
<block>/dev/sdj</block>
|
||||||
|
<bus>pci</bus>
|
||||||
|
<drive_type>disk</drive_type>
|
||||||
|
<model>MSA2012fc</model>
|
||||||
|
<vendor>HP</vendor>
|
||||||
|
<serial>3600c0ff000d7a2a5d463ff4902000000</serial>
|
||||||
|
<size>15626928128</size>
|
||||||
|
</capability>
|
||||||
|
</device>
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user