use of com.cloud.legacymodel.communication.command.StorageSubSystemCommand in project cosmic by MissionCriticalCloud.
the class KVMGuru method getCommandHostDelegation.
@Override
public Pair<Boolean, Long> getCommandHostDelegation(final long hostId, final Command cmd) {
if (cmd instanceof StorageSubSystemCommand) {
final StorageSubSystemCommand c = (StorageSubSystemCommand) cmd;
c.setExecuteInSequence(false);
}
if (cmd instanceof CopyCommand) {
final CopyCommand c = (CopyCommand) cmd;
final DataTO srcData = c.getSrcTO();
boolean inSeq = true;
if (c.getSrcTO().getObjectType() == DataObjectType.SNAPSHOT || c.getDestTO().getObjectType() == DataObjectType.SNAPSHOT) {
inSeq = false;
} else if (c.getDestTO().getDataStore().getRole() == DataStoreRole.Image || c.getDestTO().getDataStore().getRole() == DataStoreRole.ImageCache) {
inSeq = false;
}
c.setExecuteInSequence(inSeq);
if (srcData.getHypervisorType() == HypervisorType.KVM) {
return new Pair<>(true, new Long(hostId));
}
}
return new Pair<>(false, new Long(hostId));
}
use of com.cloud.legacymodel.communication.command.StorageSubSystemCommand in project cosmic by MissionCriticalCloud.
the class XenServerGuru method getCommandHostDelegation.
@Override
public Pair<Boolean, Long> getCommandHostDelegation(final long hostId, final Command cmd) {
LOGGER.debug("getCommandHostDelegation: " + cmd.getClass());
if (cmd instanceof StorageSubSystemCommand) {
final StorageSubSystemCommand c = (StorageSubSystemCommand) cmd;
c.setExecuteInSequence(true);
}
if (cmd instanceof CopyCommand) {
final CopyCommand cpyCommand = (CopyCommand) cmd;
final DataTO srcData = cpyCommand.getSrcTO();
final DataTO destData = cpyCommand.getDestTO();
if (srcData.getHypervisorType() == HypervisorType.XenServer && srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) {
final DataStoreTO srcStore = srcData.getDataStore();
final DataStoreTO destStore = destData.getDataStore();
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
HostVO host = hostDao.findById(hostId);
final EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
host = hostDao.findById(ep.getId());
hostDao.loadDetails(host);
final String hypervisorVersion = host.getHypervisorVersion();
final String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix);
if (hypervisorVersion != null && !hypervisorVersion.equalsIgnoreCase("6.1.0")) {
if (!(hypervisorVersion.equalsIgnoreCase("6.2.0") && !(snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)))) {
return new Pair<>(Boolean.TRUE, new Long(ep.getId()));
}
}
}
}
}
return new Pair<>(Boolean.FALSE, new Long(hostId));
}
Aggregations