mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Better error reporting from qemu AttachDevice
This commit is contained in:
parent
1f11e3bb61
commit
4837725f37
@ -1,3 +1,9 @@
|
||||
Mon Mar 2 12:37:04 EST 2009 Cole Robinson <crobinso@redhat.com>
|
||||
|
||||
* src/domain_conf.c src/domain_conf.h src/libvirt_private.syms
|
||||
src/qemu_driver.c:
|
||||
Better error reporting from qemu AttachDevice
|
||||
|
||||
Mon Mar 2 12:34:25 EST 2009 Cole Robinson <crobinso@redhat.com>
|
||||
|
||||
* src/bridge.c src/bridge.h src/libvirt_private.syms src/network_conf.c
|
||||
|
@ -73,6 +73,14 @@ VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
|
||||
"rename-restart",
|
||||
"preserve")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
|
||||
"disk",
|
||||
"filesystem",
|
||||
"interface",
|
||||
"input",
|
||||
"sound",
|
||||
"hostdev")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
||||
"block",
|
||||
"file")
|
||||
|
@ -343,6 +343,8 @@ enum virDomainDeviceType {
|
||||
VIR_DOMAIN_DEVICE_INPUT,
|
||||
VIR_DOMAIN_DEVICE_SOUND,
|
||||
VIR_DOMAIN_DEVICE_HOSTDEV,
|
||||
|
||||
VIR_DOMAIN_DEVICE_LAST,
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceDef virDomainDeviceDef;
|
||||
@ -622,6 +624,7 @@ VIR_ENUM_DECL(virDomainVirt)
|
||||
VIR_ENUM_DECL(virDomainBoot)
|
||||
VIR_ENUM_DECL(virDomainFeature)
|
||||
VIR_ENUM_DECL(virDomainLifecycle)
|
||||
VIR_ENUM_DECL(virDomainDevice)
|
||||
VIR_ENUM_DECL(virDomainDisk)
|
||||
VIR_ENUM_DECL(virDomainDiskDevice)
|
||||
VIR_ENUM_DECL(virDomainDiskBus)
|
||||
|
@ -68,6 +68,7 @@ virDomainDefParseString;
|
||||
virDomainDeleteConfig;
|
||||
virDomainDeviceDefFree;
|
||||
virDomainDeviceDefParse;
|
||||
virDomainDeviceTypeToString;
|
||||
virDomainDiskBusTypeToString;
|
||||
virDomainDiskDefFree;
|
||||
virDomainDiskDeviceTypeToString;
|
||||
|
@ -3472,17 +3472,25 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
|
||||
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
|
||||
ret = qemudDomainChangeEjectableMedia(dom->conn, vm, dev);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||
if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
|
||||
ret = qemudDomainAttachUsbMassstorageDevice(dom->conn, vm, dev);
|
||||
} else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
|
||||
dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||
ret = qemudDomainAttachPciDiskDevice(dom->conn, vm, dev);
|
||||
} else {
|
||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
||||
_("disk bus '%s' cannot be hotplugged."),
|
||||
virDomainDiskBusTypeToString(dev->data.disk->bus));
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("this disk device type cannot be attached"));
|
||||
_("disk device type '%s' cannot be hotplugged"),
|
||||
virDomainDiskDeviceTypeToString(dev->data.disk->device));
|
||||
goto cleanup;
|
||||
}
|
||||
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
||||
@ -3491,7 +3499,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
|
||||
ret = qemudDomainAttachHostDevice(dom->conn, vm, dev);
|
||||
} else {
|
||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
||||
"%s", _("this device type cannot be attached"));
|
||||
_("device type '%s' cannot be attached"),
|
||||
virDomainDeviceTypeToString(dev->type));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user