mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: migration: Refactor hostdev validation in migration check
The hostdev check can error out right away.
This commit is contained in:
parent
584db1054c
commit
bd57977391
@ -1951,7 +1951,6 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
|
||||
{
|
||||
int nsnapshots;
|
||||
int pauseReason;
|
||||
bool forbid;
|
||||
size_t i;
|
||||
|
||||
if (vm) {
|
||||
@ -1995,22 +1994,16 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
|
||||
}
|
||||
|
||||
/* Migration with USB host devices is allowed, all other devices are
|
||||
* forbidden.
|
||||
*/
|
||||
forbid = false;
|
||||
* forbidden. */
|
||||
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) {
|
||||
forbid = true;
|
||||
break;
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("domain has assigned non-USB host devices"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (forbid) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("domain has assigned non-USB host devices"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (def->cpu && def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
|
||||
for (i = 0; i < def->cpu->nfeatures; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user