Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
73e5576
schema: add XS 8.3, 8.4 hypervisor capabilities
rohityadavcloud Feb 28, 2025
78da6ec
fix os mappings
rohityadavcloud Feb 28, 2025
b73bc69
fix more mappings
rohityadavcloud Feb 28, 2025
31123e3
fix os mappings order
rohityadavcloud Feb 28, 2025
9a99c43
Use Python3 for Xenserver 8.4
Pearl1594 Apr 9, 2025
5e2afc3
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 Apr 9, 2025
2b69003
add license
Pearl1594 Apr 9, 2025
37d1704
fix linter
Pearl1594 Apr 9, 2025
a098060
add more py3 scripts for xen 8.4
Pearl1594 Apr 10, 2025
e5e80ae
prevent systemwide py3 change and address linter issues
Pearl1594 Apr 10, 2025
2502888
address linter issue
Pearl1594 Apr 10, 2025
5ee3ace
add more files
Pearl1594 Apr 10, 2025
b3057cf
linter fixes
Pearl1594 Apr 10, 2025
cc52c70
add another py3 file
Pearl1594 Apr 10, 2025
e8828e5
change base class
Pearl1594 Apr 10, 2025
0bd2f28
add xcp83 resource and appropriate patch file for py3 compatibility
Pearl1594 Apr 11, 2025
040d878
add license
Pearl1594 Apr 11, 2025
75a8e44
Add logic to skip mounting guest tools if xs version >= 8.2
Pearl1594 Apr 11, 2025
b0e52d2
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 Apr 18, 2025
75c9fff
fix test test_guest_os due to missing template on xen 8.4
Pearl1594 Apr 21, 2025
8ff139e
xen-api: use https://mvnrepository.com/artifact/com.citrix.hypervisor…
weizhouapache Apr 22, 2025
35a30f2
fix to allow hosts to get added
Pearl1594 Apr 23, 2025
f28700b
update script with missing method in built in scripts SR.py and make …
Pearl1594 Apr 23, 2025
3bec407
update nfssr script as there are missing parameters
Pearl1594 Apr 23, 2025
63fb4f3
add missing plugin required for xcp 8.3
Pearl1594 Apr 23, 2025
3059871
fix issue with sysvm volume creation - [SR_BACKEND_FAILURE_1200statvf…
Pearl1594 Apr 23, 2025
f1128a0
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 Apr 25, 2025
7f98ca1
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 Apr 29, 2025
cdf6358
fix test for xcp 8.3
Pearl1594 Apr 29, 2025
2228fe7
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 Apr 30, 2025
3509d13
Fix test when passing extra config
Pearl1594 Apr 30, 2025
84ea6ce
update folder path permission
Pearl1594 May 1, 2025
1ae4276
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 May 5, 2025
c2d1990
Merge branch '4.20' of https://github.com/apache/cloudstack into supp…
Pearl1594 May 8, 2025
2d800df
add missing guest OS mappings
Pearl1594 May 8, 2025
0c8a738
update guest os category
Pearl1594 May 8, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,59 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.storage_pool', 'used_iops', 'bigint
-- Add reason column for op_ha_work
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.op_ha_work', 'reason', 'varchar(32) DEFAULT NULL COMMENT "Reason for the HA work"');

-- Support for XCP-ng 8.3.0 and XenServer 8.4 by adding hypervisor capabilities
-- https://docs.xenserver.com/en-us/xenserver/8/system-requirements/configuration-limits.html
-- https://docs.xenserver.com/en-us/citrix-hypervisor/system-requirements/configuration-limits.html
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.3.0', 1000, 254, 64, 1);
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.4.0', 1000, 240, 64, 1);

-- Add missing and new Guest OS mappings
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 10 (64-bit)', 'XenServer', '8.2.1', 'Debian Buster 10');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (5, 'SUSE Linux Enterprise Server 15 (64-bit)', 'XenServer', '8.2.1', 'SUSE Linux Enterprise 15 (64-bit)');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows Server 2022 (64-bit)', 'XenServer', '8.2.1', 'Windows Server 2022 (64-bit)');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows 11 (64-bit)', 'XenServer', '8.2.1', 'Windows 11');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 20.04 LTS', 'XenServer', '8.2.1', 'Ubuntu Focal Fossa 20.04');

