@@ -194,7 +194,7 @@ public Answer copyTemplateToPrimaryStorage(CopyCommand cmd) {
194194 primaryStore .getUuid ());
195195
196196 KVMPhysicalDisk primaryVol = storagePoolMgr .copyPhysicalDisk (tmplVol , UUID .randomUUID ().toString (),
197- primaryPool );
197+ primaryPool , cmd . getWaitInMillSeconds () );
198198
199199
200200 DataTO data = null ;
@@ -232,7 +232,7 @@ else if (primaryVol.getFormat() == PhysicalDiskFormat.QCOW2) {
232232 }
233233
234234 // this is much like PrimaryStorageDownloadCommand, but keeping it separate
235- private KVMPhysicalDisk templateToPrimaryDownload (String templateUrl , KVMStoragePool primaryPool ) {
235+ private KVMPhysicalDisk templateToPrimaryDownload (String templateUrl , KVMStoragePool primaryPool , int timeout ) {
236236 int index = templateUrl .lastIndexOf ("/" );
237237 String mountpoint = templateUrl .substring (0 , index );
238238 String templateName = null ;
@@ -269,7 +269,7 @@ private KVMPhysicalDisk templateToPrimaryDownload(String templateUrl, KVMStorage
269269 /* Copy volume to primary storage */
270270
271271 KVMPhysicalDisk primaryVol = storagePoolMgr .copyPhysicalDisk (templateVol , UUID .randomUUID ().toString (),
272- primaryPool );
272+ primaryPool , timeout );
273273 return primaryVol ;
274274 } catch (CloudRuntimeException e ) {
275275 s_logger .error ("Failed to download template to primary storage" , e );
@@ -300,14 +300,14 @@ public Answer cloneVolumeFromBaseTemplate(CopyCommand cmd) {
300300
301301 if (primaryPool .getType () == StoragePoolType .CLVM ) {
302302 templatePath = ((NfsTO )imageStore ).getUrl () + File .separator + templatePath ;
303- vol = templateToPrimaryDownload (templatePath , primaryPool );
303+ vol = templateToPrimaryDownload (templatePath , primaryPool , cmd . getWaitInMillSeconds () );
304304 } else {
305305 if (templatePath .contains ("/mnt" )) {
306306 //upgrade issue, if the path contains path, need to extract the volume uuid from path
307307 templatePath = templatePath .substring (templatePath .lastIndexOf (File .separator ) + 1 );
308308 }
309309 BaseVol = storagePoolMgr .getPhysicalDisk (primaryStore .getPoolType (), primaryStore .getUuid (), templatePath );
310- vol = storagePoolMgr .createDiskFromTemplate (BaseVol , UUID .randomUUID ().toString (), BaseVol .getPool ());
310+ vol = storagePoolMgr .createDiskFromTemplate (BaseVol , UUID .randomUUID ().toString (), BaseVol .getPool (), cmd . getWaitInMillSeconds () );
311311 }
312312 if (vol == null ) {
313313 return new CopyCmdAnswer (" Can't create storage volume on storage pool" );
@@ -378,7 +378,7 @@ public Answer copyVolumeFromImageCacheToPrimary(CopyCommand cmd) {
378378 .getPhysicalDisk (srcVolumeName );
379379 volume .setFormat (PhysicalDiskFormat .valueOf (srcFormat .toString ()));
380380 KVMPhysicalDisk newDisk = storagePoolMgr .copyPhysicalDisk (volume , volumeName ,
381- primaryPool );
381+ primaryPool , cmd . getWaitInMillSeconds () );
382382 VolumeObjectTO newVol = new VolumeObjectTO ();
383383 newVol .setFormat (ImageFormat .valueOf (newDisk .getFormat ().toString ().toUpperCase ()));
384384 newVol .setPath (volumeName );
@@ -425,7 +425,7 @@ public Answer copyVolumeFromPrimaryToSecondary(CopyCommand cmd) {
425425 secondaryStoragePool = storagePoolMgr .getStoragePoolByURI (
426426 secondaryStorageUrl + File .separator + destVolumePath );
427427 storagePoolMgr .copyPhysicalDisk (volume ,
428- destVolumeName ,secondaryStoragePool );
428+ destVolumeName ,secondaryStoragePool , cmd . getWaitInMillSeconds () );
429429 VolumeObjectTO newVol = new VolumeObjectTO ();
430430 newVol .setPath (destVolumePath + File .separator + destVolumeName );
431431 newVol .setFormat (destFormat );
@@ -443,7 +443,7 @@ public Answer copyVolumeFromPrimaryToSecondary(CopyCommand cmd) {
443443 public Answer createTemplateFromVolume (CopyCommand cmd ) {
444444 DataTO srcData = cmd .getSrcTO ();
445445 DataTO destData = cmd .getDestTO ();
446- int wait = cmd .getWait ();
446+ int wait = cmd .getWaitInMillSeconds ();
447447 TemplateObjectTO template = (TemplateObjectTO ) destData ;
448448 DataStoreTO imageStore = template .getDataStore ();
449449 VolumeObjectTO volume = (VolumeObjectTO ) srcData ;
@@ -469,7 +469,7 @@ public Answer createTemplateFromVolume(CopyCommand cmd) {
469469 String templateName = UUID .randomUUID ().toString ();
470470
471471 if (primary .getType () != StoragePoolType .RBD ) {
472- Script command = new Script (_createTmplPath , wait * 1000 , s_logger );
472+ Script command = new Script (_createTmplPath , wait , s_logger );
473473 command .add ("-f" , disk .getPath ());
474474 command .add ("-t" , tmpltPath );
475475 command .add ("-n" , templateName + ".qcow2" );
@@ -490,7 +490,7 @@ public Answer createTemplateFromVolume(CopyCommand cmd) {
490490 QemuImgFile destFile = new QemuImgFile (tmpltPath + "/" + templateName + ".qcow2" );
491491 destFile .setFormat (PhysicalDiskFormat .QCOW2 );
492492
493- QemuImg q = new QemuImg ();
493+ QemuImg q = new QemuImg (cmd . getWaitInMillSeconds () );
494494 try {
495495 q .convert (srcFile , destFile );
496496 } catch (QemuImgException e ) {
@@ -618,7 +618,7 @@ protected Answer backupSnapshotForObjectStore(CopyCommand cmd) {
618618 SnapshotObjectTO snapshotOnCacheStore = (SnapshotObjectTO )answer .getNewData ();
619619 snapshotOnCacheStore .setDataStore (cacheStore );
620620 ((SnapshotObjectTO ) destData ).setDataStore (imageStore );
621- CopyCommand newCpyCmd = new CopyCommand (snapshotOnCacheStore , destData , cmd .getWait (), cmd .executeInSequence ());
621+ CopyCommand newCpyCmd = new CopyCommand (snapshotOnCacheStore , destData , cmd .getWaitInMillSeconds (), cmd .executeInSequence ());
622622 return copyToObjectStore (newCpyCmd );
623623 }
624624 @ Override
@@ -722,7 +722,7 @@ public Answer backupSnapshot(CopyCommand cmd) {
722722 return new CopyCmdAnswer (e .toString ());
723723 }
724724 } else {
725- Script command = new Script (_manageSnapshotPath , cmd .getWait () * 1000 , s_logger );
725+ Script command = new Script (_manageSnapshotPath , cmd .getWaitInMillSeconds () , s_logger );
726726 command .add ("-b" , snapshotDisk .getPath ());
727727 command .add ("-n" , snapshotName );
728728 command .add ("-p" , snapshotDestPath );
@@ -1184,7 +1184,7 @@ public Answer createVolumeFromSnapshot(CopyCommand cmd) {
11841184 String primaryUuid = pool .getUuid ();
11851185 KVMStoragePool primaryPool = storagePoolMgr .getStoragePool (pool .getPoolType (), primaryUuid );
11861186 String volUuid = UUID .randomUUID ().toString ();
1187- KVMPhysicalDisk disk = storagePoolMgr .copyPhysicalDisk (snapshotDisk , volUuid , primaryPool );
1187+ KVMPhysicalDisk disk = storagePoolMgr .copyPhysicalDisk (snapshotDisk , volUuid , primaryPool , cmd . getWaitInMillSeconds () );
11881188 VolumeObjectTO newVol = new VolumeObjectTO ();
11891189 newVol .setPath (disk .getName ());
11901190 newVol .setSize (disk .getVirtualSize ());
0 commit comments