diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
index 706027429523c2462cc4d75d5753e2c192034884..797b1aff67d42f28d5b5c953d862bb2461b8dec0 100644
--- a/docs/schemas/nodedev.rng
+++ b/docs/schemas/nodedev.rng
@@ -314,6 +314,11 @@
+
+
+
+
+
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 2a722744f9765c090ec0fc10dae5ce242671eadc..4e8a492c8c143bf1a8dc9ba1de6e98833aecf608 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -446,6 +446,11 @@ char *virNodeDeviceDefFormat(virConnectPtr conn,
"\n", avl ? 1 : 0);
virBufferVSprintf(&buf, " %llu\n",
data->storage.removable_media_size);
+ if (data->storage.media_label)
+ virBufferEscapeString(&buf,
+ " %s\n",
+ data->storage.media_label);
+
if (data->storage.logical_block_size > 0)
virBufferVSprintf(&buf, " %llu"
"\n",
@@ -598,6 +603,8 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
if (virXPathBoolean(conn, "count(./media_available[. = '1']) > 0", ctxt))
data->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
+ data->storage.media_label = virXPathString(conn, "string(./media_label[1])", ctxt);
+
val = 0;
if (virNodeDevCapsDefParseULongLong(conn, "number(./media_size[1])", ctxt, &val, def,
_("no removable media size supplied for '%s'"),
@@ -1459,6 +1466,7 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
VIR_FREE(data->storage.model);
VIR_FREE(data->storage.vendor);
VIR_FREE(data->storage.serial);
+ VIR_FREE(data->storage.media_label);
break;
case VIR_NODE_DEV_CAP_LAST:
/* This case is here to shutup the compiler */
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 4bfac907751a182aca50a6ec646bcd60f8431842..318fa3e03d6cb59a4c0b7286adfefb450d50f9ac 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -170,6 +170,7 @@ struct _virNodeDevCapsDef {
char *model;
char *vendor;
char *serial;
+ char *media_label;
unsigned flags; /* virNodeDevStorageCapFlags bits */
} storage;
} data;
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index cf23be11d5cb715bfc149dd4f6a3f39bde9f580e..422a713435d37946f3b977d92ac6dbf22e9d3b3e 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -868,6 +868,11 @@ static int udevProcessCDROM(struct udev_device *device,
def->caps->data.storage.flags |=
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
+ if (udevGetStringProperty(device, "ID_FS_LABEL",
+ &data->storage.media_label) == PROPERTY_ERROR) {
+ goto out;
+ }
+
if (udevGetUint64SysfsAttr(device,
"size",
&data->storage.num_blocks) == PROPERTY_ERROR) {
diff --git a/tests/nodedevschemadata/DVD_with_media.xml b/tests/nodedevschemadata/DVD_with_media.xml
new file mode 100644
index 0000000000000000000000000000000000000000..673e88fd0a6a514195475bda176d9784a5c7fcaa
--- /dev/null
+++ b/tests/nodedevschemadata/DVD_with_media.xml
@@ -0,0 +1,16 @@
+
+ DVD_GCC_4247N
+ pci_8086_27df_scsi_host_scsi_device_lun0
+
+ /dev/sr0
+ scsi
+ cdrom
+ RW/DVD GCC-4247N
+ HL-DT-ST
+
+ 1
+ 12345678
+ Windows_XP_Label
+
+
+
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index 76212127918d3ab4c7d715d63ee82b4e54668cb5..bf8be7e5ca66b605129fb158e8d02f92cc4657f3 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -80,6 +80,7 @@ mymain(int argc, char **argv)
DO_TEST("computer");
DO_TEST("DVD_GCC_4247N");
+ DO_TEST("DVD_with_media");
DO_TEST("net_00_13_02_b9_f9_d3");
DO_TEST("net_00_15_58_2f_e9_55");
DO_TEST("pci_1002_71c4");