Re: [PATCH 1/2] resize: add virStorageVolResize() API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/30/2012 04:08 AM, Daniel P. Berrange wrote:
> On Fri, Jan 27, 2012 at 05:28:15PM -0700, Eric Blake wrote:
>> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>
>>
>> Add a new function to allow changing of capacity of storage volumes.
>> Plan out several flags, even if not all of them will be implemented
>> up front.
>>

>> +typedef enum {
>> +  VIR_STORAGE_VOL_RESIZE_ALLOCATE = 1 << 0, /* force allocation of new size */
>> +  VIR_STORAGE_VOL_RESIZE_DELTA    = 1 << 1, /* size is relative to current */
>> +  VIR_STORAGE_VOL_RESIZE_SHRINK   = 1 << 2, /* allow decrease in capacity */
>> +} virStorageVolResizeFlags;
>> +
>> +int                     virStorageVolResize             (virStorageVolPtr vol,
>> +                                                         long long capacity,
>> +                                                         unsigned int flags);
> 
> 
> Why has this changed from 'unsigned long long' to just 'long long'.

Because of VIR_STORAGE_VOL_RESIZE_DELTA and
VIR_STORAGE_VOL_RESIZE_SHRINK.  That is,

virStorageVolResize(vol, -10 * 1024 * 1024, DELTA|SHRINK)

is a valid call to shave off 10 MiB of data.

> 
> In virStorageVolInfo we use 'unsigned long long', and you can't ever
> have a negative capacity, so I don't see why this should be signed.

Remember, off_t is signed, so you can never have a storage volume larger
than 2**63 bytes anyways.  Using signed capacity is no different than
using signed off_t (and if you can show me someone with a storage volume
with 2**64 bytes, I will be rather envious).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]