weizhouapache commented on PR #13643:
URL: https://github.com/apache/cloudstack/pull/13643#issuecomment-5005033126

   > ~Assuming that the file output order does not matter, it looks good (did 
not test).~
   > 
   > ```sh
   > fabricio@pc:~/github/cloudstack$ ls -l --numeric-uid-gid $dest | awk 
'{print $5}'
   > 
   > 4978
   > 9819
   > 13674
   > 205830
   > 4954
   > 
   > fabricio@pc:~/github/cloudstack$ find "$dest" -type f -exec stat -c '%s' 
{} +
   > 4954
   > 9819
   > 4978
   > 205830
   > 13674
   > ```
   > 
   > Edit: I had a look at the code that parses this output. It seems to assume 
that the volume's size will be on the last line when backing up a single volume?
   > 
   > ```java
   > private long parseBackupSize(String stdout, List<String> diskPaths) {
   >         long backupSize = 0L;
   >         if (CollectionUtils.isNullOrEmpty(diskPaths)) {
   >             List<String> outputLines = Arrays.asList(stdout.split("\n"));
   >             if (!outputLines.isEmpty()) {
   >                 backupSize = 
Long.parseLong(outputLines.get(outputLines.size() - 1).trim());
   >             }
   >         } else {
   >             for (String line : stdout.split("\n")) {
   >                 backupSize = backupSize + Long.parseLong(line.split(" 
")[0].trim());
   >             }
   >         }
   >         return backupSize;
   >     }
   > ```
   > 
   > @weizhouapache could you check if this output order change may cause a 
regression?
   
   Thanks @winterhazel for checking
   In my testing, the directory has only 1 qcow2 file. I will double check when 
possible (I will on leave next week)


-- 
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