This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new d8c6e00  hypervisor: XCP-ng 8.2 support (#4672)
d8c6e00 is described below

commit d8c6e00498c34c2ead3bb288f7aa58ceb73347c7
Author: Abhishek Kumar <[email protected]>
AuthorDate: Fri Apr 9 13:12:06 2021 +0530

    hypervisor: XCP-ng 8.2 support (#4672)
    
    Adds new/missing guest os mappings for XCP-ng/Xenserver 8.1
    Copy guest OS mappings from XCP-ng/Xenserver 8.1 for XCP-ng/Xenserver 8.2
    Adds Ubuntu 20.04 guest os mapping for XCP-ng/Xenserver 8.2
    
    Signed-off-by: Abhishek Kumar <[email protected]>
---
 .../resources/META-INF/db/schema-41500to41510.sql  | 33 ++++++++++++++++++++++
 .../java/com/cloud/hypervisor/XenServerGuru.java   | 10 ++++++-
 2 files changed, 42 insertions(+), 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 5c25c0b..21d9dcb 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
@@ -23,3 +23,36 @@
 UPDATE `cloud`.`guest_os` SET display_name='Fedora Linux (32 bit)' WHERE 
id=320;
 UPDATE `cloud`.`guest_os` SET display_name='Mandriva Linux (32 bit)' WHERE 
id=323;
 UPDATE `cloud`.`guest_os` SET display_name='OpenSUSE Linux (32 bit)' WHERE 
id=327;
+
+-- 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 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);
+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.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);
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 2ef942c..c77ac44 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 class XenServerGuru extends HypervisorGuruBase 
implements HypervisorGuru,
         if (userVmVO != null) {
             HostVO host = hostDao.findById(userVmVO.getHostId());
             if (host != null) {
-                
to.setVcpuMaxLimit(MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()));
+                List<HostVO> 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);
             }
         }
 

Reply via email to