Skip to content

Commit 4645512

Browse files
authored
xenserver: Add support for XS 7.3, 7.4 and XCP-ng 7.4 (#2605)
This adds support for XenServer 7.3 and 7.4, and XCP-ng 7.4 version as hypervisor hosts. Fixes #2523. This also fixes the issue of 4.11 VRs stuck in starting for up-to 10mins, before they come up online. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 296a380 commit 4645512

9 files changed

Lines changed: 34 additions & 11 deletions

File tree

engine/schema/resources/META-INF/db/schema-41100to41110.sql

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,16 @@ UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE
7878
UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE `hypervisor_version`='5.1' AND hypervisor_type='VMware' AND guest_os_id='15';
7979
UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE `hypervisor_version`='5.5' AND hypervisor_type='VMware' AND guest_os_id='15';
8080
UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE `hypervisor_version`='6.0' AND hypervisor_type='VMware' AND guest_os_id='15';
81-
UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE `hypervisor_version`='6.5' AND hypervisor_type='VMware' AND guest_os_id='15';
81+
UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE `hypervisor_version`='6.5' AND hypervisor_type='VMware' AND guest_os_id='15';
82+
83+
-- XenServer 7.3
84+
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.3.0', 500, 13, 1);
85+
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', '7.3.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.2.0';
86+
87+
-- XenServer 7.4
88+
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.4.0', 500, 13, 1);
89+
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', '7.4.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.3.0';
90+
91+
-- XCP-NG 7.4
92+
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', 'XCP-ng 7.4.0', 500, 13, 1);
93+
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', 'XCP-ng 7.4.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.4.0';

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) {
422422
}
423423
} else if (prodBrand.equals("XCP_Kronos")) {
424424
return new XcpOssResource();
425-
} else if (prodBrand.equals("XenServer")) {
425+
} else if (prodBrand.equals("XenServer") || prodBrand.equals("XCP-ng")) {
426426
final String[] items = prodVersion.split("\\.");
427427
if ((Integer.parseInt(items[0]) > 6) ||
428428
(Integer.parseInt(items[0]) == 6 && Integer.parseInt(items[1]) >= 4)) {

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,9 +1055,13 @@ protected SR createNfsSRbyURI(final Connection conn, final URI uri, final boolea
10551055
public VBD createPatchVbd(final Connection conn, final String vmName, final VM vm) throws XmlRpcException, XenAPIException {
10561056

10571057
if (_host.getSystemvmisouuid() == null) {
1058-
final Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools");
1058+
Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools");
10591059
if (srs.size() != 1) {
1060-
throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools");
1060+
s_logger.debug("Failed to find SR by name 'XenServer Tools', will try to find 'XCP-ng Tools' SR");
1061+
srs = SR.getByNameLabel(conn, "XCP-ng Tools");
1062+
if (srs.size() != 1) {
1063+
throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools");
1064+
}
10611065
}
10621066
final SR sr = srs.iterator().next();
10631067
sr.scan(conn);
@@ -2645,7 +2649,7 @@ private String actualIsoTemplate(final Connection conn) throws BadServerResponse
26452649
final String[] items = xenVersion.split("\\.");
26462650

26472651
// guest-tools.iso for XenServer version 7.0+
2648-
if (xenBrand.equals("XenServer") && Integer.parseInt(items[0]) >= 7) {
2652+
if ((xenBrand.equals("XenServer") || xenBrand.equals("XCP-ng")) && Integer.parseInt(items[0]) >= 7) {
26492653
return "guest-tools.iso";
26502654
}
26512655

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import com.cloud.exception.InternalErrorException;
8080
import com.cloud.hypervisor.Hypervisor.HypervisorType;
8181
import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.SRType;
82+
import com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.XenServerUtilitiesHelper;
8283
import com.cloud.storage.DataStoreRole;
8384
import com.cloud.storage.Storage;
8485
import com.cloud.storage.Storage.ImageFormat;
@@ -410,7 +411,7 @@ public Answer dettachIso(final DettachCommand cmd) {
410411
}
411412
}
412413

413-
if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
414+
if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
414415
hypervisorResource.removeSR(conn, sr);
415416
}
416417

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixAttachIsoCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public Answer execute(final AttachIsoCommand command, final CitrixResourceBase c
119119
}
120120
}
121121

122-
if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
122+
if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
123123
citrixResourceBase.removeSR(conn, sr);
124124
}
125125

plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServerUtilitiesHelper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.cloud.utils.Pair;
2222
import com.cloud.utils.ssh.SshHelper;
23+
import com.google.common.base.Strings;
2324

2425

2526
/**
@@ -42,4 +43,8 @@ public String buildCommandLine(final String scriptPath, final String script, fin
4243

4344
return cmdLine.toString();
4445
}
46+
47+
public static boolean isXenServerToolsSR(final String label) {
48+
return !Strings.isNullOrEmpty(label) && (label.startsWith("XenServer Tools") || label.startsWith("XCP-ng Tools"));
49+
}
4550
}

systemvm/debian/etc/systemd/system/cloud-postinit.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Unit]
22
Description=CloudStack post-patching init script
33
After=cloud-early-config.service network.target local-fs.target
4-
Before=ssh.service apache2.service
4+
Before=ssh.service
55
Requires=network.service
66

77
[Install]

systemvm/debian/opt/cloud/bin/cs/CsApp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def setup(self):
5151
file.search("ServerName.*", "\tServerName %s.%s" % (self.config.cl.get_type(), self.config.get_domain()))
5252
if file.is_changed():
5353
file.commit()
54-
CsHelper.service("apache2", "restart")
54+
CsHelper.execute2("systemctl restart apache2", False)
5555

5656
self.fw.append([
5757
"", "front",

systemvm/debian/opt/cloud/bin/cs/CsHelper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ def save_iptables(command, iptables_file):
211211
fIptables.close()
212212

213213

214-
def execute2(command):
214+
def execute2(command, wait=True):
215215
""" Execute command """
216216
logging.debug("Executing: %s" % command)
217217
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
218-
p.wait()
218+
if wait:
219+
p.wait()
219220
return p
220221

221222

0 commit comments

Comments
 (0)