bug 7161 : Fixed CreatePrivateTemplate NPE. This was getting thrown when template creation was ordered from a volume for hypervisor other than KVM. For now we support template creation from volume only for KVM. The bug was more due to conversion of Long to long where the Long object was null.

status 7161: resolved fixed
This commit is contained in:
nit 2010-11-15 15:14:56 +05:30
parent fe1f2824a4
commit 06a1e47fb3
1 changed files with 3 additions and 1 deletions

View File

@ -121,10 +121,12 @@ public class CreatePrivateTemplateExecutor extends VolumeOperationExecutor {
// For template snapshot, we use a separate snapshot method.
snapshot = vmMgr.createTemplateSnapshot(param.getUserId(), param.getVolumeId());
}
else {
else if (snapshotId != null){
// We are creating a private template from an already present snapshot.
// This snapshot is already backed up on secondary storage.
snapshot = managerServer.findSnapshotById(snapshotId);
}else{
throw new CloudRuntimeException("Do not support create template from volume at this moment for hypervisor:" +managerServer.getHyperType());
}
if (snapshot == null) {