mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch '4.6'
This commit is contained in:
commit
f30fbe9a5c
@ -442,6 +442,12 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
|
|||||||
public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) {
|
public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) {
|
||||||
long volumeId = snapshot.getVolumeId();
|
long volumeId = snapshot.getVolumeId();
|
||||||
VolumeVO volumeVO = _volumeDao.findById(volumeId);
|
VolumeVO volumeVO = _volumeDao.findById(volumeId);
|
||||||
|
if (SnapshotOperation.REVERT.equals(op)) {
|
||||||
|
if (volumeVO != null && ImageFormat.QCOW2.equals(volumeVO.getFormat()))
|
||||||
|
return StrategyPriority.DEFAULT;
|
||||||
|
else
|
||||||
|
return StrategyPriority.CANT_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
long storagePoolId;
|
long storagePoolId;
|
||||||
|
|
||||||
@ -459,13 +465,6 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
|
|||||||
storagePoolId = volumeVO.getPoolId();
|
storagePoolId = volumeVO.getPoolId();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SnapshotOperation.REVERT.equals(op)) {
|
|
||||||
if (volumeVO != null && ImageFormat.QCOW2.equals(volumeVO.getFormat()))
|
|
||||||
return StrategyPriority.DEFAULT;
|
|
||||||
else
|
|
||||||
return StrategyPriority.CANT_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
|
DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
|
||||||
|
|
||||||
Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
|
Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
|
||||||
|
|||||||
@ -32,7 +32,8 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>-Xmx1024m</argLine>
|
<forkMode>always</forkMode>
|
||||||
|
<argLine>-Xmx2048m -XX:MaxPermSize=1024m</argLine>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>org/apache/cloudstack/ratelimit/integration/*</exclude>
|
<exclude>org/apache/cloudstack/ratelimit/integration/*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
|
|||||||
@ -85,15 +85,6 @@ public class Ovm3HypervisorGuru extends HypervisorGuruBase implements Hypervisor
|
|||||||
*/
|
*/
|
||||||
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
|
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
|
||||||
LOGGER.debug("getCommandHostDelegation: " + cmd.getClass());
|
LOGGER.debug("getCommandHostDelegation: " + cmd.getClass());
|
||||||
performSideEffectsForDelegationOnCommand(hostId, cmd);
|
|
||||||
return new Pair<Boolean, Long>(Boolean.FALSE, Long.valueOf(hostId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param hostId
|
|
||||||
* @param cmd
|
|
||||||
*/
|
|
||||||
void performSideEffectsForDelegationOnCommand(long hostId, Command cmd) {
|
|
||||||
if (cmd instanceof StorageSubSystemCommand) {
|
if (cmd instanceof StorageSubSystemCommand) {
|
||||||
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
|
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
|
||||||
c.setExecuteInSequence(true);
|
c.setExecuteInSequence(true);
|
||||||
@ -103,17 +94,19 @@ public class Ovm3HypervisorGuru extends HypervisorGuruBase implements Hypervisor
|
|||||||
DataTO srcData = cpyCommand.getSrcTO();
|
DataTO srcData = cpyCommand.getSrcTO();
|
||||||
DataTO destData = cpyCommand.getDestTO();
|
DataTO destData = cpyCommand.getDestTO();
|
||||||
|
|
||||||
if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) {
|
if (HypervisorType.Ovm3.equals(srcData.getHypervisorType()) && srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) {
|
||||||
LOGGER.debug("Snapshot to Template: " + cmd);
|
LOGGER.debug("Snapshot to Template: " + cmd);
|
||||||
DataStoreTO srcStore = srcData.getDataStore();
|
DataStoreTO srcStore = srcData.getDataStore();
|
||||||
DataStoreTO destStore = destData.getDataStore();
|
DataStoreTO destStore = destData.getDataStore();
|
||||||
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
|
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
|
||||||
HostVO host = hostDao.findById(hostId);
|
HostVO host = hostDao.findById(hostId);
|
||||||
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
|
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
|
||||||
host = hostDao.findById(ep.getId());
|
if (ep != null) {
|
||||||
hostDao.loadDetails(host);
|
return new Pair<Boolean, Long>(Boolean.TRUE, Long.valueOf(ep.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return new Pair<Boolean, Long>(Boolean.FALSE, Long.valueOf(hostId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,7 +183,8 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
|
|||||||
DataTO srcData = cpyCommand.getSrcTO();
|
DataTO srcData = cpyCommand.getSrcTO();
|
||||||
DataTO destData = cpyCommand.getDestTO();
|
DataTO destData = cpyCommand.getDestTO();
|
||||||
|
|
||||||
if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) {
|
if (srcData.getHypervisorType() == HypervisorType.XenServer && srcData.getObjectType() == DataObjectType.SNAPSHOT &&
|
||||||
|
destData.getObjectType() == DataObjectType.TEMPLATE) {
|
||||||
DataStoreTO srcStore = srcData.getDataStore();
|
DataStoreTO srcStore = srcData.getDataStore();
|
||||||
DataStoreTO destStore = destData.getDataStore();
|
DataStoreTO destStore = destData.getDataStore();
|
||||||
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
|
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
|
||||||
@ -191,13 +192,17 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
|
|||||||
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
|
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
|
||||||
host = hostDao.findById(ep.getId());
|
host = hostDao.findById(ep.getId());
|
||||||
hostDao.loadDetails(host);
|
hostDao.loadDetails(host);
|
||||||
|
String hypervisorVersion = host.getHypervisorVersion();
|
||||||
String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix);
|
String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix);
|
||||||
if (snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)) {
|
if (hypervisorVersion != null && !hypervisorVersion.equalsIgnoreCase("6.1.0")) {
|
||||||
|
if (!(hypervisorVersion.equalsIgnoreCase("6.2.0") &&
|
||||||
|
!(snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)))) {
|
||||||
return new Pair<Boolean, Long>(Boolean.TRUE, new Long(ep.getId()));
|
return new Pair<Boolean, Long>(Boolean.TRUE, new Long(ep.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
|
return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,6 +187,22 @@ resizeqcow2() {
|
|||||||
# if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking
|
# if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking
|
||||||
failshrink
|
failshrink
|
||||||
|
|
||||||
|
#move this back into cloudstack libvirt calls once the libvirt java bindings support block resize
|
||||||
|
#we try to inform hypervisor of new size, but don't fail if we can't
|
||||||
|
if `virsh help 2>/dev/null | grep -q blockresize`
|
||||||
|
then
|
||||||
|
if `virsh domstate $vmname >/dev/null 2>&1`
|
||||||
|
then
|
||||||
|
log "vm $vmname is running, use 'virsh blockresize' to resize the volume"
|
||||||
|
notifyqemu
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
log "performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
output=`qemu-img resize $path $newsize 2>&1`
|
output=`qemu-img resize $path $newsize 2>&1`
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
@ -196,10 +212,6 @@ resizeqcow2() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#move this back into cloudstack libvirt calls once the libvirt java bindings support block resize
|
|
||||||
#we try to inform hypervisor of new size, but don't fail if we can't
|
|
||||||
notifyqemu
|
|
||||||
|
|
||||||
log "performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink"
|
log "performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +256,7 @@ then
|
|||||||
resizelvm
|
resizelvm
|
||||||
elif [ "$ptype" == "QCOW2" ]
|
elif [ "$ptype" == "QCOW2" ]
|
||||||
then
|
then
|
||||||
notifyqemu
|
resizeqcow2
|
||||||
elif [ "$ptype" == "NOTIFYONLY" ]
|
elif [ "$ptype" == "NOTIFYONLY" ]
|
||||||
then
|
then
|
||||||
notifyqemu
|
notifyqemu
|
||||||
|
|||||||
@ -27,7 +27,6 @@ import org.apache.log4j.Logger;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
import com.cloud.host.HostVO;
|
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -73,9 +72,7 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getGuruProcessedCommandTargetHost(long hostId, Command cmd) {
|
public long getGuruProcessedCommandTargetHost(long hostId, Command cmd) {
|
||||||
HostVO host = _hostDao.findById(hostId);
|
for (HypervisorGuru guru : _hvGuruList) {
|
||||||
HypervisorGuru guru = getGuru(host.getHypervisorType());
|
|
||||||
if (guru != null) {
|
|
||||||
Pair<Boolean, Long> result = guru.getCommandHostDelegation(hostId, cmd);
|
Pair<Boolean, Long> result = guru.getCommandHostDelegation(hostId, cmd);
|
||||||
if (result.first()) {
|
if (result.first()) {
|
||||||
return result.second();
|
return result.second();
|
||||||
|
|||||||
@ -1158,6 +1158,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
if (newDiskOfferingId != null) {
|
if (newDiskOfferingId != null) {
|
||||||
volume.setDiskOfferingId(newDiskOfferingId);
|
volume.setDiskOfferingId(newDiskOfferingId);
|
||||||
}
|
}
|
||||||
|
if (currentSize != newSize) {
|
||||||
|
volume.setSize(newSize);
|
||||||
|
}
|
||||||
|
|
||||||
_volsDao.update(volume.getId(), volume);
|
_volsDao.update(volume.getId(), volume);
|
||||||
|
|
||||||
|
|||||||
@ -1876,10 +1876,14 @@
|
|||||||
},
|
},
|
||||||
action: function(args) {
|
action: function(args) {
|
||||||
var data = {
|
var data = {
|
||||||
domainid: args.context.sshkeypairs[0].domainid,
|
|
||||||
account: args.context.sshkeypairs[0].account,
|
|
||||||
name: args.context.sshkeypairs[0].name
|
name: args.context.sshkeypairs[0].name
|
||||||
};
|
};
|
||||||
|
if (!args.context.projects) {
|
||||||
|
$.extend(data, {
|
||||||
|
domainid: args.context.sshkeypairs[0].domainid,
|
||||||
|
account: args.context.sshkeypairs[0].account,
|
||||||
|
});
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('deleteSSHKeyPair'),
|
url: createURL('deleteSSHKeyPair'),
|
||||||
data: data,
|
data: data,
|
||||||
|
|||||||
@ -1550,14 +1550,27 @@
|
|||||||
},
|
},
|
||||||
createForm: {
|
createForm: {
|
||||||
title: 'label.action.resize.volume',
|
title: 'label.action.resize.volume',
|
||||||
|
preFilter: function(args) {
|
||||||
|
if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
|
||||||
|
args.$form.find('.form-item[rel=newdiskoffering]').hide();
|
||||||
|
} else {
|
||||||
|
args.$form.find('.form-item[rel=newsize]').hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
fields: {
|
fields: {
|
||||||
newdiskoffering: {
|
newdiskoffering: {
|
||||||
label: 'label.resize.new.offering.id',
|
label: 'label.resize.new.offering.id',
|
||||||
select: function(args) {
|
select: function(args) {
|
||||||
|
if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
|
||||||
|
args.response.success({
|
||||||
|
data: []
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listDiskOfferings"),
|
url: createURL("listDiskOfferings"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
diskofferingObjs = json.listdiskofferingsresponse.diskoffering;
|
diskofferingObjs = json.listdiskofferingsresponse.diskoffering;
|
||||||
var items = [];
|
var items = [];
|
||||||
@ -1619,8 +1632,7 @@
|
|||||||
validation: {
|
validation: {
|
||||||
required: true,
|
required: true,
|
||||||
number: true
|
number: true
|
||||||
},
|
}
|
||||||
isHidden: true
|
|
||||||
},
|
},
|
||||||
shrinkok: {
|
shrinkok: {
|
||||||
label: 'label.resize.shrink.ok',
|
label: 'label.resize.shrink.ok',
|
||||||
@ -1654,7 +1666,7 @@
|
|||||||
|
|
||||||
var newDiskOffering = args.data.newdiskoffering;
|
var newDiskOffering = args.data.newdiskoffering;
|
||||||
var newSize;
|
var newSize;
|
||||||
if (selectedDiskOfferingObj.iscustomized == true) {
|
if (selectedDiskOfferingObj == null || selectedDiskOfferingObj.iscustomized == true) {
|
||||||
newSize = args.data.newsize;
|
newSize = args.data.newsize;
|
||||||
}
|
}
|
||||||
if (newDiskOffering != null && newDiskOffering.length > 0) {
|
if (newDiskOffering != null && newDiskOffering.length > 0) {
|
||||||
@ -1665,9 +1677,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var minIops;
|
var minIops;
|
||||||
var maxIops
|
var maxIops;
|
||||||
|
|
||||||
if (selectedDiskOfferingObj.iscustomizediops == true) {
|
if (selectedDiskOfferingObj != null && selectedDiskOfferingObj.iscustomizediops == true) {
|
||||||
minIops = args.data.minIops;
|
minIops = args.data.minIops;
|
||||||
maxIops = args.data.maxIops;
|
maxIops = args.data.maxIops;
|
||||||
}
|
}
|
||||||
@ -2352,11 +2364,14 @@
|
|||||||
allowedActions.push("takeSnapshot");
|
allowedActions.push("takeSnapshot");
|
||||||
allowedActions.push("recurringSnapshot");
|
allowedActions.push("recurringSnapshot");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (jsonObj.type == "DATADISK") {
|
if (jsonObj.hypervisor == "KVM" || jsonObj.hypervisor == "XenServer" || jsonObj.hypervisor == "VMware") {
|
||||||
|
if (jsonObj.state == "Ready" || jsonObj.state == "Allocated") {
|
||||||
allowedActions.push("resize");
|
allowedActions.push("resize");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonObj.state != "Allocated") {
|
if (jsonObj.state != "Allocated") {
|
||||||
if ((jsonObj.vmstate == "Stopped" || jsonObj.virtualmachineid == null) && jsonObj.state == "Ready") {
|
if ((jsonObj.vmstate == "Stopped" || jsonObj.virtualmachineid == null) && jsonObj.state == "Ready") {
|
||||||
allowedActions.push("downloadVolume");
|
allowedActions.push("downloadVolume");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user