abh1sar commented on code in PR #13424:
URL: https://github.com/apache/cloudstack/pull/13424#discussion_r3472028840


##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -196,10 +196,12 @@ backup_running_vm() {
 
   # Print statistics
   virsh -c qemu:///system domjobinfo $VM --completed
-  du -sb $dest | cut -f1
-
-  umount $mount_point
-  rmdir $mount_point
+  backup_size=$(du -sb "$dest" 2>>$logFile | cut -f1) || backup_size=0
+  
+  timeout $TIMEOUT umount "$mount_point" 2>>$logFile || true

Review Comment:
   ```suggestion
     timeout $UNMOUNT_TIMEOUT umount "$mount_point" 2>>$logFile || { log 
"WARNING: umount of $mount_point failed or timed out"; true; }
   ```



##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -196,10 +196,12 @@ backup_running_vm() {
 
   # Print statistics
   virsh -c qemu:///system domjobinfo $VM --completed
-  du -sb $dest | cut -f1
-
-  umount $mount_point
-  rmdir $mount_point
+  backup_size=$(du -sb "$dest" 2>>$logFile | cut -f1) || backup_size=0
+  
+  timeout $TIMEOUT umount "$mount_point" 2>>$logFile || true
+  rmdir "$mount_point" 2>>$logFile || true

Review Comment:
   ```suggestion
     rmdir "$mount_point" 2>>$logFile || { log "WARNING: rmdir of $mount_point 
failed"; true; }
   ```



##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -34,7 +34,7 @@ BACKUP_DIR=""
 DISK_PATHS=""
 QUIESCE=""
 logFile="/var/log/cloudstack/agent/agent.log"
-
+TIMEOUT=60

Review Comment:
   ```suggestion
   UNMOUNT_TIMEOUT=60
   ```



##########
scripts/vm/hypervisor/kvm/nasbackup.sh:
##########
@@ -196,10 +196,12 @@ backup_running_vm() {
 
   # Print statistics
   virsh -c qemu:///system domjobinfo $VM --completed
-  du -sb $dest | cut -f1
-
-  umount $mount_point
-  rmdir $mount_point
+  backup_size=$(du -sb "$dest" 2>>$logFile | cut -f1) || backup_size=0

Review Comment:
   ```suggestion
     backup_size=$(du -sb "$dest" 2>>$logFile | cut -f1) || { log -ne "WARNING: 
du failed for $dest, reporting size
     as 0"; backup_size=0; }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to