kvm: Fix of some UEFI related issues (#5072)

* Fix of some UEFI related issues

1 - fix of attach/detach ISO of VM with UEFI boot type
2 - if OS type of an ISO is categorized as "Other" the bus type of the disk
will be set to "sata"

* Simplify the validation of OS types
This commit is contained in:
slavkap 2021-06-09 08:45:07 +03:00 committed by GitHub
parent 1afcd823e0
commit b0f2112dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 11 deletions

View File

@ -3448,17 +3448,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
return DiskDef.DiskBus.IDE;
} else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) {
return DiskDef.DiskBus.SCSI;
} else if (isUefiEnabled && platformEmulator.startsWith("Windows")) {
return DiskDef.DiskBus.SATA;
} else if (platformEmulator.contains("Ubuntu") ||
platformEmulator.startsWith("Fedora") ||
platformEmulator.startsWith("CentOS") ||
platformEmulator.startsWith("Red Hat Enterprise Linux") ||
platformEmulator.startsWith("Debian GNU/Linux") ||
platformEmulator.startsWith("FreeBSD") ||
platformEmulator.startsWith("Oracle") ||
platformEmulator.startsWith("Other PV")) {
org.apache.commons.lang3.StringUtils.startsWithAny(platformEmulator,
"Fedora", "CentOS", "Red Hat Enterprise Linux", "Debian GNU/Linux", "FreeBSD", "Oracle", "Other PV")) {
return DiskDef.DiskBus.VIRTIO;
} else if (isUefiEnabled && org.apache.commons.lang3.StringUtils.startsWithAny(platformEmulator, "Windows", "Other")) {
return DiskDef.DiskBus.SATA;
} else {
return DiskDef.DiskBus.IDE;
}

View File

@ -1302,10 +1302,10 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
Command cmd = null;
if (attach) {
cmd = new AttachCommand(disk, vmName);
cmd = new AttachCommand(disk, vmName, vmTO.getDetails());
((AttachCommand)cmd).setForced(forced);
} else {
cmd = new DettachCommand(disk, vmName);
cmd = new DettachCommand(disk, vmName, vmTO.getDetails());
((DettachCommand)cmd).setForced(forced);
}
Answer a = _agentMgr.easySend(vm.getHostId(), cmd);