Skip to content
Merged

4.13 #3782

Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -187,6 +187,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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -87,4 +91,13 @@ public String getScope() {
public void setScope(String scope) {
this.scope = scope;
}

public boolean isDynamic() {
return isDynamic;
}

public void setIsDynamic(boolean isDynamic) {
this.isDynamic = isDynamic;
}

}
1 change: 1 addition & 0 deletions server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ public ConfigurationResponse createConfigurationResponse(Configuration cfg) {
} else {
cfgResponse.setValue(cfg.getValue());
}
cfgResponse.setIsDynamic(cfg.isDynamic());
cfgResponse.setObjectName("configuration");

return cfgResponse;
Expand Down
23 changes: 12 additions & 11 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
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;
Expand Down Expand Up @@ -1942,14 +1943,23 @@ public HashMap<Long, VmStatsEntry> getVirtualMachineStatistics(long hostId, Stri
@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) {
Expand Down Expand Up @@ -3613,7 +3623,6 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe

short defaultNetworkNumber = 0;
boolean securityGroupEnabled = false;
boolean vpcNetwork = false;
for (NetworkVO network : networkList) {
if ((network.getDataCenterId() != zone.getId())) {
if (!network.isStrechedL2Network()) {
Expand Down Expand Up @@ -3684,14 +3693,6 @@ private UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
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);
}

Expand Down
4 changes: 2 additions & 2 deletions ui/scripts/globalSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
});
Expand Down
3 changes: 2 additions & 1 deletion ui/scripts/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
Expand Down
102 changes: 102 additions & 0 deletions ui/scripts/sharedFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,7 @@ cloudStack.createTemplateMethod = function (isSnapshot){
isChecked: false
}
}

},
action: function(args) {
var data = {
Expand Down Expand Up @@ -2898,6 +2899,107 @@ cloudStack.createTemplateMethod = function (isSnapshot){
}
};
};
cloudStack.createTemplateFromSnapshotMethod = function (){
return {
label: 'label.create.template',
messages: {
confirm: function(args) {
return 'message.create.template';
},
notification: function(args) {
return 'label.create.template';
}
},
createForm: {
title: 'label.create.template',
desc: '',


fields: {
name: {
label: 'label.name',
validation: {
required: true
}
},
displayText: {
label: 'label.description',
validation: {
required: true
}
},
osTypeId: {
label: 'label.os.type',
select: function(args) {
$.ajax({
url: createURL("listOsTypes"),
dataType: "json",
async: true,
success: function(json) {
var ostypes = json.listostypesresponse.ostype;
var items = [];
$(ostypes).each(function() {
items.push({
id: this.id,
description: this.description
});
});
args.response.success({
data: items
});
}
});
}
},
isPublic: {
label: 'label.public',
isBoolean: true
},
isPasswordEnabled: {
label: 'label.password.enabled',
isBoolean: true
},
isdynamicallyscalable: {
label: 'label.dynamically.scalable',
isBoolean: true
}
}
},
action: function(args) {
var data = {
snapshotid: args.context.snapshots[0].id,
name: args.data.name,
displayText: args.data.displayText,
osTypeId: args.data.osTypeId,
isPublic: (args.data.isPublic == "on"),
passwordEnabled: (args.data.isPasswordEnabled == "on"),
isdynamicallyscalable: (args.data.isdynamicallyscalable == "on")
};

$.ajax({
url: createURL('createTemplate'),
data: data,
success: function(json) {
var jid = json.createtemplateresponse.jobid;
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
return {}; //nothing in this snapshot needs to be updated
},
getActionFilter: function() {
return snapshotActionfilter;
}
}
});
}
});
},
notification: {
poll: pollAsyncJobResult
}
};
};

cloudStack.addParameterToCommandUrlParameterArrayIfValueIsNotEmpty = function(array, parameterName, value){
if (value != null && value.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion ui/scripts/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@
detailView: {
name: 'Snapshot detail',
actions: {
createTemplate: cloudStack.createTemplateMethod(true),
createTemplate: cloudStack.createTemplateFromSnapshotMethod(),

createVolume: {
label: 'label.action.create.volume',
Expand Down