@@ -59,17 +59,19 @@ public Answer execute(final CreateCommand command, final LibvirtComputingResourc
5959 vol = libvirtComputingResource .templateToPrimaryDownload (command .getTemplateUrl (), primaryPool , dskch .getPath ());
6060 } else {
6161 baseVol = primaryPool .getPhysicalDisk (command .getTemplateUrl ());
62- vol = storagePoolMgr .createDiskFromTemplate (baseVol ,
63- dskch .getPath (), dskch .getProvisioningType (), primaryPool , 0 );
62+ vol = storagePoolMgr .createDiskFromTemplate (baseVol , dskch .getPath (), dskch .getProvisioningType (), primaryPool , 0 );
6463 }
6564 if (vol == null ) {
6665 return new Answer (command , false , " Can't create storage volume on storage pool" );
6766 }
6867 } else {
6968 vol = primaryPool .createPhysicalDisk (dskch .getPath (), dskch .getProvisioningType (), dskch .getSize ());
69+ if (vol == null ) {
70+ return new Answer (command , false , " Can't create Physical Disk" );
71+ }
7072 }
71- final VolumeTO volume =
72- new VolumeTO ( command . getVolumeId (), dskch . getType (), pool . getType (), pool . getUuid (), pool . getPath (), vol . getName (), vol . getName (), disksize , null );
73+ final VolumeTO volume = new VolumeTO ( command . getVolumeId (), dskch . getType (), pool . getType (), pool . getUuid (), pool . getPath (), vol . getName (), vol . getName (), disksize ,
74+ null );
7375
7476 volume .setBytesReadRate (dskch .getBytesReadRate ());
7577 volume .setBytesWriteRate (dskch .getBytesWriteRate ());
@@ -82,4 +84,4 @@ public Answer execute(final CreateCommand command, final LibvirtComputingResourc
8284 return new CreateAnswer (command , e );
8385 }
8486 }
85- }
87+ }
0 commit comments