Skip to content

Commit 482d0fd

Browse files
4.13 (#3782)
* create template from snapshot regression (partly reverted) (#3767) * Once again allow a VM to be on multiple networks from VPCs (#3754) to once again allow a VM to be on multiple networks from VPCs * convert protocal names to be found as labels (#3747) * convert protocal names to be found as labels * format * filter hosts to query on zone wide storage (#3733) * config: add isdynamic flag in configuration response (#3729) Co-authored-by: Wei Zhou <ustcweizhou@gmail.com>
1 parent 0606039 commit 482d0fd

6 files changed

Lines changed: 31 additions & 14 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ public class ApiConstants {
188188
public static final String IP_LIMIT = "iplimit";
189189
public static final String IP_TOTAL = "iptotal";
190190
public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
191+
public static final String IS_DYNAMIC = "isdynamic";
191192
public static final String IS_EXTRACTABLE = "isextractable";
192193
public static final String IS_FEATURED = "isfeatured";
193194
public static final String IS_PORTABLE = "isportable";

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public class ConfigurationResponse extends BaseResponse {
4848
@Param(description = "the description of the configuration")
4949
private String description;
5050

51+
@SerializedName(ApiConstants.IS_DYNAMIC)
52+
@Param(description = "true if the configuration is dynamic")
53+
private boolean isDynamic;
54+
5155
public String getCategory() {
5256
return category;
5357
}
@@ -87,4 +91,13 @@ public String getScope() {
8791
public void setScope(String scope) {
8892
this.scope = scope;
8993
}
94+
95+
public boolean isDynamic() {
96+
return isDynamic;
97+
}
98+
99+
public void setIsDynamic(boolean isDynamic) {
100+
this.isDynamic = isDynamic;
101+
}
102+
90103
}

server/src/main/java/com/cloud/api/ApiResponseHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ public ConfigurationResponse createConfigurationResponse(Configuration cfg) {
491491
} else {
492492
cfgResponse.setValue(cfg.getValue());
493493
}
494+
cfgResponse.setIsDynamic(cfg.isDynamic());
494495
cfgResponse.setObjectName("configuration");
495496

496497
return cfgResponse;

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import javax.inject.Inject;
4141
import javax.naming.ConfigurationException;
4242

43+
import com.cloud.storage.ScopeType;
4344
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
4445
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
4546
import org.apache.cloudstack.affinity.AffinityGroupService;
@@ -1941,14 +1942,23 @@ public HashMap<Long, VmStatsEntry> getVirtualMachineStatistics(long hostId, Stri
19411942
@Override
19421943
public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, String poolUuid, StoragePoolType poolType, List<String> volumeLocators, int timeout) {
19431944
List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(clusterId, Status.Up);
1944-
StoragePool storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
1945+
StoragePoolVO storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
19451946
for (HostVO neighbor : neighbors) {
1946-
if (storagePool.isManaged()) {
1947+
// apply filters:
1948+
// - managed storage
1949+
// - local storage
1950+
if (storagePool.isManaged() || storagePool.isLocal()) {
19471951

19481952
volumeLocators = getVolumesByHost(neighbor, storagePool);
19491953

19501954
}
19511955

1956+
// - zone wide storage for specific hypervisortypes
1957+
if (ScopeType.ZONE.equals(storagePool.getScope()) && storagePool.getHypervisor() != neighbor.getHypervisorType()) {
1958+
// skip this neighbour if their hypervisor type is not the same as that of the store
1959+
continue;
1960+
}
1961+
19521962
GetVolumeStatsCommand cmd = new GetVolumeStatsCommand(poolType, poolUuid, volumeLocators);
19531963

19541964
if (timeout > 0) {
@@ -3612,7 +3622,6 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
36123622

36133623
short defaultNetworkNumber = 0;
36143624
boolean securityGroupEnabled = false;
3615-
boolean vpcNetwork = false;
36163625
for (NetworkVO network : networkList) {
36173626
if ((network.getDataCenterId() != zone.getId())) {
36183627
if (!network.isStrechedL2Network()) {
@@ -3683,14 +3692,6 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
36833692
securityGroupEnabled = true;
36843693
}
36853694

3686-
// vm can't be a part of more than 1 VPC network
3687-
if (network.getVpcId() != null) {
3688-
if (vpcNetwork) {
3689-
throw new InvalidParameterValueException("Vm can't be a part of more than 1 VPC network");
3690-
}
3691-
vpcNetwork = true;
3692-
}
3693-
36943695
networkNicMap.put(network.getUuid(), profile);
36953696
}
36963697

ui/scripts/globalSettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
data: data,
4242
success: function(json) {
4343
var item = json.updateconfigurationresponse.configuration;
44-
if (item.category == "Usage")
44+
if (item.category == "Usage" && item.isdynamic == false)
4545
cloudStack.dialog.notice({
4646
message: _l('message.restart.mgmt.usage.server')
4747
});
48-
else
48+
else if (item.isdynamic == false)
4949
cloudStack.dialog.notice({
5050
message: _l('message.restart.mgmt.server')
5151
});

ui/scripts/network.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6843,7 +6843,8 @@
68436843
return [];
68446844
}
68456845

6846-
var protocols = protocolCapabilities.value.split(',');
6846+
// make sure protocols are found in a script compatible way: i.e. "tcp,udp,tcp.proxy" , no minus sign or spaces
6847+
var protocols = protocolCapabilities.value.replace(/\s/g,'').replace('-','.').split(',');
68476848

68486849
if (!protocols) {
68496850
return [];

0 commit comments

Comments
 (0)