[libvirt] [PATCH v2 0/8] Fix some issues with rng grammar for output XML's,

v1: https://www.redhat.com/archives/libvir-list/2018-May/msg01455.html Update patches to add data into schema for examples that I could generate. For the vpxmigr and vzmigr, I wasn't sure what the capabilityschemadata should look like, so I left those out. Those are only validate in the "right" environment when virCapabilitiesAddHostMigrateTransport is called. John Ferlan (8): schema: Add physical sizing grammer for storagevol grammar schema: Remove xenmigr from host migrate transport capability schema,tests: Use vpxmigr for host migrate transport capability schema: Add rdma for host migrate transport capability schema: Add vzmigr for host migrate transport capability schema: Add microcode to capability grammar schema: Fix capability grammar for pagesElem schema: Add missing block data for nodedev docs/schemas/capability.rng | 42 +++++++++++++++------- docs/schemas/nodedev.rng | 13 +++++++ docs/schemas/storagevol.rng | 5 +++ tests/capabilityschemadata/caps-qemu-kvm.xml | 1 + tests/capabilityschemadata/caps-test2.xml | 4 +++ tests/capabilityschemadata/caps-test3.xml | 7 ++++ tests/nodedevschemadata/DVD_with_media.xml | 2 ++ ...ge_serial_3600c0ff000d7a2a5d463ff4902000000.xml | 2 ++ ..._serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 2 ++ tests/nodedevxml2xmltest.c | 22 ++++++++++++ tests/storagevolschemadata/qcow2-no-source.xml | 1 + tests/vmx2xmltest.c | 2 +- 12 files changed, 89 insertions(+), 14 deletions(-) -- 2.14.3

https://bugzilla.redhat.com/show_bug.cgi?id=1572491 Commit id '78661cb' added a physical output, but failed to update the schema resulting in a failure from virt-xml-validate. While at it - update the storagevolschemadata for the output. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/storagevol.rng | 5 +++++ tests/storagevolschemadata/qcow2-no-source.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng index 7450547ffa..96d6b3e6d0 100644 --- a/docs/schemas/storagevol.rng +++ b/docs/schemas/storagevol.rng @@ -56,6 +56,11 @@ <ref name='scaledInteger'/> </element> </optional> + <optional> + <element name='physical'> + <ref name='scaledInteger'/> + </element> + </optional> </interleave> </define> diff --git a/tests/storagevolschemadata/qcow2-no-source.xml b/tests/storagevolschemadata/qcow2-no-source.xml index 777294ec14..4958845594 100644 --- a/tests/storagevolschemadata/qcow2-no-source.xml +++ b/tests/storagevolschemadata/qcow2-no-source.xml @@ -3,6 +3,7 @@ <key>/var/lib/libvirt/images/OtherDemo.img</key> <capacity unit="G">5</capacity> <allocation>294912</allocation> + <physical unit="G">5</physical> <target> <path>/var/lib/libvirt/images/OtherDemo.img</path> <format type='qcow2'/> -- 2.14.3

s/grammer/element/ ? On Mon, May 21, 2018 at 08:40:38AM -0400, John Ferlan wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1572491
Commit id '78661cb' added a physical output, but failed to update the schema resulting in a failure from virt-xml-validate.
While at it - update the storagevolschemadata for the output.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/storagevol.rng | 5 +++++ tests/storagevolschemadata/qcow2-no-source.xml | 1 + 2 files changed, 6 insertions(+)
Jano

Commit id '1dac5fbb' removed xenmigr as a capability option for virCapabilitiesAddHostMigrateTransport but didn't update the schema resulting in possible failure for virt-xml-validate. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/capability.rng | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index e1ab5c2240..e11dd51150 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -162,7 +162,6 @@ <choice> <value>esx</value> <value>tcp</value> - <value>xenmigr</value> </choice> </element> </oneOrMore> -- 2.14.3

