* 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>
This commit is contained in:
dahn 2019-12-20 16:43:09 +01:00 committed by GitHub
parent 06060399ba
commit 482d0fd85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 14 deletions

View File

@ -188,6 +188,7 @@ public class ApiConstants {
public static final String IP_LIMIT = "iplimit";
public static final String IP_TOTAL = "iptotal";
public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
public static final String IS_DYNAMIC = "isdynamic";
public static final String IS_EXTRACTABLE = "isextractable";
public static final String IS_FEATURED = "isfeatured";
public static final String IS_PORTABLE = "isportable";

View File

@ -48,6 +48,10 @@ public class ConfigurationResponse extends BaseResponse {
@Param(description = "the description of the configuration")
private String description;
@SerializedName(ApiConstants.IS_DYNAMIC)
@Param(description = "true if the configuration is dynamic")
private boolean isDynamic;
public String getCategory() {
return category;
}
@ -87,4 +91,13 @@ public class ConfigurationResponse extends BaseResponse {
public void setScope(String scope) {
this.scope = scope;
}
public boolean isDynamic() {
return isDynamic;
}
public void setIsDynamic(boolean isDynamic) {
this.isDynamic = isDynamic;
}
}

View File

@ -491,6 +491,7 @@ public class ApiResponseHelper implements ResponseGenerator {
} else {
cfgResponse.setValue(cfg.getValue());
}
cfgResponse.setIsDynamic(cfg.isDynamic());
cfgResponse.setObjectName("configuration");
return cfgResponse;

View File

@ -40,6 +40,7 @@ import java.util.stream.Stream;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.storage.ScopeType;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.affinity.AffinityGroupService;
@ -1941,14 +1942,23 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
@Override
public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, String poolUuid, StoragePoolType poolType, List<String> volumeLocators, int timeout) {
List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(clusterId, Status.Up);
StoragePool storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
StoragePoolVO storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
for (HostVO neighbor : neighbors) {
if (storagePool.isManaged()) {
// apply filters:
// - managed storage
// - local storage
if (storagePool.isManaged() || storagePool.isLocal()) {
volumeLocators = getVolumesByHost(neighbor, storagePool);
}
// - zone wide storage for specific hypervisortypes
if (ScopeType.ZONE.equals(storagePool.getScope()) && storagePool.getHypervisor() != neighbor.getHypervisorType()) {
// skip this neighbour if their hypervisor type is not the same as that of the store
continue;
}
GetVolumeStatsCommand cmd = new GetVolumeStatsCommand(poolType, poolUuid, volumeLocators);
if (timeout > 0) {
@ -3612,7 +3622,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
short defaultNetworkNumber = 0;
boolean securityGroupEnabled = false;
boolean vpcNetwork = false;
for (NetworkVO network : networkList) {
if ((network.getDataCenterId() != zone.getId())) {
if (!network.isStrechedL2Network()) {
@ -3683,14 +3692,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
securityGroupEnabled = true;
}
// vm can't be a part of more than 1 VPC network
if (network.getVpcId() != null) {
if (vpcNetwork) {
throw new InvalidParameterValueException("Vm can't be a part of more than 1 VPC network");
}
vpcNetwork = true;
}
networkNicMap.put(network.getUuid(), profile);
}

View File

@ -41,11 +41,11 @@
data: data,
success: function(json) {
var item = json.updateconfigurationresponse.configuration;
if (item.category == "Usage")
if (item.category == "Usage" && item.isdynamic == false)
cloudStack.dialog.notice({
message: _l('message.restart.mgmt.usage.server')
});
else
else if (item.isdynamic == false)
cloudStack.dialog.notice({
message: _l('message.restart.mgmt.server')
});

View File

@ -6843,7 +6843,8 @@
return [];
}
var protocols = protocolCapabilities.value.split(',');
// make sure protocols are found in a script compatible way: i.e. "tcp,udp,tcp.proxy" , no minus sign or spaces
var protocols = protocolCapabilities.value.replace(/\s/g,'').replace('-','.').split(',');
if (!protocols) {
return [];