Skip to content

Commit 2c4ea50

Browse files
committed
Merge pull request apache#1176 from anshul1886/CLOUDSTACK-9025-4.6
CLOUDSTACK-9025: Fixed can't create usable template from snapshot in Xenserver and Vmwarehttps://issues.apache.org/jira/browse/CLOUDSTACK-9025 Fix also reverts below commit as below solution making assumption about hypervisor which are not applicable in case of XenServer and VmWare Revert "CLOUDSTACK-8964: Can't create template or volume from snapshot" This reverts commit ccf5d75. Testing: Able to deploy VM successfully from template created from linked clone snapshot on XenServer. * pr/1176: CLOUDSTACK-9025: Fixed can't create usable template from snapshot in Xenserver and Vmware Signed-off-by: Daan Hoogland <daan@onecht.net>
2 parents f66e782 + f8790c3 commit 2c4ea50

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,22 @@ public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
185185
DataTO srcData = cpyCommand.getSrcTO();
186186
DataTO destData = cpyCommand.getDestTO();
187187

188-
if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) {
188+
if (srcData.getHypervisorType() == HypervisorType.XenServer && srcData.getObjectType() == DataObjectType.SNAPSHOT &&
189+
destData.getObjectType() == DataObjectType.TEMPLATE) {
189190
DataStoreTO srcStore = srcData.getDataStore();
190191
DataStoreTO destStore = destData.getDataStore();
191192
if (srcStore instanceof NfsTO && destStore instanceof NfsTO) {
192193
HostVO host = hostDao.findById(hostId);
193194
EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
194195
host = hostDao.findById(ep.getId());
195196
hostDao.loadDetails(host);
197+
String hypervisorVersion = host.getHypervisorVersion();
196198
String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix);
197-
if (snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)) {
198-
return new Pair<Boolean, Long>(Boolean.TRUE, new Long(ep.getId()));
199+
if (hypervisorVersion != null && !hypervisorVersion.equalsIgnoreCase("6.1.0")) {
200+
if (!(hypervisorVersion.equalsIgnoreCase("6.2.0") &&
201+
!(snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)))) {
202+
return new Pair<Boolean, Long>(Boolean.TRUE, new Long(ep.getId()));
203+
}
199204
}
200205
}
201206
}

‎server/src/com/cloud/hypervisor/HypervisorGuruManagerImpl.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.springframework.stereotype.Component;
2929

3030
import com.cloud.agent.api.Command;
31-
import com.cloud.host.HostVO;
3231
import com.cloud.host.dao.HostDao;
3332
import com.cloud.hypervisor.Hypervisor.HypervisorType;
3433
import com.cloud.utils.Pair;
@@ -75,9 +74,7 @@ public HypervisorGuru getGuru(HypervisorType hypervisorType) {
7574

7675
@Override
7776
public long getGuruProcessedCommandTargetHost(long hostId, Command cmd) {
78-
HostVO host = _hostDao.findById(hostId);
79-
HypervisorGuru guru = getGuru(host.getHypervisorType());
80-
if (guru != null) {
77+
for (HypervisorGuru guru : _hvGuruList) {
8178
Pair<Boolean, Long> result = guru.getCommandHostDelegation(hostId, cmd);
8279
if (result.first()) {
8380
return result.second();

0 commit comments

Comments
 (0)