diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 6b063cc225..0498489cfd 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -578,6 +578,7 @@ + @@ -585,6 +586,18 @@ + + + + + + + + + + + + diff --git a/tests/nodedevschemadata/DVD_with_media.xml b/tests/nodedevschemadata/DVD_with_media.xml index 673e88fd0a..f169885eb1 100644 --- a/tests/nodedevschemadata/DVD_with_media.xml +++ b/tests/nodedevschemadata/DVD_with_media.xml @@ -11,6 +11,8 @@ 1 12345678 Windows_XP_Label + 2048 + 6028 diff --git a/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml b/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml index d225dca8fa..5bdbb8ac95 100644 --- a/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml +++ b/tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml @@ -13,5 +13,7 @@ HP 3600c0ff000d7a2a5d463ff4902000000 15626928128 + 512 + 30521344 diff --git a/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml index 3595a0baaa..68dbf0be96 100644 --- a/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml +++ b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml @@ -8,5 +8,7 @@ HTS721010G9SA00 ATA 100030242816 + 512 + 195371568 diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 41ed5c01c2..207d97483e 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -23,6 +23,7 @@ testCompareXMLToXMLFiles(const char *xml) char *actual = NULL; int ret = -1; virNodeDeviceDefPtr dev = NULL; + virNodeDevCapsDefPtr caps; if (virTestLoadFile(xml, &xmlData) < 0) goto fail; @@ -30,6 +31,27 @@ testCompareXMLToXMLFiles(const char *xml) if (!(dev = virNodeDeviceDefParseString(xmlData, EXISTING_DEVICE, NULL))) goto fail; + /* Calculate some things that are not read in */ + for (caps = dev->caps; caps; caps = caps->next) { + virNodeDevCapDataPtr data = &caps->data; + + if (caps->data.type == VIR_NODE_DEV_CAP_STORAGE) { + if (data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE) { + if (data->storage.flags & + VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE) { + data->storage.logical_block_size = 2048; + data->storage.num_blocks = + data->storage.removable_media_size / + data->storage.logical_block_size; + } + } else { + data->storage.logical_block_size = 512; + data->storage.num_blocks = data->storage.size / + data->storage.logical_block_size; + } + } + } + if (!(actual = virNodeDeviceDefFormat(dev))) goto fail;