mirror of https://github.com/apache/cloudstack.git
bug 10456: fixed NPE - get account info from the volume when create private template from volume
status 10456: resolved fixed
This commit is contained in:
parent
18417305ed
commit
a4dbcf4880
|
|
@ -1455,9 +1455,13 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
origTemplateInstallPath, templateId, name);
|
||||
} else if (volumeId != null) {
|
||||
VolumeVO volume = _volsDao.findById(volumeId);
|
||||
|
||||
if( volume == null ) {
|
||||
throw new CloudRuntimeException("Unable to find volume for Id " + volumeId);
|
||||
}
|
||||
|
||||
accountId = volume.getAccountId();
|
||||
|
||||
if( volume.getPoolId() == null ) {
|
||||
_templateDao.remove(templateId);
|
||||
throw new CloudRuntimeException("Volume " + volumeId + " is empty, can't create template on it");
|
||||
|
|
@ -1471,7 +1475,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
String secondaryStorageURL = secondaryStorageHost.getStorageUrl();
|
||||
|
||||
pool = _storagePoolDao.findById(volume.getPoolId());
|
||||
cmd = new CreatePrivateTemplateFromVolumeCommand(secondaryStorageURL, templateId, volume.getAccountId(),
|
||||
cmd = new CreatePrivateTemplateFromVolumeCommand(secondaryStorageURL, templateId, accountId,
|
||||
command.getTemplateName(), uniqueName, volume.getPath(), vmName);
|
||||
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue