Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion engine/schema/resources/META-INF/db/schema-41100to41110.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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.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.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';
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) {
}
} else if (prodBrand.equals("XCP_Kronos")) {
return new XcpOssResource();
} else if (prodBrand.equals("XenServer")) {
} else if (prodBrand.equals("XenServer") || prodBrand.equals("XCP-ng")) {
final String[] items = prodVersion.split("\\.");
if ((Integer.parseInt(items[0]) > 6) ||
(Integer.parseInt(items[0]) == 6 && Integer.parseInt(items[1]) >= 4)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,9 +1055,13 @@ protected SR createNfsSRbyURI(final Connection conn, final URI uri, final boolea
public VBD createPatchVbd(final Connection conn, final String vmName, final VM vm) throws XmlRpcException, XenAPIException {

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) {
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();
sr.scan(conn);
Expand Down Expand Up @@ -2645,7 +2649,7 @@ private String actualIsoTemplate(final Connection conn) throws BadServerResponse
final String[] items = xenVersion.split("\\.");

// 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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a comment; how about defining applicable targets as a set for readability.
Also, though it doesn't apply to this PR, parsing an it is not a very prozaic way of saying you need to be at version 7 or higher. that comment at 2651 should have been a method name instead of a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to address this, I'll let it be for this PR.

return "guest-tools.iso";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import com.cloud.exception.InternalErrorException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
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.Storage;
import com.cloud.storage.Storage.ImageFormat;
Expand Down Expand Up @@ -410,7 +411,7 @@ public Answer dettachIso(final DettachCommand cmd) {
}
}

if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
hypervisorResource.removeSR(conn, sr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public Answer execute(final AttachIsoCommand command, final CitrixResourceBase c
}
}

if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
citrixResourceBase.removeSR(conn, sr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.cloud.utils.Pair;
import com.cloud.utils.ssh.SshHelper;
import com.google.common.base.Strings;


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

return cmdLine.toString();
}

public static boolean isXenServerToolsSR(final String label) {
return !Strings.isNullOrEmpty(label) && (label.startsWith("XenServer Tools") || label.startsWith("XCP-ng Tools"));
}
}
2 changes: 1 addition & 1 deletion systemvm/debian/etc/systemd/system/cloud-postinit.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=CloudStack post-patching init script
After=cloud-early-config.service network.target local-fs.target
Before=ssh.service apache2.service
Before=ssh.service
Requires=network.service

[Install]
Expand Down
2 changes: 1 addition & 1 deletion systemvm/debian/opt/cloud/bin/cs/CsApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def setup(self):
file.search("ServerName.*", "\tServerName %s.%s" % (self.config.cl.get_type(), self.config.get_domain()))
if file.is_changed():
file.commit()
CsHelper.service("apache2", "restart")
CsHelper.execute2("systemctl restart apache2", False)

self.fw.append([
"", "front",
Expand Down
5 changes: 3 additions & 2 deletions systemvm/debian/opt/cloud/bin/cs/CsHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ def save_iptables(command, iptables_file):
fIptables.close()


def execute2(command):
def execute2(command, wait=True):
""" Execute command """
logging.debug("Executing: %s" % command)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
p.wait()
if wait:
p.wait()
return p


Expand Down