Commit id 'e4938ce2f' changed the esx_driver to use 'vpxmigr' instead of esx for virCapabilitiesAddHostMigrateTransport, so update the capabilities to allow virt-xml-validate to pass and update the test to use the newer name. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/capability.rng | 2 +- tests/vmx2xmltest.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index e11dd51150..b8e1a0e930 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -160,7 +160,7 @@ <oneOrMore> <element name='uri_transport'> <choice> - <value>esx</value> + <value>vpxmigr</value> <value>tcp</value> </choice> </element> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 60913b6b11..7289dc91e3 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -30,7 +30,7 @@ testCapsInit(void) if (caps == NULL) return; - virCapabilitiesAddHostMigrateTransport(caps, "esx"); + virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr"); /* i686 guest */ guest = -- 2.14.3

https://bugzilla.redhat.com/show_bug.cgi?id=1572491 Commit id 'b3fd95e36' added rdma as a valid option for virCapabilitiesAddHostMigrateTransport, but didn't update the capabilities schema resulting in possible virt-xml-validate failure. While at it, update the capabilityschemadata for caps-qemu-kvm Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/capability.rng | 1 + tests/capabilityschemadata/caps-qemu-kvm.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index b8e1a0e930..aa4823f869 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -162,6 +162,7 @@ <choice> <value>vpxmigr</value> <value>tcp</value> + <value>rdma</value> </choice> </element> </oneOrMore> diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml index 652061b606..88ec89e733 100644 --- a/tests/capabilityschemadata/caps-qemu-kvm.xml +++ b/tests/capabilityschemadata/caps-qemu-kvm.xml @@ -8,6 +8,7 @@ <live/> <uri_transports> <uri_transport>tcp</uri_transport> + <uri_transport>rdma</uri_transport> </uri_transports> </migration_features> <topology> -- 2.14.3

Commit id '0eced74f3' added vzmigr as a valid option for virCapabilitiesAddHostMigrateTransport, but didn't update the capabilities schema resulting in possible virt-xml-validate failure. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/capability.rng | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index aa4823f869..c532f5dcc7 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -163,6 +163,7 @@ <value>vpxmigr</value> <value>tcp</value> <value>rdma</value> + <value>vzmigr</value> </choice> </element> </oneOrMore> -- 2.14.3

https://bugzilla.redhat.com/show_bug.cgi?id=1572491 Commit id 'd2440f3b5' added printing the <microcode> for the capabilities, but didn't update the capabilities schema. While at it, update capabilityschemadata for caps-test2 and caps-test3 to output some value for validation. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/capability.rng | 7 +++++++ tests/capabilityschemadata/caps-test2.xml | 1 + tests/capabilityschemadata/caps-test3.xml | 1 + 3 files changed, 9 insertions(+) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index c532f5dcc7..e1b7858540 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -102,6 +102,13 @@ <text/> </element> </optional> + <optional> + <element name='microcode'> + <attribute name='version'> + <ref name='positiveInteger'/> + </attribute> + </element> + </optional> <element name='topology'> <attribute name='sockets'> <ref name='positiveInteger'/> diff --git a/tests/capabilityschemadata/caps-test2.xml b/tests/capabilityschemadata/caps-test2.xml index 6a45e4569b..652fc71e0b 100644 --- a/tests/capabilityschemadata/caps-test2.xml +++ b/tests/capabilityschemadata/caps-test2.xml @@ -5,6 +5,7 @@ <arch>x86_64</arch> <model>SandyBridge</model> <vendor>Intel</vendor> + <microcode version='36'/> <topology sockets='1' cores='2' threads='2'/> <feature name='osxsave'/> <feature name='pdcm'/> diff --git a/tests/capabilityschemadata/caps-test3.xml b/tests/capabilityschemadata/caps-test3.xml index 7e21f85048..479db30612 100644 --- a/tests/capabilityschemadata/caps-test3.xml +++ b/tests/capabilityschemadata/caps-test3.xml @@ -6,6 +6,7 @@ <arch>x86_64</arch> <model>Westmere</model> <vendor>Intel</vendor> + <microcode version='36'/> <topology sockets='1' cores='6' threads='2'/> <feature name='rdtscp'/> <feature name='pdpe1gb'/> -- 2.14.3

