CA-129192: restore metadata for all SR

CA-129192/SCTX-1728: revise restore-sr-metadata.py so that it could restore
metadata for all SR with command line:
   ./restore-sr-metadata.py -f <input file> -u all
or just omit the sr-uuid:
   ./restore-sr-metadata.py -f <input file>

xe-restore-metadata is modified accordingly.

Signed-off-by: Kaifeng Zhu <kaifeng.zhu@citrix.com>
CP-8358: Don't filter out quotes before parsing lspci output

Instead take them into account when doing the sscanf.

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Rename field pci.id to pci.pci_id

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Decompose Xapi_pci_helpers.pci into a collection of int64/string pairs

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Add subsystem IDs to PCI objects

PCI objects now have four new fields:

* subsystem_vendor_id
* subsystem_vendor_name
* subsystem_device_id
* subsystem_device_name

If a device doesn't implement these IDs then the fields will be left as
empty strings in the database.

If a device implements the IDs but the IDs are not present in pci.ids,
then the names will be set to "Unknown (xxxx)" where xxxx is the
corresponding ID.

Signed-off-by: John Else <john.else@citrix.com>

Conflicts:
	ocaml/idl/datamodel.ml
CP-8358: Log the new pci fields after test failures

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Add more tests of lspci subsystem ID parsing

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Typo fix in comment

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Read physical subsystem device from vgpu config files

If the value of plugin0.pdev_id in the config file is of the form

"0x1234"

then store None as the physical subsystem device ID.

If the value is of the form

"0x1234:0x5678"

then store (Some 0x5678) as the physical subsystem device ID.

In both cases 0x1234 will be stored as the physical device ID.

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Refactor print_vgpu_conf into two functions

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Print the new psubdev_id on test failure

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Add tests of the vgpu config parser

Includes a couple of example config files.

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Log physical subsystem device ID of relevant VGPU types

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Only pass one PCI ID to relevant_vgpu_types

Signed-off-by: John Else <john.else@citrix.com>
CP-8358: Take subsystem device ID into account in relevant_vgpu_types

If the VGPU config file specifies a particular physical subsystem ID,
then the device must have the same ID for that VGPU configuration to be
supported.

If the config file doesn't specify a physical subsystem ID, then the ID
of the device doesn't matter.

Signed-off-by: John Else <john.else@citrix.com>
Remove unnecessary scanning indications

This breaks the sscanf in OCaml 4.01.0

Signed-off-by: John Else <john.else@citrix.com>
CA-137468: Wait for ofport to settle before modifying ovs rules

The database may take some time for this value to become valid. Until then it
may return -1. In the VIF plug case we wait for this value to become valid
using the wait-until command provided with ovs-vsctl. For the VIF unplug case
we do not wait because once the value is -1 it will never become not -1 again.
In the case where the ofport returned is -1 (now only the unplug case) we no
longer delete the rules in the flow table since, in some versions of ovs,
the -1 can act as a wildcard in the deletion, deleting far more than desired.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #1789 from johnelse/cp-8358

CP-8358: PCI subsystem device/vendor ID handling
Merge pull request #1790 from simonjbeaumont/ca-137468

CA-137468: Wait for ofport to settle before modifying ovs rules
Add phaseN objects to Makefile

to allow more flexibilities in a local staged compilation mode, in particular
this helps to keep a copy of the autogenerated code for testing and debugging.

Signed-off-by: Zheng Li <dev@zheng.li>