Skip to content

Commit 6603e09

Browse files
Simon Wellernathanejohnson
authored andcommitted
Added support for ViRTIO-SCSI based on template name.
1 parent 61ce75e commit 6603e09

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ So if getMinSpeed() returns null we fall back to getSpeed().
20152015
if (vmTO.getOs().startsWith("Windows")) {
20162016
clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME);
20172017
clock.setTimer("rtc", "catchup", null);
2018-
} else if (vmTO.getType() != VirtualMachine.Type.User || isGuestPVEnabled(vmTO.getOs())) {
2018+
} else if (vmTO.getType() != VirtualMachine.Type.User || isGuestPVEnabled(vmTO.getOs()).equals("VIRTIO") || isGuestPVEnabled(vmTO.getOs()).equals("SCSI")) {
20192019
if (_hypervisorLibvirtVersion >= 9 * 1000 + 10) {
20202020
clock.setTimer("kvmclock", null, null, _noKvmClock);
20212021
}
@@ -2960,19 +2960,22 @@ private String getHypervisorPath(final Connect conn) {
29602960
return parser.getEmulator();
29612961
}
29622962

2963-
boolean isGuestPVEnabled(final String guestOSName) {
2963+
private String isGuestPVEnabled(final String guestOSName) {
29642964
if (guestOSName == null) {
2965-
return false;
2965+
return "IDE";
29662966
}
29672967
if (guestOSName.startsWith("Ubuntu") || guestOSName.startsWith("Fedora 13") || guestOSName.startsWith("Fedora 12") || guestOSName.startsWith("Fedora 11") ||
29682968
guestOSName.startsWith("Fedora 10") || guestOSName.startsWith("Fedora 9") || guestOSName.startsWith("CentOS 5.3") || guestOSName.startsWith("CentOS 5.4") ||
29692969
guestOSName.startsWith("CentOS 5.5") || guestOSName.startsWith("CentOS") || guestOSName.startsWith("Fedora") ||
29702970
guestOSName.startsWith("Red Hat Enterprise Linux 5.3") || guestOSName.startsWith("Red Hat Enterprise Linux 5.4") ||
29712971
guestOSName.startsWith("Red Hat Enterprise Linux 5.5") || guestOSName.startsWith("Red Hat Enterprise Linux 6") || guestOSName.startsWith("Debian GNU/Linux") ||
29722972
guestOSName.startsWith("FreeBSD 10") || guestOSName.startsWith("Oracle") || guestOSName.startsWith("Other PV")) {
2973-
return true;
2973+
return "VIRTIO";
2974+
}
2975+
else if (guestOSName.startsWith("Other PV Virtio-SCSI")) {
2976+
return "SCSI";
29742977
} else {
2975-
return false;
2978+
return "IDE:";
29762979
}
29772980
}
29782981

@@ -2985,8 +2988,12 @@ public boolean isCentosHost() {
29852988
}
29862989

29872990
private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) {
2988-
if (isGuestPVEnabled(platformEmulator)) {
2991+
if (isGuestPVEnabled(platformEmulator).equals("VIRTIO")) {
29892992
return DiskDef.DiskBus.VIRTIO;
2993+
} else if(isGuestPVEnabled(platformEmulator).equals("SCSI")) {
2994+
return DiskDef.DiskBus.SCSI;
2995+
} else if(isGuestPVEnabled(platformEmulator).equals("IDE")) {
2996+
return DiskDef.DiskBus.IDE;
29902997
} else {
29912998
return DiskDef.DiskBus.IDE;
29922999
}

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,11 @@ public String toString() {
828828
}
829829

830830
diskBuilder.append("</disk>\n");
831+
if (_bus == DiskBus.SCSI) {
832+
diskBuilder.append("<controller type='scsi' index='0' model='virtio-scsi'>\n");
833+
diskBuilder.append("<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>\n");
834+
diskBuilder.append("</controller>");
835+
}
831836
return diskBuilder.toString();
832837
}
833838
}

setup/db/db/schema-4920to41000.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, crea
3939
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (272, UUID(), 4, 'Red Hat Enterprise Linux 7.1', now());
4040
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (273, UUID(), 4, 'Red Hat Enterprise Linux 7.2', now());
4141
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (274, UUID(), 1, 'CentOS 7.2', now());
42+
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (275, UUID(), 6, 'Other PV Virtio-SCSI (64-bit)', now());
4243

4344
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '6.5.0', 'Windows 10 (32-bit)', 257, now(), 0);
4445
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '6.0', 'windows9Guest', 257, now(), 0);
@@ -108,6 +109,7 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi
108109
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 274, now(), 0);
109110
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '6.0', 'centos64Guest', 274, now(), 0);
110111
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'KVM', 'default', 'CentOS 7.2', 274, now(), 0);
112+
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created) VALUES (UUID(), 'KVM', 'default', 'Other PV Virtio-SCSI (64-bit)', 260, now());
111113

112114
CREATE TABLE `cloud`.`vlan_details` (
113115
`id` bigint unsigned NOT NULL auto_increment,

0 commit comments

Comments
 (0)