Skip to content

Commit b97a2c9

Browse files
Merge branch '4.22' into 4.22-vr-fix-haproxy-check-with-ssl-offloading
2 parents 9a312bd + 5caf6cd commit b97a2c9

File tree

110 files changed

+1516
-1409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1516
-1409
lines changed

api/src/main/java/com/cloud/host/Host.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public static String[] toStrings(Host.Type... types) {
5959
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
6060
String HOST_OVFTOOL_VERSION = "host.ovftool.version";
6161
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
62+
String HOST_SSH_PORT = "host.ssh.port";
63+
64+
int DEFAULT_SSH_PORT = 22;
6265

6366
/**
6467
* @return name of the machine.

api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ public Map getDetails() {
153153
return (Map) (paramsCollection.toArray())[0];
154154
}
155155

156-
public boolean isCleanupDetails(){
157-
return cleanupDetails == null ? false : cleanupDetails.booleanValue();
156+
public boolean isCleanupDetails() {
157+
return cleanupDetails != null && cleanupDetails;
158158
}
159159

160160
public CPU.CPUArch getCPUArch() {

api/src/main/java/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public class AddHostCmd extends BaseCmd {
6060
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, required = true, description = "The Pod ID for the host")
6161
private Long podId;
6262

63-
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL")
63+
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "The host URL, optionally add ssh port (format: 'host:port') for KVM hosts," +
64+
" otherwise falls back to the port defined at the config 'kvm.host.discovery.ssh.port'")
6465
private String url;
6566

6667
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The Zone ID for the host")

api/src/main/java/org/apache/cloudstack/api/command/user/vm/BaseDeployVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
188188
@Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "the mac address for default vm's network")
189189
private String macAddress;
190190

191-
@Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
191+
@Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,es-latam,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
192192
private String keyboard;
193193

194194
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Deploy vm for the project")

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
340340
@Param(description = "List of read-only Instance details as comma separated string.", since = "4.16.0")
341341
private String readOnlyDetails;
342342

343+
@SerializedName("alloweddetails")
344+
@Param(description = "List of allowed Vm details as comma separated string if VM instance settings are read from OVA.", since = "4.22.1")
345+
private String allowedDetails;
346+
343347
@SerializedName(ApiConstants.SSH_KEYPAIRS)
344348
@Param(description = "SSH key-pairs")
345349
private String keyPairNames;
@@ -1091,6 +1095,10 @@ public void setReadOnlyDetails(String readOnlyDetails) {
10911095
this.readOnlyDetails = readOnlyDetails;
10921096
}
10931097

1098+
public void setAllowedDetails(String allowedDetails) {
1099+
this.allowedDetails = allowedDetails;
1100+
}
1101+
10941102
public void setOsTypeId(String osTypeId) {
10951103
this.osTypeId = osTypeId;
10961104
}
@@ -1115,6 +1123,10 @@ public String getReadOnlyDetails() {
11151123
return readOnlyDetails;
11161124
}
11171125

1126+
public String getAllowedDetails() {
1127+
return allowedDetails;
1128+
}
1129+
11181130
public Boolean getDynamicallyScalable() {
11191131
return isDynamicallyScalable;
11201132
}

api/src/main/java/org/apache/cloudstack/backup/BackupManager.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.apache.cloudstack.api.command.user.backup.ListBackupsCmd;
3333
import org.apache.cloudstack.api.response.BackupResponse;
3434
import org.apache.cloudstack.framework.config.ConfigKey;
35+
import org.apache.cloudstack.framework.config.ValidatedConfigKey;
3536
import org.apache.cloudstack.framework.config.Configurable;
3637

3738
import com.cloud.exception.ResourceUnavailableException;
@@ -53,10 +54,11 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
5354
"false",
5455
"Is backup and recovery framework enabled.", false, ConfigKey.Scope.Zone);
5556

56-
ConfigKey<String> BackupProviderPlugin = new ConfigKey<>("Advanced", String.class,
57+
ConfigKey<String> BackupProviderPlugin = new ValidatedConfigKey<>("Advanced", String.class,
5758
"backup.framework.provider.plugin",
5859
"dummy",
59-
"The backup and recovery provider plugin. Valid plugin values: dummy, veeam, networker and nas", true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key());
60+
"The backup and recovery provider plugin. Valid plugin values: dummy, veeam, networker and nas",
61+
true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key(), value -> validateBackupProviderConfig((String)value));
6062

6163
ConfigKey<Long> BackupSyncPollingInterval = new ConfigKey<>("Advanced", Long.class,
6264
"backup.framework.sync.interval",
@@ -247,4 +249,14 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
247249
Capacity getBackupStorageUsedStats(Long zoneId);
248250

249251
void checkAndRemoveBackupOfferingBeforeExpunge(VirtualMachine vm);
252+
253+
static void validateBackupProviderConfig(String value) {
254+
if (value != null && (value.contains(",") || value.trim().contains(" "))) {
255+
throw new IllegalArgumentException("Multiple backup provider plugins are not supported. Please provide a single plugin value.");
256+
}
257+
List<String> validPlugins = List.of("dummy", "veeam", "networker", "nas");
258+
if (value != null && !validPlugins.contains(value)) {
259+
throw new IllegalArgumentException("Invalid backup provider plugin: " + value + ". Valid plugin values are: " + String.join(", ", validPlugins));
260+
}
261+
}
250262
}

core/src/main/java/org/apache/cloudstack/backup/RestoreBackupCommand.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public class RestoreBackupCommand extends Command {
3434
private List<String> backupVolumesUUIDs;
3535
private List<PrimaryDataStoreTO> restoreVolumePools;
3636
private List<String> restoreVolumePaths;
37+
private List<String> backupFiles;
3738
private String diskType;
3839
private Boolean vmExists;
39-
private String restoreVolumeUUID;
4040
private VirtualMachine.State vmState;
4141
private Integer mountTimeout;
4242

@@ -92,6 +92,14 @@ public void setRestoreVolumePaths(List<String> restoreVolumePaths) {
9292
this.restoreVolumePaths = restoreVolumePaths;
9393
}
9494

95+
public List<String> getBackupFiles() {
96+
return backupFiles;
97+
}
98+
99+
public void setBackupFiles(List<String> backupFiles) {
100+
this.backupFiles = backupFiles;
101+
}
102+
95103
public Boolean isVmExists() {
96104
return vmExists;
97105
}
@@ -116,14 +124,6 @@ public void setMountOptions(String mountOptions) {
116124
this.mountOptions = mountOptions;
117125
}
118126

119-
public String getRestoreVolumeUUID() {
120-
return restoreVolumeUUID;
121-
}
122-
123-
public void setRestoreVolumeUUID(String restoreVolumeUUID) {
124-
this.restoreVolumeUUID = restoreVolumeUUID;
125-
}
126-
127127
public VirtualMachine.State getVmState() {
128128
return vmState;
129129
}

engine/components-api/src/main/java/com/cloud/agent/AgentManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public interface AgentManager {
5454
"This timeout overrides the wait global config. This holds a comma separated key value pairs containing timeout (in seconds) for specific commands. " +
5555
"For example: DhcpEntryCommand=600, SavePasswordCommand=300, VmDataCommand=300", false);
5656

57+
ConfigKey<Integer> KVMHostDiscoverySshPort = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Integer.class,
58+
"kvm.host.discovery.ssh.port", String.valueOf(Host.DEFAULT_SSH_PORT), "SSH port used for KVM host discovery and any other operations on host (using SSH)." +
59+
" Please note that this is applicable when port is not defined through host url while adding the KVM host.", true, ConfigKey.Scope.Cluster);
60+
5761
enum TapAgentsAction {
5862
Add, Del, Contains,
5963
}
@@ -172,4 +176,6 @@ enum TapAgentsAction {
172176
void propagateChangeToAgents(Map<String, String> params);
173177

174178
boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance);
179+
180+
int getHostSshPort(HostVO host);
175181
}

engine/components-api/src/main/java/com/cloud/resource/ResourceManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ public interface ResourceManager extends ResourceService, Configurable {
167167

168168
public HostVO findHostByGuid(String guid);
169169

170+
HostVO findHostByGuidPrefix(String guid);
171+
170172
public HostVO findHostByName(String name);
171173

172174
HostStats getHostStatistics(Host host);

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import javax.inject.Inject;
4343
import javax.naming.ConfigurationException;
4444

45+
import com.cloud.utils.StringUtils;
4546
import org.apache.cloudstack.agent.lb.IndirectAgentLB;
4647
import org.apache.cloudstack.ca.CAManager;
4748
import org.apache.cloudstack.command.ReconcileCommandService;
@@ -64,7 +65,6 @@
6465
import org.apache.commons.collections.MapUtils;
6566
import org.apache.commons.lang3.BooleanUtils;
6667
import org.apache.commons.lang3.ObjectUtils;
67-
import org.apache.commons.lang3.StringUtils;
6868
import org.apache.logging.log4j.ThreadContext;
6969

7070
import com.cloud.agent.AgentManager;
@@ -2113,7 +2113,7 @@ public ConfigKey<?>[] getConfigKeys() {
21132113
return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize,
21142114
DirectAgentPoolSize, DirectAgentThreadCap, EnableKVMAutoEnableDisable, ReadyCommandWait,
21152115
GranularWaitTimeForCommands, RemoteAgentSslHandshakeTimeout, RemoteAgentMaxConcurrentNewConnections,
2116-
RemoteAgentNewConnectionsMonitorInterval };
2116+
RemoteAgentNewConnectionsMonitorInterval, KVMHostDiscoverySshPort };
21172117
}
21182118

21192119
protected class SetHostParamsListener implements Listener {
@@ -2236,6 +2236,25 @@ public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long
22362236
return true;
22372237
}
22382238

2239+
@Override
2240+
public int getHostSshPort(HostVO host) {
2241+
if (host == null) {
2242+
return KVMHostDiscoverySshPort.value();
2243+
}
2244+
2245+
if (host.getHypervisorType() != HypervisorType.KVM) {
2246+
return Host.DEFAULT_SSH_PORT;
2247+
}
2248+
2249+
_hostDao.loadDetails(host);
2250+
String hostPort = host.getDetail(Host.HOST_SSH_PORT);
2251+
if (StringUtils.isBlank(hostPort)) {
2252+
return KVMHostDiscoverySshPort.valueIn(host.getClusterId());
2253+
}
2254+
2255+
return Integer.parseInt(hostPort);
2256+
}
2257+
22392258
private GlobalLock getHostJoinLock(Long hostId) {
22402259
return GlobalLock.getInternLock(String.format("%s-%s", "Host-Join", hostId));
22412260
}

0 commit comments

Comments
 (0)