diff --git a/ChangeLog b/ChangeLog index a545f846ec6c2cc15261c4cfaf270f4156553e26..f2a6ec71245b6212db86bc8a244889818aba9329 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Jun 11 16:22:22 CEST 2009 Daniel Veillard + + * 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 * src/qemu_conf.[ch]: make qemuParseHelpStr() available @@ -13,7 +21,7 @@ Thu Jun 11 15:17:12 GMT 2009 Mark McLoughlin Thu Jun 11 15:15:02 GMT 2009 Mark McLoughlin * src/qemu_conf.c: re-factor qemu version parsing. - + Thu Jun 11 15:14:37 CEST 2009 Daniel Veillard * configure.in src/libvirt_private.syms src/storage_backend_fs.c diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index ae6654c323600f71b75f245f49e5ddc681018657..78bd6a8f2944af80c068f6a9c891681a15155fcc 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -283,6 +283,11 @@ + + + + + diff --git a/src/node_device_conf.c b/src/node_device_conf.c index 85fba670cb5496e951e3dba7dfe3efa3bd6c3e47..be198438e031f0c6bad6291858620028e24a7dc1 100644 --- a/src/node_device_conf.c +++ b/src/node_device_conf.c @@ -365,6 +365,9 @@ char *virNodeDeviceDefFormat(virConnectPtr conn, if (data->storage.vendor) virBufferVSprintf(&buf, " %s\n", data->storage.vendor); + if (data->storage.serial) + virBufferVSprintf(&buf, " %s\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; @@ -479,6 +482,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, @@ -1202,6 +1206,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 62b4e71a6505d4b52c8417b2ef237c9f7dc31806..522dfde4840d9888578dc48a1542437b98a5628f 100644 --- a/src/node_device_conf.h +++ b/src/node_device_conf.h @@ -143,6 +143,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 54effc04197b85696f2480f1ba2622ba3953f51b..b2af7a05200a6774ac786de04e9728e78c1b81e4 100644 --- a/src/node_device_hal.c +++ b/src/node_device_hal.c @@ -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.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", diff --git a/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml b/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml new file mode 100644 index 0000000000000000000000000000000000000000..e341f39c5b33097a0a0db7cdc07cb2442a0950a1 --- /dev/null +++ b/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml @@ -0,0 +1,15 @@ + + storage_serial_3600c0ff000d7a2a5d463ff4902000000 + pci_10df_fe00_scsi_host_scsi_device_lun8 + + /dev/sdj + pci + disk + MSA2012fc + HP + 3600c0ff000d7a2a5d463ff4902000000 + 15626928128 + + + +