https://bugzilla.redhat.com/show_bug.cgi?id=1572491 Commit id '02129b7c0' added a single pagesElem for slightly different purposes. One usage was an output for host page size listing and the other for NUMA supported page sizes. For the former, only the pages unit and size are formatted, while for the latter the pages unit, size, and availability data is formatted. The virt-xml-validate would fail because it expected something extra in the host page size output. So split up pagesElem a bit and create pagesHost and pagesNuma for the differences. Modify some capabilityschemadata output to have the output - even though the results may not be realistic with respect to the original incarnation of the data. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/capability.rng | 30 +++++++++++++++++++----------- tests/capabilityschemadata/caps-test2.xml | 3 +++ tests/capabilityschemadata/caps-test3.xml | 6 ++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index e1b7858540..66c5de62e5 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -129,7 +129,7 @@ </element> </zeroOrMore> <zeroOrMore> - <ref name='pagesElem'/> + <ref name='pagesHost'/> </zeroOrMore> </define> @@ -203,7 +203,7 @@ </optional> <zeroOrMore> - <ref name='pagesElem'/> + <ref name='pagesNuma'/> </zeroOrMore> <optional> @@ -484,17 +484,25 @@ </data> </define> - <define name='pagesElem'> + <define name='pagesHost'> <element name='pages'> - <optional> - <attribute name='unit'> - <ref name='unit'/> - </attribute> - </optional> - <attribute name='size'> - <ref name='unsignedInt'/> - </attribute> + <ref name='pagesElem'/> + </element> + </define> + <define name='pagesNuma'> + <element name='pages'> + <ref name='pagesElem'/> <ref name='unsignedInt'/> </element> </define> + <define name='pagesElem'> + <optional> + <attribute name='unit'> + <ref name='unit'/> + </attribute> + </optional> + <attribute name='size'> + <ref name='unsignedInt'/> + </attribute> + </define> </grammar> diff --git a/tests/capabilityschemadata/caps-test2.xml b/tests/capabilityschemadata/caps-test2.xml index 652fc71e0b..125a322998 100644 --- a/tests/capabilityschemadata/caps-test2.xml +++ b/tests/capabilityschemadata/caps-test2.xml @@ -24,6 +24,9 @@ <feature name='acpi'/> <feature name='ds'/> <feature name='vme'/> + <pages unit='KiB' size='4'/> + <pages unit='KiB' size='2048'/> + <pages unit='KiB' size='1048576'/> </cpu> <power_management> <suspend_mem/> diff --git a/tests/capabilityschemadata/caps-test3.xml b/tests/capabilityschemadata/caps-test3.xml index 479db30612..8294f44425 100644 --- a/tests/capabilityschemadata/caps-test3.xml +++ b/tests/capabilityschemadata/caps-test3.xml @@ -28,6 +28,9 @@ <feature name='acpi'/> <feature name='ds'/> <feature name='vme'/> + <pages unit='KiB' size='4'/> + <pages unit='KiB' size='2048'/> + <pages unit='KiB' size='1048576'/> </cpu> <power_management> <suspend_disk/> @@ -42,6 +45,9 @@ <cells num='2'> <cell id='0'> <memory unit='KiB'>12572412</memory> + <pages unit='KiB' size='4'>4011249</pages> + <pages unit='KiB' size='2048'>0</pages> + <pages unit='KiB' size='1048576'>0</pages> <cpus num='12'> <cpu id='0'/> <cpu id='2'/> -- 2.14.3

