Merge pull request #1015 from DaanHoogland/pr/975

CLOUDSTACK-8964: Ovm3HypervisorGuru answer fix and snapshot to volume implementation.some clean up of code after the fix from #975

* pr/1015:
  CLOUDSTACK-8964 side effect isolation  extract side effect away to emphasize the main commandDelegation objective
  host delegation logging for XenServerGuru.java
  Getting volume from snapshot working again... odd
  simple change to prevent failure and keep OVM3 snapshots working

This closes #975

Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
Remi Bergsma 2015-11-02 13:36:29 +01:00
commit 9c90eff87f
3 changed files with 15 additions and 4 deletions

View File

@ -87,6 +87,15 @@ 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);
@ -105,12 +114,8 @@ public class Ovm3HypervisorGuru extends HypervisorGuruBase implements Hypervisor
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
host = hostDao.findById(ep.getId());
hostDao.loadDetails(host);
// String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix);
// if (snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)) {
return new Pair<Boolean, Long>(Boolean.TRUE, Long.valueOf(ep.getId()));
}
}
}
return new Pair<Boolean, Long>(Boolean.FALSE, Long.valueOf(hostId));
}
}

View File

@ -114,6 +114,9 @@ public class Ovm3StorageProcessor implements StorageProcessor {
} else if ((srcData.getObjectType() == DataObjectType.SNAPSHOT)
&& (destData.getObjectType() == DataObjectType.TEMPLATE)) {
return createTemplateFromSnapshot(cmd);
} else if ((srcData.getObjectType() == DataObjectType.SNAPSHOT)
&& (destData.getObjectType() == DataObjectType.VOLUME)) {
return createVolumeFromSnapshot(cmd);
} else {
msg = "Unable to do stuff for " + srcStore.getClass() + ":"
+ srcData.getObjectType() + " to "

View File

@ -58,9 +58,11 @@ import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.UserVmDao;
import org.apache.log4j.Logger;
@Local(value = HypervisorGuru.class)
public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru, Configurable {
private final Logger LOGGER = Logger.getLogger(XenServerGuru.class);
@Inject
GuestOSDao _guestOsDao;
@Inject
@ -173,6 +175,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
@Override
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
LOGGER.debug("getCommandHostDelegation: " + cmd.getClass());
if (cmd instanceof StorageSubSystemCommand) {
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
c.setExecuteInSequence(true);