From 17b2bf73e040bbce9b774cf0b20a092b9e676218 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Wed, 10 Feb 2021 14:26:57 +0530 Subject: [PATCH 1/6] hypervisor: XCP-ng 8.2 support Signed-off-by: Abhishek Kumar --- .../src/main/resources/META-INF/db/schema-41500to41510.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql index caafde62556b..50811a469009 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql @@ -19,3 +19,8 @@ -- Schema upgrade from 4.15.0.0 to 4.15.1.0 --; +-- Add XenServer 8.2 hypervisor capabilities +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported) values (UUID(), 'XenServer', '8.2.0', 1000, 253, 64, 1); + +-- Copy XenServer 8.1 hypervisor guest OS mappings to XenServer8.2 +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '8.2.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.1.0'; From e6256c93d6703d5387c6746273b65fb9e0886d2b Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 26 Feb 2021 14:07:14 +0530 Subject: [PATCH 2/6] add new/missing guest os mappings Signed-off-by: Abhishek Kumar --- .../META-INF/db/schema-41500to41510.sql | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql index 50811a469009..1ca7746a142b 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql @@ -19,8 +19,33 @@ -- Schema upgrade from 4.15.0.0 to 4.15.1.0 --; --- Add XenServer 8.2 hypervisor capabilities +-- Add support for SUSE Linux Enterprise Desktop 12 SP3 (64-bit) for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (330, UUID(), 5, 'SUSE Linux Enterprise Desktop 12 SP3 (64-bit)', now()); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'SUSE Linux Enterprise Desktop 12 SP3 (64-bit)', 330, now(), 0); +-- Add support for SUSE Linux Enterprise Desktop 12 SP4 (64-bit) for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (331, UUID(), 5, 'SUSE Linux Enterprise Desktop 12 SP4 (64-bit)', now()); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'SUSE Linux Enterprise Desktop 12 SP4 (64-bit)', 331, now(), 0); +-- Add support for SUSE Linux Enterprise Server 12 SP4 (64-bit) for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (332, UUID(), 5, 'SUSE Linux Enterprise Server 12 SP4 (64-bit)', now()); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'SUSE Linux Enterprise Server 12 SP4 (64-bit)', 332, now(), 0); +-- Add support for Scientific Linux 7 for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (333, UUID(), 9, 'Scientific Linux 7', now()); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'Scientific Linux 7', 333, now(), 0); +-- Add support for NeoKylin Linux Server 7 for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (334, UUID(), 9, 'NeoKylin Linux Server 7', now()); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'NeoKylin Linux Server 7', 332, now(), 0); +-- Add support for Debian Buster 10 for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'Debian Buster 10', 292, now(), 0); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'Debian Buster 10', 293, now(), 0); +-- Add support for SUSE Linux Enterprise 15 (64-bit) for Xenserver 8.1.0 +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'SUSE Linux Enterprise 15 (64-bit)', 291, now(), 0); + +-- Add XenServer 8.2.0 hypervisor capabilities INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported) values (UUID(), 'XenServer', '8.2.0', 1000, 253, 64, 1); --- Copy XenServer 8.1 hypervisor guest OS mappings to XenServer8.2 +-- Copy XenServer 8.1.0 hypervisor guest OS mappings to XenServer 8.2.0 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '8.2.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.1.0'; + +-- Add support for Ubuntu Focal Fossa 20.04 for Xenserver 8.2.0 +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (335, UUID(), 10, 'Ubuntu 20.04 LTS', now()); +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.2.0', 'Ubuntu Focal Fossa 20.04', 330, now(), 0); From 77d5cc0f31e4b79b1e8ac7f229bb294044686632 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 26 Feb 2021 16:44:00 +0530 Subject: [PATCH 3/6] add missing Signed-off-by: Abhishek Kumar --- .../src/main/resources/META-INF/db/schema-41500to41510.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql index 1ca7746a142b..0a5edb889167 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql @@ -34,6 +34,8 @@ INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_vers -- Add support for NeoKylin Linux Server 7 for Xenserver 8.1.0 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (334, UUID(), 9, 'NeoKylin Linux Server 7', now()); INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'NeoKylin Linux Server 7', 332, now(), 0); +-- Add support for Debian Buster 10 for CentOS 8 +INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'CentOS 8', 297, now(), 0); -- Add support for Debian Buster 10 for Xenserver 8.1.0 INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'Debian Buster 10', 292, now(), 0); INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'Debian Buster 10', 293, now(), 0); From aa6d5c8e74130717f47391971d4ba2b5c545627f Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 4 Mar 2021 16:21:40 +0530 Subject: [PATCH 4/6] wrong comment --- .../src/main/resources/META-INF/db/schema-41500to41510.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql index 0a5edb889167..062b94d0b0c1 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41500to41510.sql @@ -34,7 +34,7 @@ INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_vers -- Add support for NeoKylin Linux Server 7 for Xenserver 8.1.0 INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (334, UUID(), 9, 'NeoKylin Linux Server 7', now()); INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'NeoKylin Linux Server 7', 332, now(), 0); --- Add support for Debian Buster 10 for CentOS 8 +-- Add support CentOS 8 for Xenserver 8.1.0 INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'CentOS 8', 297, now(), 0); -- Add support for Debian Buster 10 for Xenserver 8.1.0 INSERT INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'Xenserver', '8.1.0', 'Debian Buster 10', 292, now(), 0); From f9432ede7e2330b75e568f3b292bf701c0224ba8 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 25 Mar 2021 14:54:32 +0530 Subject: [PATCH 5/6] prevent setting vcpus for vm more than host socket Setting higher vcpus result in following exception, nameLabel: Async.VM.start_on nameDescription: allowedOperations: [] currentOperations: {} created: Mon Mar 22 09:51:24 UTC 2021 finished: Mon Mar 22 09:51:24 UTC 2021 status: failure residentOn: com.xensource.xenapi.Host@483f7fdc progress: 1.0 type: result: errorInfo: [HOST_NOT_ENOUGH_PCPUS, 16, 3] otherConfig: {} subtaskOf: com.xensource.xenapi.Task@aaf13f6f subtasks: [] Signed-off-by: Abhishek Kumar --- .../src/main/java/com/cloud/hypervisor/XenServerGuru.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java index 2ef942cd53a3..667b220bd5cf 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java @@ -98,7 +98,7 @@ public VirtualMachineTO implement(VirtualMachineProfile vm) { if (userVmVO != null) { HostVO host = hostDao.findById(userVmVO.getHostId()); if (host != null) { - to.setVcpuMaxLimit(MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId())); + to.setVcpuMaxLimit(Math.min(host.getCpuSockets(), MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()))); } } From cbd3023d4dbd57a979c880ee1f4b7861d62f4157 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 26 Mar 2021 18:50:03 +0530 Subject: [PATCH 6/6] min cpu from cluster hosts Signed-off-by: Abhishek Kumar --- .../main/java/com/cloud/hypervisor/XenServerGuru.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java index 667b220bd5cf..c77ac44cdaf4 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java @@ -17,6 +17,7 @@ package com.cloud.hypervisor; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Map; @@ -98,7 +99,14 @@ public VirtualMachineTO implement(VirtualMachineProfile vm) { if (userVmVO != null) { HostVO host = hostDao.findById(userVmVO.getHostId()); if (host != null) { - to.setVcpuMaxLimit(Math.min(host.getCpuSockets(), MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()))); + List clusterHosts = hostDao.listByClusterAndHypervisorType(host.getClusterId(), host.getHypervisorType()); + HostVO hostWithMinSocket = clusterHosts.stream().min(Comparator.comparing(HostVO::getCpuSockets)).orElse(null); + Integer vCpus = MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()); + if (hostWithMinSocket != null && hostWithMinSocket.getCpuSockets() != null && + hostWithMinSocket.getCpuSockets() < vCpus) { + vCpus = hostWithMinSocket.getCpuSockets(); + } + to.setVcpuMaxLimit(vCpus); } }