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>
This commit is contained in:
Rohit Yadav 2018-04-30 08:19:10 +02:00 committed by GitHub
parent 296a3804b9
commit 464551208c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 11 deletions

View File

@ -78,4 +78,16 @@ UPDATE `cloud`.`guest_os_hypervisor` SET `guest_os_name`='debian5_64Guest' WHERE
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'; 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';
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'; 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';
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'; 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';
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'; 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';
-- XenServer 7.3
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);
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';
-- XenServer 7.4
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);
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';
-- XCP-NG 7.4
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);
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';

View File

@ -422,7 +422,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
} }
} else if (prodBrand.equals("XCP_Kronos")) { } else if (prodBrand.equals("XCP_Kronos")) {
return new XcpOssResource(); return new XcpOssResource();
} else if (prodBrand.equals("XenServer")) { } else if (prodBrand.equals("XenServer") || prodBrand.equals("XCP-ng")) {
final String[] items = prodVersion.split("\\."); final String[] items = prodVersion.split("\\.");
if ((Integer.parseInt(items[0]) > 6) || if ((Integer.parseInt(items[0]) > 6) ||
(Integer.parseInt(items[0]) == 6 && Integer.parseInt(items[1]) >= 4)) { (Integer.parseInt(items[0]) == 6 && Integer.parseInt(items[1]) >= 4)) {

View File

@ -1055,9 +1055,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
public VBD createPatchVbd(final Connection conn, final String vmName, final VM vm) throws XmlRpcException, XenAPIException { public VBD createPatchVbd(final Connection conn, final String vmName, final VM vm) throws XmlRpcException, XenAPIException {
if (_host.getSystemvmisouuid() == null) { if (_host.getSystemvmisouuid() == null) {
final Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools"); Set<SR> srs = SR.getByNameLabel(conn, "XenServer Tools");
if (srs.size() != 1) { if (srs.size() != 1) {
throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools"); s_logger.debug("Failed to find SR by name 'XenServer Tools', will try to find 'XCP-ng Tools' SR");
srs = SR.getByNameLabel(conn, "XCP-ng Tools");
if (srs.size() != 1) {
throw new CloudRuntimeException("There are " + srs.size() + " SRs with name XenServer Tools");
}
} }
final SR sr = srs.iterator().next(); final SR sr = srs.iterator().next();
sr.scan(conn); sr.scan(conn);
@ -2645,7 +2649,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
final String[] items = xenVersion.split("\\."); final String[] items = xenVersion.split("\\.");
// guest-tools.iso for XenServer version 7.0+ // guest-tools.iso for XenServer version 7.0+
if (xenBrand.equals("XenServer") && Integer.parseInt(items[0]) >= 7) { if ((xenBrand.equals("XenServer") || xenBrand.equals("XCP-ng")) && Integer.parseInt(items[0]) >= 7) {
return "guest-tools.iso"; return "guest-tools.iso";
} }

View File

@ -79,6 +79,7 @@ import com.cloud.agent.api.to.SwiftTO;
import com.cloud.exception.InternalErrorException; import com.cloud.exception.InternalErrorException;
import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.SRType; import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.SRType;
import com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.XenServerUtilitiesHelper;
import com.cloud.storage.DataStoreRole; import com.cloud.storage.DataStoreRole;
import com.cloud.storage.Storage; import com.cloud.storage.Storage;
import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.ImageFormat;
@ -410,7 +411,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
} }
} }
if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) { if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
hypervisorResource.removeSR(conn, sr); hypervisorResource.removeSR(conn, sr);
} }

View File

@ -119,7 +119,7 @@ public final class CitrixAttachIsoCommandWrapper extends CommandWrapper<AttachIs
} }
} }
if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) { if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
citrixResourceBase.removeSR(conn, sr); citrixResourceBase.removeSR(conn, sr);
} }

View File

@ -20,6 +20,7 @@ import java.io.File;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
import com.cloud.utils.ssh.SshHelper; import com.cloud.utils.ssh.SshHelper;
import com.google.common.base.Strings;
/** /**
@ -42,4 +43,8 @@ public class XenServerUtilitiesHelper {
return cmdLine.toString(); return cmdLine.toString();
} }
public static boolean isXenServerToolsSR(final String label) {
return !Strings.isNullOrEmpty(label) && (label.startsWith("XenServer Tools") || label.startsWith("XCP-ng Tools"));
}
} }

View File

@ -1,7 +1,7 @@
[Unit] [Unit]
Description=CloudStack post-patching init script Description=CloudStack post-patching init script
After=cloud-early-config.service network.target local-fs.target After=cloud-early-config.service network.target local-fs.target
Before=ssh.service apache2.service Before=ssh.service
Requires=network.service Requires=network.service
[Install] [Install]

View File

@ -51,7 +51,7 @@ class CsApache(CsApp):
file.search("ServerName.*", "\tServerName %s.%s" % (self.config.cl.get_type(), self.config.get_domain())) file.search("ServerName.*", "\tServerName %s.%s" % (self.config.cl.get_type(), self.config.get_domain()))
if file.is_changed(): if file.is_changed():
file.commit() file.commit()
CsHelper.service("apache2", "restart") CsHelper.execute2("systemctl restart apache2", False)
self.fw.append([ self.fw.append([
"", "front", "", "front",

View File

@ -211,11 +211,12 @@ def save_iptables(command, iptables_file):
fIptables.close() fIptables.close()
def execute2(command): def execute2(command, wait=True):
""" Execute command """ """ Execute command """
logging.debug("Executing: %s" % command) logging.debug("Executing: %s" % command)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
p.wait() if wait:
p.wait()
return p return p