Merge branch '4.6'

This commit is contained in:
Rohit Yadav 2015-12-07 12:44:07 +05:30
commit f30fbe9a5c
9 changed files with 70 additions and 41 deletions

View File

@ -442,6 +442,12 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) {
long volumeId = snapshot.getVolumeId();
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;
@ -459,13 +465,6 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
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);
Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();

View File

@ -32,7 +32,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx1024m</argLine>
<forkMode>always</forkMode>
<argLine>-Xmx2048m -XX:MaxPermSize=1024m</argLine>
<excludes>
<exclude>org/apache/cloudstack/ratelimit/integration/*</exclude>
</excludes>

View File

@ -85,15 +85,6 @@ public class Ovm3HypervisorGuru extends HypervisorGuruBase implements Hypervisor
*/
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
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) {
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
c.setExecuteInSequence(true);
@ -103,17 +94,19 @@ public class Ovm3HypervisorGuru extends HypervisorGuruBase implements Hypervisor
DataTO srcData = cpyCommand.getSrcTO();
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);
DataStoreTO srcStore = srcData.getDataStore();
DataStoreTO destStore = destData.getDataStore();
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
HostVO host = hostDao.findById(hostId);
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
host = hostDao.findById(ep.getId());
hostDao.loadDetails(host);
if (ep != null) {
return new Pair<Boolean, Long>(Boolean.TRUE, Long.valueOf(ep.getId()));
}
}
}
}
return new Pair<Boolean, Long>(Boolean.FALSE, Long.valueOf(hostId));
}
}

View File

@ -183,7 +183,8 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
DataTO srcData = cpyCommand.getSrcTO();
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 destStore = destData.getDataStore();
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()));
host = hostDao.findById(ep.getId());
hostDao.loadDetails(host);
String hypervisorVersion = host.getHypervisorVersion();
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.FALSE, new Long(hostId));
}

View File

@ -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
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`
retval=$?
@ -196,10 +212,6 @@ resizeqcow2() {
exit 1
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"
}
@ -244,7 +256,7 @@ then
resizelvm
elif [ "$ptype" == "QCOW2" ]
then
notifyqemu
resizeqcow2
elif [ "$ptype" == "NOTIFYONLY" ]
then
notifyqemu

View File

@ -27,7 +27,6 @@ import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.agent.api.Command;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.Pair;
@ -73,9 +72,7 @@ public class HypervisorGuruManagerImpl extends ManagerBase implements Hypervisor
@Override
public long getGuruProcessedCommandTargetHost(long hostId, Command cmd) {
HostVO host = _hostDao.findById(hostId);
HypervisorGuru guru = getGuru(host.getHypervisorType());
if (guru != null) {
for (HypervisorGuru guru : _hvGuruList) {
Pair<Boolean, Long> result = guru.getCommandHostDelegation(hostId, cmd);
if (result.first()) {
return result.second();

View File

@ -1158,6 +1158,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
if (newDiskOfferingId != null) {
volume.setDiskOfferingId(newDiskOfferingId);
}
if (currentSize != newSize) {
volume.setSize(newSize);
}
_volsDao.update(volume.getId(), volume);

View File

@ -1876,10 +1876,14 @@
},
action: function(args) {
var data = {
domainid: args.context.sshkeypairs[0].domainid,
account: args.context.sshkeypairs[0].account,
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({
url: createURL('deleteSSHKeyPair'),
data: data,

View File

@ -1550,14 +1550,27 @@
},
createForm: {
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: {
newdiskoffering: {
label: 'label.resize.new.offering.id',
select: function(args) {
if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
args.response.success({
data: []
});
return;
}
$.ajax({
url: createURL("listDiskOfferings"),
dataType: "json",
async: false,
success: function(json) {
diskofferingObjs = json.listdiskofferingsresponse.diskoffering;
var items = [];
@ -1619,8 +1632,7 @@
validation: {
required: true,
number: true
},
isHidden: true
}
},
shrinkok: {
label: 'label.resize.shrink.ok',
@ -1654,7 +1666,7 @@
var newDiskOffering = args.data.newdiskoffering;
var newSize;
if (selectedDiskOfferingObj.iscustomized == true) {
if (selectedDiskOfferingObj == null || selectedDiskOfferingObj.iscustomized == true) {
newSize = args.data.newsize;
}
if (newDiskOffering != null && newDiskOffering.length > 0) {
@ -1665,9 +1677,9 @@
}
var minIops;
var maxIops
var maxIops;
if (selectedDiskOfferingObj.iscustomizediops == true) {
if (selectedDiskOfferingObj != null && selectedDiskOfferingObj.iscustomizediops == true) {
minIops = args.data.minIops;
maxIops = args.data.maxIops;
}
@ -2352,11 +2364,14 @@
allowedActions.push("takeSnapshot");
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");
}
}
if (jsonObj.state != "Allocated") {
if ((jsonObj.vmstate == "Stopped" || jsonObj.virtualmachineid == null) && jsonObj.state == "Ready") {
allowedActions.push("downloadVolume");