libvirt/src/storage
Michal Privoznik b0579ed900 storage: resize vol against real allocated size
Currently, 'vol-resize --allocate' allocates new space at the
vol->capacity offset. But the vol->capacity is not necessarily the same
as vol->allocation. For instance:.

	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
	 Name      Path                   Type  Capacity  Allocation
	-------------------------------------------------------------
	 tmp-vol  /root/tmp-pool/tmp-vol  file  1.00 GiB  1.00 GiB

	[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 2G

	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
	 Name      Path                   Type  Capacity  Allocation
	-------------------------------------------------------------
	 tmp-vol  /root/tmp-pool/tmp-vol  file  2.00 GiB  1.00 GiB

So, if we want to allocate more bytes, so the file is say 3G big, the
real allocated size is 2G actually:

	[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 3G --allocate

	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
	 Name      Path                   Type  Capacity  Allocation
	-------------------------------------------------------------
	 tmp-vol  /root/tmp-pool/tmp-vol  file  3.00 GiB  2.00 GiB

This commit uses the correct vol->allocation instead of incorrect
vol->capacity, so the output of the commands above looks like this:

	[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 3G --allocate

	[root@localhost ~]# virsh vol-list --pool tmp-pool --details
	 Name      Path                   Type  Capacity  Allocation
	-------------------------------------------------------------
	 tmp-vol  /root/tmp-pool/tmp-vol  file  3.00 GiB  3.00 GiB

Moreover, if the '--alocate' flag was used, we must update the
vol->allocation member in storageVolResize API too, not just
vol->capacity.

Reported-by: Wang Sen <wangsen@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2013-12-18 09:08:27 +01:00
..
parthelper.c util: move virFile* functions from virutil.c to virfile.c 2013-05-10 13:09:30 -04:00
storage_backend_disk.c maint: Kill usage of atoi() 2013-12-04 18:56:06 +01:00
storage_backend_disk.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_fs.c storage: resize vol against real allocated size 2013-12-18 09:08:27 +01:00
storage_backend_fs.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_gluster.c storage: fix omitted slash in gluster volume URI 2013-12-10 09:40:41 -07:00
storage_backend_gluster.h storage: initial support for linking with libgfapi 2013-11-25 11:02:52 -07:00
storage_backend_iscsi.c Convert uuid to a string before printing it 2013-10-15 12:30:21 +02:00
storage_backend_iscsi.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_logical.c Remove (nearly) all use of getuid()/getgid() 2013-10-21 14:03:52 +01:00
storage_backend_logical.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_mpath.c storage: reduce number of stat calls 2013-11-06 17:17:08 -07:00
storage_backend_mpath.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_rbd.c storage_backend_rbd: rename "stat" variable 2013-12-11 10:18:15 +01:00
storage_backend_rbd.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend_scsi.c storage: Returns earlier if source adapter of the scsi pool is a HBA 2013-11-21 12:06:20 +08:00
storage_backend_scsi.h storage: Move virStorageBackendSCSIGetHostNumber into iscsi backend 2013-04-08 18:41:06 +08:00
storage_backend_sheepdog.c Adapt to VIR_ALLOC and virAsprintf in src/storage/* 2013-07-10 11:07:32 +02:00
storage_backend_sheepdog.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
storage_backend.c storage: skip selinux cleanup when fd not available 2013-11-27 06:08:28 -07:00
storage_backend.h storage: initial support for linking with libgfapi 2013-11-25 11:02:52 -07:00
storage_driver.c storage: resize vol against real allocated size 2013-12-18 09:08:27 +01:00
storage_driver.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00