@@ -1040,13 +1040,16 @@ public Answer backupSnapshot(CopyCommand cmd) {
10401040 morDs = HypervisorHostHelper .findDatastoreWithBackwardsCompatibility (hyperHost , primaryStore .getUuid ());
10411041
10421042 try {
1043- vmMo = hyperHost .findVmOnHyperHost (vmName );
1043+ if (vmName != null ) {
1044+ vmMo = hyperHost .findVmOnHyperHost (vmName );
1045+ }
10441046 if (vmMo == null ) {
10451047 if (s_logger .isDebugEnabled ()) {
10461048 s_logger .debug ("Unable to find owner VM for BackupSnapshotCommand on host " + hyperHost .getHyperHostName () + ", will try within datacenter" );
10471049 }
1048-
1049- vmMo = hyperHost .findVmOnPeerHyperHost (vmName );
1050+ if (vmName != null ) {
1051+ vmMo = hyperHost .findVmOnPeerHyperHost (vmName );
1052+ }
10501053 if (vmMo == null ) {
10511054 dsMo = new DatastoreMO (hyperHost .getContext (), morDs );
10521055
@@ -1489,17 +1492,21 @@ private Long restoreVolumeFromSecStorage(VmwareHypervisorHost hyperHost, Datasto
14891492 String secondaryMountPoint = mountService .getMountPoint (secStorageUrl );
14901493 String srcOVAFileName = null ;
14911494 String srcOVFFileName = null ;
1492-
1493- srcOVAFileName = secondaryMountPoint + "/" + secStorageDir + "/"
1495+ if (backupName .endsWith (".ova" )) {
1496+ srcOVAFileName = secondaryMountPoint + "/" + secStorageDir + "/"
1497+ + backupName ;
1498+ srcOVFFileName = secondaryMountPoint + "/" + secStorageDir + "/"
1499+ + backupName .replace (".ova" , ".ovf" );
1500+ } else {
1501+ srcOVAFileName = secondaryMountPoint + "/" + secStorageDir + "/"
14941502 + backupName + "." + ImageFormat .OVA .getFileExtension ();
1495- srcOVFFileName = secondaryMountPoint + "/" + secStorageDir + "/"
1503+ srcOVFFileName = secondaryMountPoint + "/" + secStorageDir + "/"
14961504 + backupName + ".ovf" ;
1497-
1505+ }
14981506 String snapshotDir = "" ;
14991507 if (backupName .contains ("/" )){
15001508 snapshotDir = backupName .split ("/" )[0 ];
15011509 }
1502-
15031510 File ovafile = new File (srcOVAFileName );
15041511
15051512 File ovfFile = new File (srcOVFFileName );
0 commit comments