Bug #1042

Size is not correctly calculated in vmware folders (=disks)

Added by Tino Vázquez over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:12/22/2011
Priority:NormalDue date:
Assignee:Javi Fontan% Done:

0%

Category:Drivers - Auth
Target version:Release 3.4 - S0
Resolution:fixed Pull request:
Affected Versions:OpenNebula 3.2

Description

du_stat in fsrc is just prepared for files, not folders

Associated revisions

Revision 7993a5b3
Added by Javi Fontan over 9 years ago

bug #1042: use du to calculate image sizes, works with dirs

Revision 9b9aed19
Added by Javi Fontan over 9 years ago

bug #1042: use stat when the image is not a dir

Revision c2d31685
Added by Javi Fontan over 9 years ago

bug #1042: output the image size in Mb instead of Kb

Revision 3f901ac6
Added by Javi Fontan over 9 years ago

bug #1042: fix units for du size

Revision d9ce8437
Added by Javi Fontan over 9 years ago

bug #1042: fix units for du size

History

#1 Updated by Ruben S. Montero over 9 years ago

  • Target version changed from Release 3.4 to Release 3.2

#2 Updated by Javi Fontan over 9 years ago

  • Category set to Drivers - Auth
  • Status changed from New to Closed
  • Resolution set to fixed

#3 Updated by Carlos Martín over 9 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from Tino Vázquez to Javi Fontan
  • Resolution deleted (fixed)

Size units are wrong, a 8.4M file is reported as 8.4G

#4 Updated by Javi Fontan over 9 years ago

  • Status changed from Assigned to Closed
  • Resolution set to fixed

#5 Updated by Javi Fontan over 9 years ago

  • Status changed from Closed to Assigned
  • Target version changed from Release 3.2 to Release 3.4 - S0
  • Resolution deleted (fixed)

dd is wrongly used in dd_stat and the size is not reported correctly. Reported by Håkan Iaksson (http://lists.opennebula.org/pipermail/users-opennebula.org/2012-January/007720.html):

In opennebula-3.2.0 every VMware-image that is created with oneimage has the wrong size (as reported by "oneimage list").

The problem is in $ONE_LOCATION/var/remotes/image/fs/fsrc

The du command is used on dirs, and reports the size in kilobytes, but the expected
size is in bytes (as reported by stat if the image is only a file).

Here is a diff that makes the size calculation work properly for us:
diff fsrc fsrc.org
68c68
<               SIZE=`du -sb "$1" | cut -f1`
---
               SIZE=`du -s "$1" | cut -f1`

Note: The -b switch will probably only work on Linux/Unixes that has the GNU du-command.

#6 Updated by Javi Fontan over 9 years ago

  • Status changed from Assigned to Closed
  • Resolution set to fixed

Also available in: Atom PDF