mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: command: Remove fallback '-usb' handling
Currently all machine types which do honour '-usb' are already covered by code which will either select a proper controller model or would select the same one which '-usb' would use. Thus all of the legacy -usb controller code can be removed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
a07544c0d7
commit
317ac911f6
@ -2919,62 +2919,6 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef,
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def)
|
||||
{
|
||||
if (ARCH_IS_X86(def->os.arch) ||
|
||||
ARCH_IS_PPC(def->os.arch) ||
|
||||
ARCH_IS_ARM(def->os.arch) ||
|
||||
qemuDomainIsRISCVVirt(def))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildLegacyUSBControllerCommandLine(virCommand *cmd,
|
||||
const virDomainDef *def)
|
||||
{
|
||||
size_t i;
|
||||
size_t nlegacy = 0;
|
||||
size_t nusb = 0;
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
virDomainControllerDef *cont = def->controllers[i];
|
||||
|
||||
if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_USB)
|
||||
continue;
|
||||
|
||||
/* If we have mode='none', there are no other USB controllers */
|
||||
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
|
||||
return 0;
|
||||
|
||||
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT)
|
||||
nlegacy++;
|
||||
else
|
||||
nusb++;
|
||||
}
|
||||
|
||||
if (nlegacy > 1) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Multiple legacy USB controllers are not supported"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nusb == 0 &&
|
||||
!qemuBuildDomainForbidLegacyUSBController(def) &&
|
||||
!ARCH_IS_S390(def->os.arch)) {
|
||||
/* We haven't added any USB controller yet, but we haven't been asked
|
||||
* not to add one either. Add a legacy USB controller, unless we're
|
||||
* creating a kind of guest we want to keep legacy-free */
|
||||
virCommandAddArg(cmd, "-usb");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBuildSkipController:
|
||||
* @controller: Controller to check
|
||||
@ -3055,28 +2999,15 @@ qemuBuildControllersByTypeCommandLine(virCommand *cmd,
|
||||
if (qemuBuildSkipController(cont, def))
|
||||
continue;
|
||||
|
||||
/* skip USB controllers with type none.*/
|
||||
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) {
|
||||
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) {
|
||||
|
||||
/* skip USB controllers with type none*/
|
||||
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT &&
|
||||
!qemuBuildDomainForbidLegacyUSBController(def)) {
|
||||
|
||||
/* An appropriate default USB controller model should already
|
||||
* have been selected in qemuDomainDeviceDefPostParse(); if
|
||||
* we still have no model by now, we have to fall back to the
|
||||
* legacy USB controller.
|
||||
*
|
||||
* Note that we *don't* want to end up with the legacy USB
|
||||
* controller for q35 and virt machines, so we go ahead and
|
||||
* fail in qemuBuildControllerDevProps(); on the other hand,
|
||||
* for s390 machines we want to ignore any USB controller
|
||||
* (see 548ba43028 for the full story), so we skip
|
||||
* qemuBuildControllerDevProps() but we don't ultimately end
|
||||
* up adding the legacy USB controller */
|
||||
/* skip 'default' controllers on s390 for legacy reasons */
|
||||
if (ARCH_IS_S390(def->os.arch) &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3135,9 +3066,6 @@ qemuBuildControllersCommandLine(virCommand *cmd,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuBuildLegacyUSBControllerCommandLine(cmd, def) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-redhat62sparc/.config \
|
||||
-rtc base=utc \
|
||||
-no-shutdown \
|
||||
-boot strict=on \
|
||||
-usb \
|
||||
-blockdev '{"driver":"file","filename":"/home/berrange/VirtualMachines/redhat-6.2-sparc.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage"}' \
|
||||
-device scsi-hd,bus=scsi.0,scsi-id=0,device_id=drive-scsi0-0-0-0,drive=libvirt-2-format,id=scsi0-0-0-0,bootindex=1 \
|
||||
|
Loading…
Reference in New Issue
Block a user