Skip to content

Commit 45c3819

Browse files
committed
Merge branch '4.20' of https://github.com/apache/cloudstack into ghi11438-errorprone-fixes
2 parents f4baae4 + 56dc119 commit 45c3819

File tree

114 files changed

+1380
-1529
lines changed

Some content is hidden

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

114 files changed

+1380
-1529
lines changed

.github/workflows/merge-conflict-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
name: "PR Merge Conflict Check"
1919
on:
2020
push:
21-
pull_request_target:
22-
types: [synchronize]
21+
pull_request:
22+
types: [opened, synchronize, reopened]
2323

2424
permissions: # added using https://github.com/step-security/secure-workflows
2525
contents: read

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/ApiServerService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
4848
boolean forgotPassword(UserAccount userAccount, Domain domain);
4949

5050
boolean resetPassword(UserAccount userAccount, String token, String password);
51+
52+
String getDomainId(Map<String, Object[]> params);
5153
}

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

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

148-
public boolean isCleanupDetails(){
149-
return cleanupDetails == null ? false : cleanupDetails.booleanValue();
148+
public boolean isCleanupDetails() {
149+
return cleanupDetails != null && cleanupDetails;
150150
}
151151

152152
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/backup/BackupManager.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.cloudstack.api.command.user.backup.ListBackupOfferingsCmd;
2727
import org.apache.cloudstack.api.command.user.backup.ListBackupsCmd;
2828
import org.apache.cloudstack.framework.config.ConfigKey;
29+
import org.apache.cloudstack.framework.config.ValidatedConfigKey;
2930
import org.apache.cloudstack.framework.config.Configurable;
3031

3132
import com.cloud.utils.Pair;
@@ -42,10 +43,11 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
4243
"false",
4344
"Is backup and recovery framework enabled.", false, ConfigKey.Scope.Zone);
4445

45-
ConfigKey<String> BackupProviderPlugin = new ConfigKey<>("Advanced", String.class,
46+
ConfigKey<String> BackupProviderPlugin = new ValidatedConfigKey<>("Advanced", String.class,
4647
"backup.framework.provider.plugin",
4748
"dummy",
48-
"The backup and recovery provider plugin.", true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key());
49+
"The backup and recovery provider plugin. Valid plugin values: dummy, veeam, networker and nas",
50+
true, ConfigKey.Scope.Zone, BackupFrameworkEnabled.key(), value -> validateBackupProviderConfig((String)value));
4951

5052
ConfigKey<Long> BackupSyncPollingInterval = new ConfigKey<>("Advanced", Long.class,
5153
"backup.framework.sync.interval",
@@ -148,4 +150,14 @@ public interface BackupManager extends BackupService, Configurable, PluggableSer
148150
boolean deleteBackup(final Long backupId, final Boolean forced);
149151

150152
BackupOffering updateBackupOffering(UpdateBackupOfferingCmd updateBackupOfferingCmd);
153+
154+
static void validateBackupProviderConfig(String value) {
155+
if (value != null && (value.contains(",") || value.trim().contains(" "))) {
156+
throw new IllegalArgumentException("Multiple backup provider plugins are not supported. Please provide a single plugin value.");
157+
}
158+
List<String> validPlugins = List.of("dummy", "veeam", "networker", "nas");
159+
if (value != null && !validPlugins.contains(value)) {
160+
throw new IllegalArgumentException("Invalid backup provider plugin: " + value + ". Valid plugin values are: " + String.join(", ", validPlugins));
161+
}
162+
}
151163
}

core/src/main/java/com/cloud/agent/api/ModifyStoragePoolAnswer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes,
4646
templateInfo = tInfo;
4747
}
4848

49+
public ModifyStoragePoolAnswer(final Command command, final boolean success, final String details) {
50+
super(command, success, details);
51+
}
52+
4953
public void setPoolInfo(StoragePoolInfo poolInfo) {
5054
this.poolInfo = poolInfo;
5155
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public class RestoreBackupCommand extends Command {
3131
private String backupRepoType;
3232
private String backupRepoAddress;
3333
private List<String> volumePaths;
34+
private List<String> backupFiles;
3435
private String diskType;
3536
private Boolean vmExists;
36-
private String restoreVolumeUUID;
3737
private VirtualMachine.State vmState;
3838

3939
protected RestoreBackupCommand() {
@@ -80,6 +80,14 @@ public void setVolumePaths(List<String> volumePaths) {
8080
this.volumePaths = volumePaths;
8181
}
8282

83+
public List<String> getBackupFiles() {
84+
return backupFiles;
85+
}
86+
87+
public void setBackupFiles(List<String> backupFiles) {
88+
this.backupFiles = backupFiles;
89+
}
90+
8391
public Boolean isVmExists() {
8492
return vmExists;
8593
}
@@ -104,14 +112,6 @@ public void setMountOptions(String mountOptions) {
104112
this.mountOptions = mountOptions;
105113
}
106114

107-
public String getRestoreVolumeUUID() {
108-
return restoreVolumeUUID;
109-
}
110-
111-
public void setRestoreVolumeUUID(String restoreVolumeUUID) {
112-
this.restoreVolumeUUID = restoreVolumeUUID;
113-
}
114-
115115
public VirtualMachine.State getVmState() {
116116
return vmState;
117117
}

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
}
@@ -170,4 +174,6 @@ enum TapAgentsAction {
170174
void notifyMonitorsOfRemovedHost(long hostId, long clusterId);
171175

172176
void propagateChangeToAgents(Map<String, String> params);
177+
178+
int getHostSshPort(HostVO host);
173179
}

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
@@ -154,6 +154,8 @@ public interface ResourceManager extends ResourceService, Configurable {
154154

155155
public HostVO findHostByGuid(String guid);
156156

157+
HostVO findHostByGuidPrefix(String guid);
158+
157159
public HostVO findHostByName(String name);
158160

159161
HostStats getHostStatistics(Host host);

0 commit comments

Comments
 (0)