https://bugzilla.redhat.com/show_bug.cgi?id=1566416 Commit id 'fe2af45b' added output for logical_block_size and num_blocks for both removeable and fixed storage, but did not update the nodedev capability causing virt-xml-validate to fail. It's listed as optional only because it only prints if the sizes are > 0. For a CDROM drive the values won't be formatted. Update the nodedevxml2xmltest in order to output the values for storage based on the logic from udevProcessRemoveableMedia and udevProcessSD with respect to the logical_blocksize and num_blocks calculations. Signed-off-by: John Ferlan <jferlan@redhat.com> --- docs/schemas/nodedev.rng | 13 +++++++++++++ tests/nodedevschemadata/DVD_with_media.xml | 2 ++ ...ge_serial_3600c0ff000d7a2a5d463ff4902000000.xml | 2 ++ ..._serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 2 ++ tests/nodedevxml2xmltest.c | 22 ++++++++++++++++++++++ 5 files changed, 41 insertions(+) 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 @@ <text/> </element> </optional> + <ref name='blockData'/> </element> </define> @@ -585,6 +586,18 @@ <element name='size'> <ref name='unsignedLong'/> </element> + <ref name='blockData'/> + </define> + + <define name='blockData'> + <optional> + <element name='logical_block_size'> + <ref name='unsignedLong'/> + </element> + <element name='num_blocks'> + <ref name='unsignedLong'/> + </element> + </optional> </define> <define name='capdrm'> 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 @@ <media_available>1</media_available> <media_size>12345678</media_size> <media_label>Windows_XP_Label</media_label> + <logical_block_size>2048</logical_block_size> + <num_blocks>6028</num_blocks> </capability> </capability> </device> 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 @@ <vendor>HP</vendor> <serial>3600c0ff000d7a2a5d463ff4902000000</serial> <size>15626928128</size> + <logical_block_size>512</logical_block_size> + <num_blocks>30521344</num_blocks> </capability> </device> 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 @@ <model>HTS721010G9SA00</model> <vendor>ATA</vendor> <size>100030242816</size> + <logical_block_size>512</logical_block_size> + <num_blocks>195371568</num_blocks> </capability> </device> 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; -- 2.14.3

On 05/21/2018 02:40 PM, John Ferlan wrote:
v1: https://www.redhat.com/archives/libvir-list/2018-May/msg01455.html
Update patches to add data into schema for examples that I could generate. For the vpxmigr and vzmigr, I wasn't sure what the capabilityschemadata should look like, so I left those out. Those are only validate in the "right" environment when virCapabilitiesAddHostMigrateTransport is called.
John Ferlan (8): schema: Add physical sizing grammer for storagevol grammar schema: Remove xenmigr from host migrate transport capability schema,tests: Use vpxmigr for host migrate transport capability schema: Add rdma for host migrate transport capability schema: Add vzmigr for host migrate transport capability schema: Add microcode to capability grammar schema: Fix capability grammar for pagesElem schema: Add missing block data for nodedev
docs/schemas/capability.rng | 42 +++++++++++++++------- docs/schemas/nodedev.rng | 13 +++++++ docs/schemas/storagevol.rng | 5 +++ tests/capabilityschemadata/caps-qemu-kvm.xml | 1 + tests/capabilityschemadata/caps-test2.xml | 4 +++ tests/capabilityschemadata/caps-test3.xml | 7 ++++ tests/nodedevschemadata/DVD_with_media.xml | 2 ++ ...ge_serial_3600c0ff000d7a2a5d463ff4902000000.xml | 2 ++ ..._serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 2 ++ tests/nodedevxml2xmltest.c | 22 ++++++++++++ tests/storagevolschemadata/qcow2-no-source.xml | 1 + tests/vmx2xmltest.c | 2 +- 12 files changed, 89 insertions(+), 14 deletions(-)
ACK Michal
participants (3)
-
John Ferlan
-
Ján Tomko
-
Michal Privoznik