On Wed, May 13, 2015 at 11:36:29 +0800, Chen Fan wrote:
currently, we only support PCI host devices with ephemeral flag.
and USB already supports migration. so maybe in the near future we
can support SCSI.
Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
---
src/qemu/qemu_command.c | 10 ++++++++++
src/qemu/qemu_migration.c | 11 +++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fc81214..5acd8b4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10182,6 +10182,16 @@ qemuBuildCommandLine(virConnectPtr conn,
/* PCI */
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
+ hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB
&&
+ (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI
&&
+ hostdev->ephemeral)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("non-USB and non-PCI device assignment with ephemeral
"
+ "flag are not supported by this version of
qemu"));
This functionality is not based on qemu support but on libvirt
implementation so the error message is incorrect.
+ goto error;
+ }
+
+ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
int backend = hostdev->source.subsys.u.pci.backend;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 83be435..56112f9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1981,21 +1981,24 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr
vm,
def = vm->def;
}
- /* Migration with USB host devices is allowed, all other devices are
- * forbidden.
+ /*
+ * Migration with USB and ephemeral PCI host devices host devices are allowed,
+ * all other devices are forbidden.
*/
forbid = false;
for (i = 0; i < def->nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
- hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
+ (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB
&&
+ !hostdev->ephemeral)) {
forbid = true;
break;
}
}
if (forbid) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("domain has assigned non-USB host devices"));
+ _("domain has assigned non-USB and "
+ "non-ephemeral host devices"));
return false;
}
This patch has to be moved after you actually implement the ephemeral
device unplug code, since an intermediate state would allow to bypass
the check while the devices actually would not be unplugged.
Peter