Skip to content

Commit 9c90eff

Browse files
committed
Merge pull request apache#1015 from DaanHoogland/pr/975
CLOUDSTACK-8964: Ovm3HypervisorGuru answer fix and snapshot to volume implementation.some clean up of code after the fix from apache#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 apache#975 Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents 30a8528 + fc18d1e commit 9c90eff

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorGuru.java‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ public boolean trackVmHostChange() {
8787
*/
8888
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
8989
LOGGER.debug("getCommandHostDelegation: " + cmd.getClass());
90+
performSideEffectsForDelegationOnCommand(hostId, cmd);
91+
return new Pair<Boolean, Long>(Boolean.FALSE, Long.valueOf(hostId));
92+
}
93+
94+
/**
95+
* @param hostId
96+
* @param cmd
97+
*/
98+
void performSideEffectsForDelegationOnCommand(long hostId, Command cmd) {
9099
if (cmd instanceof StorageSubSystemCommand) {
91100
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
92101
c.setExecuteInSequence(true);
@@ -105,12 +114,8 @@ public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
105114
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
106115
host = hostDao.findById(ep.getId());
107116
hostDao.loadDetails(host);
108-
// String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix);
109-
// if (snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)) {
110-
return new Pair<Boolean, Long>(Boolean.TRUE, Long.valueOf(ep.getId()));
111117
}
112118
}
113119
}
114-
return new Pair<Boolean, Long>(Boolean.FALSE, Long.valueOf(hostId));
115120
}
116121
}

‎plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessor.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ public final Answer execute(final CopyCommand cmd) {
114114
} else if ((srcData.getObjectType() == DataObjectType.SNAPSHOT)
115115
&& (destData.getObjectType() == DataObjectType.TEMPLATE)) {
116116
return createTemplateFromSnapshot(cmd);
117+
} else if ((srcData.getObjectType() == DataObjectType.SNAPSHOT)
118+
&& (destData.getObjectType() == DataObjectType.VOLUME)) {
119+
return createVolumeFromSnapshot(cmd);
117120
} else {
118121
msg = "Unable to do stuff for " + srcStore.getClass() + ":"
119122
+ srcData.getObjectType() + " to "

‎plugins/hypervisors/xenserver/src/com/cloud/hypervisor/XenServerGuru.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@
5858
import com.cloud.vm.VirtualMachine;
5959
import com.cloud.vm.VirtualMachineProfile;
6060
import com.cloud.vm.dao.UserVmDao;
61+
import org.apache.log4j.Logger;
6162

6263
@Local(value = HypervisorGuru.class)
6364
public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru, Configurable {
65+
private final Logger LOGGER = Logger.getLogger(XenServerGuru.class);
6466
@Inject
6567
GuestOSDao _guestOsDao;
6668
@Inject
@@ -173,6 +175,7 @@ public List<Command> finalizeExpungeVolumes(VirtualMachine vm) {
173175

174176
@Override
175177
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
178+
LOGGER.debug("getCommandHostDelegation: " + cmd.getClass());
176179
if (cmd instanceof StorageSubSystemCommand) {
177180
StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
178181
c.setExecuteInSequence(true);

0 commit comments

Comments
 (0)