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>
|
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
|
* 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",
|
"rename-restart",
|
||||||
"preserve")
|
"preserve")
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
|
||||||
|
"disk",
|
||||||
|
"filesystem",
|
||||||
|
"interface",
|
||||||
|
"input",
|
||||||
|
"sound",
|
||||||
|
"hostdev")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
||||||
"block",
|
"block",
|
||||||
"file")
|
"file")
|
||||||
|
@ -343,6 +343,8 @@ enum virDomainDeviceType {
|
|||||||
VIR_DOMAIN_DEVICE_INPUT,
|
VIR_DOMAIN_DEVICE_INPUT,
|
||||||
VIR_DOMAIN_DEVICE_SOUND,
|
VIR_DOMAIN_DEVICE_SOUND,
|
||||||
VIR_DOMAIN_DEVICE_HOSTDEV,
|
VIR_DOMAIN_DEVICE_HOSTDEV,
|
||||||
|
|
||||||
|
VIR_DOMAIN_DEVICE_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _virDomainDeviceDef virDomainDeviceDef;
|
typedef struct _virDomainDeviceDef virDomainDeviceDef;
|
||||||
@ -622,6 +624,7 @@ VIR_ENUM_DECL(virDomainVirt)
|
|||||||
VIR_ENUM_DECL(virDomainBoot)
|
VIR_ENUM_DECL(virDomainBoot)
|
||||||
VIR_ENUM_DECL(virDomainFeature)
|
VIR_ENUM_DECL(virDomainFeature)
|
||||||
VIR_ENUM_DECL(virDomainLifecycle)
|
VIR_ENUM_DECL(virDomainLifecycle)
|
||||||
|
VIR_ENUM_DECL(virDomainDevice)
|
||||||
VIR_ENUM_DECL(virDomainDisk)
|
VIR_ENUM_DECL(virDomainDisk)
|
||||||
VIR_ENUM_DECL(virDomainDiskDevice)
|
VIR_ENUM_DECL(virDomainDiskDevice)
|
||||||
VIR_ENUM_DECL(virDomainDiskBus)
|
VIR_ENUM_DECL(virDomainDiskBus)
|
||||||
|
@ -68,6 +68,7 @@ virDomainDefParseString;
|
|||||||
virDomainDeleteConfig;
|
virDomainDeleteConfig;
|
||||||
virDomainDeviceDefFree;
|
virDomainDeviceDefFree;
|
||||||
virDomainDeviceDefParse;
|
virDomainDeviceDefParse;
|
||||||
|
virDomainDeviceTypeToString;
|
||||||
virDomainDiskBusTypeToString;
|
virDomainDiskBusTypeToString;
|
||||||
virDomainDiskDefFree;
|
virDomainDiskDefFree;
|
||||||
virDomainDiskDeviceTypeToString;
|
virDomainDiskDeviceTypeToString;
|
||||||
|
@ -3472,17 +3472,25 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
|
|||||||
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
|
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
|
||||||
ret = qemudDomainChangeEjectableMedia(dom->conn, vm, dev);
|
ret = qemudDomainChangeEjectableMedia(dom->conn, vm, dev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||||
if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
|
if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
|
||||||
ret = qemudDomainAttachUsbMassstorageDevice(dom->conn, vm, dev);
|
ret = qemudDomainAttachUsbMassstorageDevice(dom->conn, vm, dev);
|
||||||
} else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
|
} else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
|
||||||
dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||||
ret = qemudDomainAttachPciDiskDevice(dom->conn, vm, dev);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
||||||
@ -3491,7 +3499,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
|
|||||||
ret = qemudDomainAttachHostDevice(dom->conn, vm, dev);
|
ret = qemudDomainAttachHostDevice(dom->conn, vm, dev);
|
||||||
} else {
|
} else {
|
||||||
qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
|
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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user