mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
test_driver: Pass virt_type to virNodeDeviceDefParse() in testNodeDeviceCreateXML()
This brings the code closer to real implementation: nodeDeviceCreateXML(). For the unique OUI, let's take the value from tests/virrandommock.c: 100000. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b857ad0696
commit
ae7df11377
@ -7685,11 +7685,14 @@ testNodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
g_autofree char *wwnn = NULL;
|
g_autofree char *wwnn = NULL;
|
||||||
g_autofree char *wwpn = NULL;
|
g_autofree char *wwpn = NULL;
|
||||||
bool validate = flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE;
|
bool validate = flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE;
|
||||||
|
const char *virt_type;
|
||||||
|
|
||||||
virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL);
|
virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL);
|
||||||
|
|
||||||
if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL, NULL,
|
virt_type = virConnectGetType(conn);
|
||||||
NULL, validate)))
|
|
||||||
|
if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type,
|
||||||
|
NULL, NULL, validate)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* We run this simply for validation - it essentially validates that
|
/* We run this simply for validation - it essentially validates that
|
||||||
|
@ -124,6 +124,7 @@ virRandomBytes(unsigned char *buf,
|
|||||||
#define VMWARE_OUI "000569"
|
#define VMWARE_OUI "000569"
|
||||||
#define MICROSOFT_OUI "0050f2"
|
#define MICROSOFT_OUI "0050f2"
|
||||||
#define XEN_OUI "00163e"
|
#define XEN_OUI "00163e"
|
||||||
|
#define TEST_DRIVER_OUI "100000"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -148,6 +149,8 @@ virRandomGenerateWWN(char **wwn,
|
|||||||
oui = VMWARE_OUI;
|
oui = VMWARE_OUI;
|
||||||
} else if (STREQ(virt_type, "HYPER-V")) {
|
} else if (STREQ(virt_type, "HYPER-V")) {
|
||||||
oui = MICROSOFT_OUI;
|
oui = MICROSOFT_OUI;
|
||||||
|
} else if (STREQ(virt_type, "TEST")) {
|
||||||
|
oui = TEST_DRIVER_OUI;
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Unsupported virt type"));
|
_("Unsupported virt type"));
|
||||||
|
Loading…
Reference in New Issue
Block a user