-- Copy XS 8.2.1 hypervisor guest OS mappings to XS 8.3 and 8.3 mappings to 8.4
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.3.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.2.1';

-- Add new and missing guest os mappings for XS 8.3
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'Rocky Linux 9', 'XenServer', '8.3.0', 'Rocky Linux 9');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'Rocky Linux 8', 'XenServer', '8.3.0', 'Rocky Linux 8');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'AlmaLinux 9', 'XenServer', '8.3.0', 'AlmaLinux 9');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'AlmaLinux 8', 'XenServer', '8.3.0', 'AlmaLinux 8');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 12 (64-bit)', 'XenServer', '8.3.0', 'Debian Bookworm 12');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (3, 'Oracle Linux 9', 'XenServer', '8.3.0', 'Oracle Linux 9');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (3, 'Oracle Linux 8', 'XenServer', '8.3.0', 'Oracle Linux 8');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Red Hat Enterprise Linux 8.0', 'XenServer', '8.3.0', 'Red Hat Enterprise Linux 8');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Red Hat Enterprise Linux 9.0', 'XenServer', '8.3.0', 'Red Hat Enterprise Linux 9');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 22.04 LTS', 'XenServer', '8.3.0', 'Ubuntu Jammy Jellyfish 22.04');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (5, 'SUSE Linux Enterprise Server 12 SP5 (64-bit)', 'XenServer', '8.3.0', 'SUSE Linux Enterprise Server 12 SP5 (64-bit');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'NeoKylin Linux Server 7', 'XenServer', '8.3.0', 'NeoKylin Linux Server 7');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'CentOS Stream 9', 'XenServer', '8.3.0', 'CentOS Stream 9');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Scientific Linux 7', 'XenServer', '8.3.0', 'Scientific Linux 7');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (7, 'Generic Linux UEFI', 'XenServer', '8.3.0', 'Generic Linux UEFI');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (7, 'Generic Linux BIOS', 'XenServer', '8.3.0', 'Generic Linux BIOS');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Gooroom Platform 2.0', 'XenServer', '8.3.0', 'Gooroom Platform 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.4.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='8.3.0';

-- Add new guest os mappings for XS 8.4 and KVM
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows Server 2025', 'XenServer', '8.4.0', 'Windows Server 2025');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 24.04 LTS', 'XenServer', '8.4.0', 'Ubuntu Noble Numbat 24.04');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 10 (64-bit)', 'KVM', 'default', 'Debian GNU/Linux 10 (64-bit)');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 11 (64-bit)', 'KVM', 'default', 'Debian GNU/Linux 11 (64-bit)');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Debian GNU/Linux 12 (64-bit)', 'KVM', 'default', 'Debian GNU/Linux 12 (64-bit)');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows 11 (64-bit)', 'KVM', 'default', 'Windows 11');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (6, 'Windows Server 2025', 'KVM', 'default', 'Windows Server 2025');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (10, 'Ubuntu 24.04 LTS', 'KVM', 'default', 'Ubuntu 24.04 LTS');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'CentOS Stream 10 (preview)', 'XenServer', '8.4.0', 'CentOS Stream 10 (preview)');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (1, 'CentOS Stream 9', 'XenServer', '8.4.0', 'CentOS Stream 9');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'Scientific Linux 7', 'XenServer', '8.4.0', 'Scientific Linux 7');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (4, 'NeoKylin Linux Server 7', 'XenServer', '8.4.0', 'NeoKylin Linux Server 7');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (5, 'SUSE Linux Enterprise Server 12 SP5 (64-bit)', 'XenServer', '8.4.0', 'SUSE Linux Enterprise Server 12 SP5 (64-bit');
CALL ADD_GUEST_OS_AND_HYPERVISOR_MAPPING (2, 'Gooroom Platform 2.0', 'XenServer', '8.4.0', 'Gooroom Platform 2.0');

-- Grant access to 2FA APIs for the "Read-Only User - Default" role

