mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
test: Sync GetXML INACTIVE behavior with live driver
- Error if INACTIVE requested for transient object - Force dumping INACTIVE XML when object is inactive Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
2b487f564e
commit
8ee34bb551
@ -7514,15 +7514,30 @@ testNodeDeviceGetXMLDesc(virNodeDevicePtr dev,
|
||||
{
|
||||
testDriver *driver = dev->conn->privateData;
|
||||
virNodeDeviceObj *obj;
|
||||
virNodeDeviceDef *def;
|
||||
char *ret = NULL;
|
||||
|
||||
virCheckFlags(VIR_NODE_DEVICE_XML_INACTIVE, NULL);
|
||||
|
||||
if (!(obj = testNodeDeviceObjFindByName(driver, dev->name)))
|
||||
return NULL;
|
||||
def = virNodeDeviceObjGetDef(obj);
|
||||
|
||||
ret = virNodeDeviceDefFormat(virNodeDeviceObjGetDef(obj), flags);
|
||||
if (flags & VIR_NODE_DEVICE_XML_INACTIVE) {
|
||||
if (!virNodeDeviceObjIsPersistent(obj)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("node device '%1$s' is not persistent"),
|
||||
def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
if (!virNodeDeviceObjIsActive(obj))
|
||||
flags |= VIR_NODE_DEVICE_XML_INACTIVE;
|
||||
}
|
||||
|
||||
ret = virNodeDeviceDefFormat(def, flags);
|
||||
|
||||
cleanup:
|
||||
virNodeDeviceObjEndAPI(&obj);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user