mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
libxl: add HOSTDEV type in libxlDomainDetachDeviceConfig
Missing HOSTDEV type in libxlDomainDetachDeviceConfig. Add it. Signed-off-by: Chunyan Liu <cyliu@suse.com>
This commit is contained in:
parent
20e01504a1
commit
232cf2a45c
@ -2985,7 +2985,8 @@ static int
|
|||||||
libxlDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
|
libxlDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
|
||||||
{
|
{
|
||||||
virDomainDiskDefPtr disk, detach;
|
virDomainDiskDefPtr disk, detach;
|
||||||
int ret = -1;
|
virDomainHostdevDefPtr hostdev, det_hostdev;
|
||||||
|
int idx;
|
||||||
|
|
||||||
switch (dev->type) {
|
switch (dev->type) {
|
||||||
case VIR_DOMAIN_DEVICE_DISK:
|
case VIR_DOMAIN_DEVICE_DISK:
|
||||||
@ -2993,18 +2994,30 @@ libxlDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
|
|||||||
if (!(detach = virDomainDiskRemoveByName(vmdef, disk->dst))) {
|
if (!(detach = virDomainDiskRemoveByName(vmdef, disk->dst))) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("no target device %s"), disk->dst);
|
_("no target device %s"), disk->dst);
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
virDomainDiskDefFree(detach);
|
virDomainDiskDefFree(detach);
|
||||||
ret = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_DEVICE_HOSTDEV: {
|
||||||
|
hostdev = dev->data.hostdev;
|
||||||
|
if ((idx = virDomainHostdevFind(vmdef, hostdev, &det_hostdev)) < 0) {
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
|
_("device not present in domain configuration"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
virDomainHostdevRemove(vmdef, idx);
|
||||||
|
virDomainHostdevDefFree(det_hostdev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("persistent detach of device is not supported"));
|
_("persistent detach of device is not supported"));
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user