CALL `cloud`.`IDEMPOTENT_UPDATE_API_PERMISSION`('Read-Only User - Default', 'setupUserTwoFactorAuthentication', 'ALLOW');
Expand Down
2 changes: 1 addition & 1 deletion plugins/hypervisors/ovm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</parent>
<dependencies>
<dependency>
<groupId>net.java.dev.vcc.thirdparty</groupId>
<groupId>com.citrix.hypervisor</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should (instead) deprecate ovm?

<artifactId>xen-api</artifactId>
<version>${cs.xapi.version}</version>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion plugins/hypervisors/xenserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.java.dev.vcc.thirdparty</groupId>
<groupId>com.citrix.hypervisor</groupId>
<artifactId>xen-api</artifactId>
<version>${cs.xapi.version}</version>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import javax.naming.ConfigurationException;
import javax.persistence.EntityExistsException;

import com.cloud.hypervisor.xenserver.resource.XcpServer83Resource;
import com.cloud.hypervisor.xenserver.resource.Xenserver84Resource;
import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -265,7 +267,6 @@
} catch (Exception e) {
logger.debug("Caught exception during logout", e);
}
conn.dispose();
conn = null;
}

Expand Down Expand Up @@ -435,6 +436,10 @@
}
} else if (prodBrand.equals("XCP_Kronos")) {
return new XcpOssResource();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("8.4.0")) {
return new Xenserver84Resource();

Check warning on line 440 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L440 was not covered by tests
} else if (prodBrand.equals("XCP-ng") && (prodVersion.equals("8.3.0"))) {
return new XcpServer83Resource();

Check warning on line 442 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L442 was not covered by tests
} else if (prodBrand.equals("XenServer") || prodBrand.equals("XCP-ng") || prodBrand.equals("Citrix Hypervisor")) {
final String[] items = prodVersion.split("\\.");
if ((Integer.parseInt(items[0]) > 6) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,7 @@
nwr.nameLabel = newName;
nwr.tags = new HashSet<>();
nwr.tags.add(generateTimeStamp());
nwr.managed = true;

Check warning on line 1702 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L1702 was not covered by tests
vlanNetwork = Network.create(conn, nwr);
vlanNic = getNetworkByName(conn, newName);
if (vlanNic == null) { // Still vlanNic is null means we could not
Expand Down Expand Up @@ -2004,6 +2005,7 @@
// started
otherConfig.put("assume_network_is_shared", "true");
rec.otherConfig = otherConfig;
rec.managed = true;

Check warning on line 2008 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L2008 was not covered by tests
nw = Network.create(conn, rec);
logger.debug("### XenServer network for tunnels created:" + nwName);
} else {
Expand Down Expand Up @@ -4829,6 +4831,7 @@
configs.put("netmask", NetUtils.getLinkLocalNetMask());
configs.put("vswitch-disable-in-band", "true");
rec.otherConfig = configs;
rec.managed = true;

Check warning on line 4834 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L4834 was not covered by tests
linkLocal = Network.create(conn, rec);
} else {
linkLocal = networks.iterator().next();
Expand Down Expand Up @@ -5017,6 +5020,7 @@
if (networks.isEmpty()) {
rec.nameDescription = "vswitch network for " + nwName;
rec.nameLabel = nwName;
rec.managed = true;

Check warning on line 5023 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L5023 was not covered by tests
vswitchNw = Network.create(conn, rec);
} else {
vswitchNw = networks.iterator().next();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.hypervisor.xenserver.resource;

public class XcpServer83Resource extends XenServer650Resource {

@Override
protected String getPatchFilePath() {
return "scripts/vm/hypervisor/xenserver/xcpserver83/patch";
}

Check warning on line 24 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XcpServer83Resource.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XcpServer83Resource.java#L22-L24

Added lines #L22 - L24 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.cloud.utils.exception.CloudRuntimeException;
import com.xensource.xenapi.APIVersion;
import com.xensource.xenapi.Connection;
import com.xensource.xenapi.ConnectionNew;
import com.xensource.xenapi.Host;
import com.xensource.xenapi.Pool;
import com.xensource.xenapi.Session;
Expand Down Expand Up @@ -150,12 +151,12 @@
}

public Connection getConnect(String ip, String username, Queue<String> password) {
Connection conn = new Connection(getURL(ip), 10, _connWait);
Connection conn = new ConnectionNew(getURL(ip), 10, _connWait);

Check warning on line 154 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java#L154

Added line #L154 was not covered by tests
try {
loginWithPassword(conn, username, password, APIVersion.latest().toString());
} catch (Types.HostIsSlave e) {
String maddress = e.masterIPAddress;
conn = new Connection(getURL(maddress), 10, _connWait);
conn = new ConnectionNew(getURL(maddress), 10, _connWait);

Check warning on line 159 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java#L159

Added line #L159 was not covered by tests
try {
loginWithPassword(conn, username, password, APIVersion.latest().toString());
} catch (Exception e1) {
Expand Down Expand Up @@ -221,7 +222,7 @@

if ( mConn == null ) {
try {
Connection conn = new Connection(getURL(ipAddress), 5, _connWait);
Connection conn = new ConnectionNew(getURL(ipAddress), 5, _connWait);

Check warning on line 225 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/XenServerConnectionPool.java#L225

Added line #L225 was not covered by tests
Session sess = loginWithPassword(conn, username, password, APIVersion.latest().toString());
Host host = sess.getThisHost(conn);
Boolean hostenabled = host.getEnabled(conn);
Expand All @@ -231,7 +232,6 @@
} catch (Exception e) {
LOGGER.debug("Caught exception during logout", e);
}
conn.dispose();
}
if (!hostenabled) {
String msg = "Unable to create master connection, due to master Host " + ipAddress + " is not enabled";
Expand Down Expand Up @@ -412,7 +412,7 @@
return s_instance;
}

public class XenServerConnection extends Connection {
public class XenServerConnection extends ConnectionNew {
long _interval;
int _retries;
String _ip;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.hypervisor.xenserver.resource;

public class Xenserver84Resource extends XenServer650Resource {
@Override
protected String getPatchFilePath() {
return "scripts/vm/hypervisor/xenserver/xenserver84/patch";
}

Check warning on line 23 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/Xenserver84Resource.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/Xenserver84Resource.java#L21-L23

Added lines #L21 - L23 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,15 @@
citrixResourceBase.createVGPU(conn, command, vm, gpuDevice);
}

if (vmSpec.getType() != VirtualMachine.Type.User) {
Host.Record record = host.getRecord(conn);
String xenBrand = record.softwareVersion.get("product_brand");
String xenVersion = record.softwareVersion.get("product_version");
boolean requiresGuestTools = true;

Check warning on line 102 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java#L99-L102

Added lines #L99 - L102 were not covered by tests
if (xenBrand.equals("XenServer") && isVersionGreaterThanOrEqual(xenVersion, "8.2.0")) {
requiresGuestTools = false;

Check warning on line 104 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java#L104

Added line #L104 was not covered by tests
}

if (vmSpec.getType() != VirtualMachine.Type.User && requiresGuestTools) {
citrixResourceBase.createPatchVbd(conn, vmName, vm);
}

Expand Down Expand Up @@ -263,4 +271,19 @@
}
}
}

public static boolean isVersionGreaterThanOrEqual(String v1, String v2) {
String[] parts1 = v1.split("\\.");
String[] parts2 = v2.split("\\.");

Check warning on line 277 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java#L275-L277

Added lines #L275 - L277 were not covered by tests

int length = Math.max(parts1.length, parts2.length);

Check warning on line 279 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java#L279

Added line #L279 was not covered by tests
for (int i = 0; i < length; i++) {
int num1 = i < parts1.length ? Integer.parseInt(parts1[i]) : 0;
int num2 = i < parts2.length ? Integer.parseInt(parts2[i]) : 0;

if (num1 > num2) return true;
if (num1 < num2) return false;
}
return true; // versions are equal
}

Check warning on line 288 in plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java

View check run for this annotation

Codecov / codecov/patch

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java#L287-L288

Added lines #L287 - L288 were not covered by tests
}
Loading
Loading