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

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



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 gnome org>
>>
>> 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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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