You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Sailaja Mada <sa...@citrix.com> on 2013/02/27 12:45:14 UTC

[ACS41]Unable to shrink volumes of type QCOW2

Hi,

Out of my curiosity , I tried to resize the volume with shrink option set to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM 6.3 hypervisor.  Do we have support this feature with KVM ?

2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet] (catalina-exec-1:null) ===END===  10.144.7.13 -- GET  command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Executing org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for job-128
2013-02-27 17:01:55,078 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 100011, [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-703567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}] }
2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"Unable to shrink volumes of type QCOW2","wait":0}}] }
2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl] (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type QCOW2'
2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode: 530, result: Error Code: 530 Error text: Failed to resize volume
2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===START===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl] (catalina-exec-17:null) Async job-128 completed
2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===END===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184


Thanks,
Sailaja.M

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Sailaja Mada <sa...@citrix.com>.
DATA volume. 

Thanks,
Sailaja.M

-----Original Message-----
From: prasanna [mailto:srivatsav.prasanna@gmail.com] On Behalf Of Prasanna Santhanam
Sent: Wednesday, February 27, 2013 5:23 PM
To: cloudstack-dev@incubator.apache.org
Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2

On Wed, Feb 27, 2013 at 05:15:14PM +0530, Sailaja Mada wrote:
> Hi,
> 
> Out of my curiosity , I tried to resize the volume with shrink option set to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM 6.3 hypervisor.  Do we have support this feature with KVM ?
> 
> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet] (catalina-exec-1:null) ===END===  10.144.7.13 -- GET  command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Executing org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for job-128
> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 100011, [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-703567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"Unable to shrink volumes of type QCOW2","wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl] (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type QCOW2'
> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode: 530, result: Error Code: 530 Error text: Failed to resize volume
> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===START===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl] (catalina-exec-17:null) Async job-128 completed
> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===END===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
> 
> 
Is it a ROOT or DATA volume?

-- 
Prasanna.,

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Prasanna Santhanam <ts...@apache.org>.
On Wed, Feb 27, 2013 at 05:15:14PM +0530, Sailaja Mada wrote:
> Hi,
> 
> Out of my curiosity , I tried to resize the volume with shrink option set to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM 6.3 hypervisor.  Do we have support this feature with KVM ?
> 
> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet] (catalina-exec-1:null) ===END===  10.144.7.13 -- GET  command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Executing org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for job-128
> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 100011, [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-703567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"Unable to shrink volumes of type QCOW2","wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl] (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type QCOW2'
> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode: 530, result: Error Code: 530 Error text: Failed to resize volume
> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===START===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl] (catalina-exec-17:null) Async job-128 completed
> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===END===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
> 
> 
Is it a ROOT or DATA volume?

-- 
Prasanna.,

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Marcus Sorensen <sh...@gmail.com>.
No, its explicitly disallowed.
On Feb 27, 2013 6:59 AM, "Wido den Hollander" <wi...@widodh.nl> wrote:

> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>
>> Hi,
>>
>> Out of my curiosity , I tried to resize the volume with shrink option set
>> to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM
>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>>
>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>>  command=resizeVolume&id=**ff94b87c-973c-4698-9fd2-**
>> 4a1375f5a7c0&shrinkok=true&**diskofferingid=8c61068f-f997-**
>> 48f5-a8ee-dfe8fd3571f2&size=**10&response=json&sessionkey=**
>> Ijl3uimE7kcZYn0P%2FK4AEvh%**2B3fw%3D&_=1361964737075
>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.**AsyncJobManagerImpl]
>> (Job-Executor-66:job-128) Executing org.apache.cloudstack.api.**
>> command.user.volume.**ResizeVolumeCmd for job-128
>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
>> 55487956346259, via: 1, Ver: v1, Flags: 100011, [{"storage.**
>> ResizeVolumeCommand":{"path":"**d6a5ce3c-ca40-426d-b0bd-**
>> 703567eda58f","pool":{"id":**200,"uuid":"17700ab0-df5a-**
>> 3047-a631-588d93dd749a","host"**:"10.102.192.100","path":"/**
>> cpg_vol/sailaja/asf41kvmps","**port":2049,"type":"**NetworkFilesystem"},"
>> **vmInstance":"none","newSize":**10737418240,"currentSize":**
>> 21474836480,"shrinkOk":true,"**wait":0}}] }
>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: ,
>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>> [{"storage.ResizeVolumeAnswer"**:{"newSize":0,"result":false,"**details":"Unable
>> to shrink volumes of type QCOW2","wait":0}}] }
>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.**StorageManagerImpl]
>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of
>> type QCOW2'
>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.**AsyncJobManagerImpl]
>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode:
>> 530, result: Error Code: 530 Error text: Failed to resize volume
>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>>  command=queryAsyncJobResult&**jobId=68fdb060-343c-4a64-8ccd-**
>> ce738da07a9b&response=json&**sessionkey=Ijl3uimE7kcZYn0P%**
>> 2FK4AEvh%2B3fw%3D&_=**1361964740184
>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.**AsyncJobManagerImpl]
>> (catalina-exec-17:null) Async job-128 completed
>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>>  command=queryAsyncJobResult&**jobId=68fdb060-343c-4a64-8ccd-**
>> ce738da07a9b&response=json&**sessionkey=Ijl3uimE7kcZYn0P%**
>> 2FK4AEvh%2B3fw%3D&_=**1361964740184
>>
>>
>>
> Checking the code I found this in LibvirtComputingResource:
>
> boolean shrinkOk = cmd.getShrinkOk();
>
> } else if (type.equals("QCOW2") && shrinkOk) {
>    return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of
> type " + type);
> }
>
> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>
> Wido
>
>  Thanks,
>> Sailaja.M
>>
>>
>

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Rajesh Battala <ra...@citrix.com>.
Thanks Marcus for the info.

> -----Original Message-----
> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
> Sent: Thursday, February 28, 2013 9:03 PM
> To: cloudstack-dev@incubator.apache.org
> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> 
> You said: "It would be good if you allow resize on qcow2 if it's going to be
> increase in size than shrink." It sounded like you were asking us to fix resize
> volume to allow growing of qcow2. But that should already work. Nobody on
> the thread had mentioned that it didn't work.
> 
> Then I went back and see you said "In the libvirtcomputing resources, we are
> restricting to resize only for "raw" disks." I don't see where that is true. If the
> format is unknown to getResizeScriptType, it will return "unsupported".
> getResizeScriptType currently returns 'RAW' or 'QCOW2'. Then it checks to see if
> it's QCOW2 and we intend to shrink.
> If that is the case, then it returns saying that shrinking isn't supported for
> QCOW2. Otherwise, it resizes, QCOW2 or RAW.
> 
> Growing QCOW2 should work fine through cloudstack. If it's not working then
> it's a bug, and we can create a new one or reopen this one (although again, I
> think it was only mentioning shrinking).
> 
> On Thu, Feb 28, 2013 at 8:24 AM, Rajesh Battala <ra...@citrix.com>
> wrote:
> > Am telling increasing/growing the disk size had worked.
> >
> > I had tried on rhel 6.3,
> > Increase the volume size is happening without error. But while decreasing the
> size its showing the error format not supported.
> >
> > qemu-img resize myvol.qcow2 +50G
> > Image resized.
> >
> > [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
> > qemu-img: This image format does not support resize
> >
> >
> >> -----Original Message-----
> >> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
> >> Sent: Thursday, February 28, 2013 8:50 PM
> >> To: cloudstack-dev@incubator.apache.org
> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >>
> >> You're saying that growing doesn't work?
> >>
> >> On Thu, Feb 28, 2013 at 7:54 AM, Rajesh Battala
> >> <ra...@citrix.com>
> >> wrote:
> >> > Hi Marcus,
> >> > Increasing the size of disk is supported for the qcow2, I had
> >> > verified it on
> >> rhel6.3. I had given the observations below.
> >> > It would be good if you allow resize on qcow2 if it's going to be
> >> > increase in size
> >> than shrink.
> >> >
> >> > Thanks
> >> > Rajesh Battala
> >> >
> >> >
> >> >> -----Original Message-----
> >> >> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
> >> >> Sent: Thursday, February 28, 2013 8:16 PM
> >> >> To: cloudstack-dev@incubator.apache.org
> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >> >>
> >> >> This is why I disabled it via the code pointed out. It was unreliable.
> >> >> When I originally developed it, it seemed to work. And then a few
> >> >> weeks later during testing we got "qemu-img: This image format
> >> >> does not
> >> support resize".
> >> >> Growing works fine, shrinking doesn't seem to be reliable, or
> >> >> depends on a particular version of qemu-img or something... I'll
> >> >> need to investigate if I can find the condition in which it
> >> >> worked. But anyway, that's why shrinking is in resizevolume.sh,
> >> >> but disallowed in the
> >> code.
> >> >>
> >> >>
> >> >> On Thu, Feb 28, 2013 at 3:54 AM, Rajesh Battala
> >> >> <ra...@citrix.com>
> >> >> wrote:
> >> >> > I had tried on rhel 6.3,
> >> >> > Increase the volume size is happening without error. But while
> >> >> > decreasing the
> >> >> size its showing the error format not supported.
> >> >> >
> >> >> > qemu-img resize myvol.qcow2 +50G Image resized.
> >> >> >
> >> >> > [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
> >> >> > qemu-img: This image format does not support resize
> >> >> >
> >> >> >
> >> >> > Thanks
> >> >> > Rajesh Battala
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> >> >> Sent: Thursday, February 28, 2013 3:34 PM
> >> >> >> To: cloudstack-dev@incubator.apache.org
> >> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
> >> >> >> > When I was going through the source and resizevolume.sh, In
> >> >> >> > the libvirtcomputing resources, we are restricting to resize only for
> "raw"
> >> disks.
> >> >> >> > But in the resizevolume.sh which will actually do the
> >> >> >> > resizing of the disks, this
> >> >> >> file has the function  resizeqcow2()  which is actually has the
> >> >> >> capability to resize
> >> >> >> qcow2 image.
> >> >> >> >
> >> >> >> >  From this source http://linux.die.net/man/1/qemu-img
> >> >> >> > qemu-img resize supports qcow2 image format also. Am not sure
> >> >> >> > why we are
> >> >> >> restricting not to convert qcow2 images.
> >> >> >>
> >> >> >> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
> >> >> >>
> >> >> >> BUT, I just tried it on my desktop and that fails:
> >> >> >>
> >> >> >> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
> >> >> >> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200
> >> >> >> encryption=off
> >> >> >> cluster_size=65536
> >> >> >> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
> >> >> >> qemu-img: This image format does not support resize
> >> >> >> wido@wido-desktop:~$
> >> >> >>
> >> >> >> On my desktop at the office it works, but that is running a
> >> >> >> manually compiled Qemu version.
> >> >> >>
> >> >> >> So the stock Ubuntu 12.04 Qemu version does not support
> >> >> >> shrinking
> >> >> >> QCOW2 files. Not sure about CentOS/RHEL 6.3.
> >> >> >>
> >> >> >> Wido
> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > Thanks
> >> >> >> > Rajesh Battala
> >> >> >> >
> >> >> >> >
> >> >> >> >> -----Original Message-----
> >> >> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> >> >> >> Sent: Thursday, February 28, 2013 3:05 PM
> >> >> >> >> To: cloudstack-dev@incubator.apache.org
> >> >> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
> >> >> >> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander
> >> >> >> >>> <wi...@widodh.nl>
> >> >> >> >> wrote:
> >> >> >> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> >> >> >> >>>>>
> >> >> >> >>>>> Hi,
> >> >> >> >>>>>
> >> >> >> >>>>> Out of my curiosity , I tried to resize the volume with
> >> >> >> >>>>> shrink option set to true . It failed to resize volume
> >> >> >> >>>>> from
> >> >> >> >>>>> 20 GB to
> >> >> >> >>>>> 10 GB . This is with KVM
> >> >> >> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
> >> >> >> >>>>>
> >> >> >> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
> >> >> >> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
> >> >> >> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
> >> >> >> >> 4a1375f5a7c0&shrinko
> >> >> >> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f
> >> >> >> >>>>> 2&s
> >> >> >> >>>>> ize
> >> >> >> >>>>> =10
> >> >> >> >>>>> &r
> >> >> >> >>>>>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
> >> >> >> >> 4
> >> >> >> >>>>> 737075
> >> >> >> >>>>> 2013-02-27 17:01:55,054 DEBUG
> >> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
> >> >> >> >>>>> (Job-Executor-66:job-128) Executing
> >> >> >> >>>>>
> >> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCm
> >> >> >> >>>>> d
> >> >> >> >>>>> for
> >> >> >> >>>>> job-128
> >> >> >> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
> >> >> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd
> >> >> >> >>>>> ,
> >> MgmtId:
> >> >> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
> >> >> >> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-42
> >> >> >> >>>>> 6d-
> >> >> b0b
> >> >> >> >>>>> d-
> >> >> >> >> 703
> >> >> >> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a6
> >> >> >> >>>>> 31-
> >> >> >> >>>>> 588
> >> >> >> >>>>> d93
> >> >> >> >>>>> dd
> >> >> >> >>>>>
> >> >> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
> >> >> >> >>>>>
> >> >> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
> >> >> >> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"w
> >> >> >> >>>>> ait
> >> >> >> >>>>> ":0
> >> >> >> >>>>> }}]
> >> >> >> >>>>> }
> >> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >> >> >> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436:
> >> >> >> >>>>> Processing:  {
> >> Ans:
> >> >> >> >>>>> ,
> >> >> >> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
> >> >> >> >>>>>
> >> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
> >> >> >> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
> >> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >> >> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans:
> >> >> >> >>>>> ,
> >> >> MgmtId:
> >> >> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, {
> >> >> >> >>>>> ResizeVolumeAnswer } }
> >> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG
> >> >> >> >>>>> [cloud.storage.StorageManagerImpl]
> >> >> >> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to
> >> >> >> >>>>> shrink volumes of type QCOW2'
> >> >> >> >>>>> 2013-02-27 17:01:55,201 DEBUG
> >> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
> >> >> >> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus:
> >> >> >> >>>>> 2,
> >> >> >> >> resultCode:
> >> >> >> >>>>> 530, result: Error Code: 530 Error text: Failed to resize
> >> >> >> >>>>> volume
> >> >> >> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
> >> >> >> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
> >> >> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-
> 8ccd
> >> >> >> >>>>> -
> >> >> >> >> ce738da07a
> >> >> >> >>>>>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> >> >> >> 6
> >> >> >> >>>>> 1964740184
> >> >> >> >>>>> 2013-02-27 17:01:58,081 DEBUG
> >> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
> >> >> >> >>>>> (catalina-exec-17:null) Async job-128 completed
> >> >> >> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
> >> >> >> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
> >> >> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-
> 8ccd
> >> >> >> >>>>> -
> >> >> >> >> ce738da07a
> >> >> >> >>>>>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> >> >> >> 6
> >> >> >> >>>>> 1964740184
> >> >> >> >>>>>
> >> >> >> >>>>>
> >> >> >> >>>>
> >> >> >> >>>> Checking the code I found this in LibvirtComputingResource:
> >> >> >> >>>>
> >> >> >> >>>> boolean shrinkOk = cmd.getShrinkOk();
> >> >> >> >>>>
> >> >> >> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
> >> >> >> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to
> >> >> >> >>>> shrink volumes of type " + type); }
> >> >> >> >>>>
> >> >> >> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
> >> >> >> >>>>
> >> >> >> >>>
> >> >> >> >>> Not a logical mistake. It's saying if you are trying to
> >> >> >> >>> shrink a
> >> >> >> >>> qcow2 image, it's not supported.
> >> >> >> >>>
> >> >> >> >>
> >> >> >> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
> >> >> >> >>
> >> >> >> >> Wido
> >> >> >> >>
> >> >> >> >>>> Wido
> >> >> >> >>>>
> >> >> >> >>>>> Thanks,
> >> >> >> >>>>> Sailaja.M
> >> >> >> >>>>>
> >> >> >> >>>>
> >> >> >> > []
> >> >> >> >

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Marcus Sorensen <sh...@gmail.com>.
You said: "It would be good if you allow resize on qcow2 if it's going
to be increase in size than shrink." It sounded like you were asking
us to fix resize volume to allow growing of qcow2. But that should
already work. Nobody on the thread had mentioned that it didn't work.

Then I went back and see you said "In the libvirtcomputing resources,
we are restricting to resize only for "raw" disks." I don't see where
that is true. If the format is unknown to getResizeScriptType, it will
return "unsupported". getResizeScriptType currently returns 'RAW' or
'QCOW2'. Then it checks to see if it's QCOW2 and we intend to shrink.
If that is the case, then it returns saying that shrinking isn't
supported for QCOW2. Otherwise, it resizes, QCOW2 or RAW.

Growing QCOW2 should work fine through cloudstack. If it's not working
then it's a bug, and we can create a new one or reopen this one
(although again, I think it was only mentioning shrinking).

On Thu, Feb 28, 2013 at 8:24 AM, Rajesh Battala
<ra...@citrix.com> wrote:
> Am telling increasing/growing the disk size had worked.
>
> I had tried on rhel 6.3,
> Increase the volume size is happening without error. But while decreasing the size its showing the error format not supported.
>
> qemu-img resize myvol.qcow2 +50G
> Image resized.
>
> [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
> qemu-img: This image format does not support resize
>
>
>> -----Original Message-----
>> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
>> Sent: Thursday, February 28, 2013 8:50 PM
>> To: cloudstack-dev@incubator.apache.org
>> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>>
>> You're saying that growing doesn't work?
>>
>> On Thu, Feb 28, 2013 at 7:54 AM, Rajesh Battala <ra...@citrix.com>
>> wrote:
>> > Hi Marcus,
>> > Increasing the size of disk is supported for the qcow2, I had verified it on
>> rhel6.3. I had given the observations below.
>> > It would be good if you allow resize on qcow2 if it's going to be increase in size
>> than shrink.
>> >
>> > Thanks
>> > Rajesh Battala
>> >
>> >
>> >> -----Original Message-----
>> >> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
>> >> Sent: Thursday, February 28, 2013 8:16 PM
>> >> To: cloudstack-dev@incubator.apache.org
>> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>> >>
>> >> This is why I disabled it via the code pointed out. It was unreliable.
>> >> When I originally developed it, it seemed to work. And then a few
>> >> weeks later during testing we got "qemu-img: This image format does not
>> support resize".
>> >> Growing works fine, shrinking doesn't seem to be reliable, or depends
>> >> on a particular version of qemu-img or something... I'll need to
>> >> investigate if I can find the condition in which it worked. But
>> >> anyway, that's why shrinking is in resizevolume.sh, but disallowed in the
>> code.
>> >>
>> >>
>> >> On Thu, Feb 28, 2013 at 3:54 AM, Rajesh Battala
>> >> <ra...@citrix.com>
>> >> wrote:
>> >> > I had tried on rhel 6.3,
>> >> > Increase the volume size is happening without error. But while
>> >> > decreasing the
>> >> size its showing the error format not supported.
>> >> >
>> >> > qemu-img resize myvol.qcow2 +50G
>> >> > Image resized.
>> >> >
>> >> > [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
>> >> > qemu-img: This image format does not support resize
>> >> >
>> >> >
>> >> > Thanks
>> >> > Rajesh Battala
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
>> >> >> Sent: Thursday, February 28, 2013 3:34 PM
>> >> >> To: cloudstack-dev@incubator.apache.org
>> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>> >> >>
>> >> >>
>> >> >>
>> >> >> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
>> >> >> > When I was going through the source and resizevolume.sh, In the
>> >> >> > libvirtcomputing resources, we are restricting to resize only for "raw"
>> disks.
>> >> >> > But in the resizevolume.sh which will actually do the resizing
>> >> >> > of the disks, this
>> >> >> file has the function  resizeqcow2()  which is actually has the
>> >> >> capability to resize
>> >> >> qcow2 image.
>> >> >> >
>> >> >> >  From this source http://linux.die.net/man/1/qemu-img
>> >> >> > qemu-img resize supports qcow2 image format also. Am not sure
>> >> >> > why we are
>> >> >> restricting not to convert qcow2 images.
>> >> >>
>> >> >> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
>> >> >>
>> >> >> BUT, I just tried it on my desktop and that fails:
>> >> >>
>> >> >> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
>> >> >> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200
>> >> >> encryption=off
>> >> >> cluster_size=65536
>> >> >> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
>> >> >> qemu-img: This image format does not support resize
>> >> >> wido@wido-desktop:~$
>> >> >>
>> >> >> On my desktop at the office it works, but that is running a
>> >> >> manually compiled Qemu version.
>> >> >>
>> >> >> So the stock Ubuntu 12.04 Qemu version does not support shrinking
>> >> >> QCOW2 files. Not sure about CentOS/RHEL 6.3.
>> >> >>
>> >> >> Wido
>> >> >>
>> >> >> >
>> >> >> >
>> >> >> > Thanks
>> >> >> > Rajesh Battala
>> >> >> >
>> >> >> >
>> >> >> >> -----Original Message-----
>> >> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
>> >> >> >> Sent: Thursday, February 28, 2013 3:05 PM
>> >> >> >> To: cloudstack-dev@incubator.apache.org
>> >> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
>> >> >> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander
>> >> >> >>> <wi...@widodh.nl>
>> >> >> >> wrote:
>> >> >> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>> >> >> >>>>>
>> >> >> >>>>> Hi,
>> >> >> >>>>>
>> >> >> >>>>> Out of my curiosity , I tried to resize the volume with
>> >> >> >>>>> shrink option set to true . It failed to resize volume from
>> >> >> >>>>> 20 GB to
>> >> >> >>>>> 10 GB . This is with KVM
>> >> >> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>> >> >> >>>>>
>> >> >> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>> >> >> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>> >> >> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
>> >> >> >> 4a1375f5a7c0&shrinko
>> >> >> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&s
>> >> >> >>>>> ize
>> >> >> >>>>> =10
>> >> >> >>>>> &r
>> >> >> >>>>>
>> >> >> >>
>> >> >>
>> >>
>> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
>> >> >> >> 4
>> >> >> >>>>> 737075
>> >> >> >>>>> 2013-02-27 17:01:55,054 DEBUG
>> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
>> >> >> >>>>> (Job-Executor-66:job-128) Executing
>> >> >> >>>>>
>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCm
>> >> >> >>>>> d
>> >> >> >>>>> for
>> >> >> >>>>> job-128
>> >> >> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>> >> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd ,
>> MgmtId:
>> >> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
>> >> >> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-
>> >> b0b
>> >> >> >>>>> d-
>> >> >> >> 703
>> >> >> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-
>> >> >> >>>>> 588
>> >> >> >>>>> d93
>> >> >> >>>>> dd
>> >> >> >>>>>
>> >> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
>> >> >> >>>>>
>> >> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
>> >> >> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait
>> >> >> >>>>> ":0
>> >> >> >>>>> }}]
>> >> >> >>>>> }
>> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> >> >> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  {
>> Ans:
>> >> >> >>>>> ,
>> >> >> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>> >> >> >>>>>
>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
>> >> >> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
>> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> >> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans:
>> >> >> >>>>> ,
>> >> MgmtId:
>> >> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, {
>> >> >> >>>>> ResizeVolumeAnswer } }
>> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG
>> >> >> >>>>> [cloud.storage.StorageManagerImpl]
>> >> >> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink
>> >> >> >>>>> volumes of type QCOW2'
>> >> >> >>>>> 2013-02-27 17:01:55,201 DEBUG
>> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
>> >> >> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus:
>> >> >> >>>>> 2,
>> >> >> >> resultCode:
>> >> >> >>>>> 530, result: Error Code: 530 Error text: Failed to resize
>> >> >> >>>>> volume
>> >> >> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>> >> >> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>> >> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> >> >> >> ce738da07a
>> >> >> >>>>>
>> >> >> >>
>> >> >>
>> >>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> >> >> >> 6
>> >> >> >>>>> 1964740184
>> >> >> >>>>> 2013-02-27 17:01:58,081 DEBUG
>> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
>> >> >> >>>>> (catalina-exec-17:null) Async job-128 completed
>> >> >> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>> >> >> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>> >> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> >> >> >> ce738da07a
>> >> >> >>>>>
>> >> >> >>
>> >> >>
>> >>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> >> >> >> 6
>> >> >> >>>>> 1964740184
>> >> >> >>>>>
>> >> >> >>>>>
>> >> >> >>>>
>> >> >> >>>> Checking the code I found this in LibvirtComputingResource:
>> >> >> >>>>
>> >> >> >>>> boolean shrinkOk = cmd.getShrinkOk();
>> >> >> >>>>
>> >> >> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
>> >> >> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to
>> >> >> >>>> shrink volumes of type " + type); }
>> >> >> >>>>
>> >> >> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>> >> >> >>>>
>> >> >> >>>
>> >> >> >>> Not a logical mistake. It's saying if you are trying to shrink
>> >> >> >>> a
>> >> >> >>> qcow2 image, it's not supported.
>> >> >> >>>
>> >> >> >>
>> >> >> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
>> >> >> >>
>> >> >> >> Wido
>> >> >> >>
>> >> >> >>>> Wido
>> >> >> >>>>
>> >> >> >>>>> Thanks,
>> >> >> >>>>> Sailaja.M
>> >> >> >>>>>
>> >> >> >>>>
>> >> >> > []
>> >> >> >

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Rajesh Battala <ra...@citrix.com>.
Am telling increasing/growing the disk size had worked. 

I had tried on rhel 6.3,
Increase the volume size is happening without error. But while decreasing the size its showing the error format not supported. 

qemu-img resize myvol.qcow2 +50G
Image resized.

[root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
qemu-img: This image format does not support resize


> -----Original Message-----
> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
> Sent: Thursday, February 28, 2013 8:50 PM
> To: cloudstack-dev@incubator.apache.org
> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> 
> You're saying that growing doesn't work?
> 
> On Thu, Feb 28, 2013 at 7:54 AM, Rajesh Battala <ra...@citrix.com>
> wrote:
> > Hi Marcus,
> > Increasing the size of disk is supported for the qcow2, I had verified it on
> rhel6.3. I had given the observations below.
> > It would be good if you allow resize on qcow2 if it's going to be increase in size
> than shrink.
> >
> > Thanks
> > Rajesh Battala
> >
> >
> >> -----Original Message-----
> >> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
> >> Sent: Thursday, February 28, 2013 8:16 PM
> >> To: cloudstack-dev@incubator.apache.org
> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >>
> >> This is why I disabled it via the code pointed out. It was unreliable.
> >> When I originally developed it, it seemed to work. And then a few
> >> weeks later during testing we got "qemu-img: This image format does not
> support resize".
> >> Growing works fine, shrinking doesn't seem to be reliable, or depends
> >> on a particular version of qemu-img or something... I'll need to
> >> investigate if I can find the condition in which it worked. But
> >> anyway, that's why shrinking is in resizevolume.sh, but disallowed in the
> code.
> >>
> >>
> >> On Thu, Feb 28, 2013 at 3:54 AM, Rajesh Battala
> >> <ra...@citrix.com>
> >> wrote:
> >> > I had tried on rhel 6.3,
> >> > Increase the volume size is happening without error. But while
> >> > decreasing the
> >> size its showing the error format not supported.
> >> >
> >> > qemu-img resize myvol.qcow2 +50G
> >> > Image resized.
> >> >
> >> > [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
> >> > qemu-img: This image format does not support resize
> >> >
> >> >
> >> > Thanks
> >> > Rajesh Battala
> >> >
> >> >> -----Original Message-----
> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> >> Sent: Thursday, February 28, 2013 3:34 PM
> >> >> To: cloudstack-dev@incubator.apache.org
> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >> >>
> >> >>
> >> >>
> >> >> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
> >> >> > When I was going through the source and resizevolume.sh, In the
> >> >> > libvirtcomputing resources, we are restricting to resize only for "raw"
> disks.
> >> >> > But in the resizevolume.sh which will actually do the resizing
> >> >> > of the disks, this
> >> >> file has the function  resizeqcow2()  which is actually has the
> >> >> capability to resize
> >> >> qcow2 image.
> >> >> >
> >> >> >  From this source http://linux.die.net/man/1/qemu-img
> >> >> > qemu-img resize supports qcow2 image format also. Am not sure
> >> >> > why we are
> >> >> restricting not to convert qcow2 images.
> >> >>
> >> >> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
> >> >>
> >> >> BUT, I just tried it on my desktop and that fails:
> >> >>
> >> >> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
> >> >> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200
> >> >> encryption=off
> >> >> cluster_size=65536
> >> >> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
> >> >> qemu-img: This image format does not support resize
> >> >> wido@wido-desktop:~$
> >> >>
> >> >> On my desktop at the office it works, but that is running a
> >> >> manually compiled Qemu version.
> >> >>
> >> >> So the stock Ubuntu 12.04 Qemu version does not support shrinking
> >> >> QCOW2 files. Not sure about CentOS/RHEL 6.3.
> >> >>
> >> >> Wido
> >> >>
> >> >> >
> >> >> >
> >> >> > Thanks
> >> >> > Rajesh Battala
> >> >> >
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> >> >> Sent: Thursday, February 28, 2013 3:05 PM
> >> >> >> To: cloudstack-dev@incubator.apache.org
> >> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
> >> >> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander
> >> >> >>> <wi...@widodh.nl>
> >> >> >> wrote:
> >> >> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> >> >> >>>>>
> >> >> >>>>> Hi,
> >> >> >>>>>
> >> >> >>>>> Out of my curiosity , I tried to resize the volume with
> >> >> >>>>> shrink option set to true . It failed to resize volume from
> >> >> >>>>> 20 GB to
> >> >> >>>>> 10 GB . This is with KVM
> >> >> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
> >> >> >>>>>
> >> >> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
> >> >> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
> >> >> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
> >> >> >> 4a1375f5a7c0&shrinko
> >> >> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&s
> >> >> >>>>> ize
> >> >> >>>>> =10
> >> >> >>>>> &r
> >> >> >>>>>
> >> >> >>
> >> >>
> >>
> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
> >> >> >> 4
> >> >> >>>>> 737075
> >> >> >>>>> 2013-02-27 17:01:55,054 DEBUG
> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
> >> >> >>>>> (Job-Executor-66:job-128) Executing
> >> >> >>>>>
> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCm
> >> >> >>>>> d
> >> >> >>>>> for
> >> >> >>>>> job-128
> >> >> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
> >> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd ,
> MgmtId:
> >> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
> >> >> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-
> >> b0b
> >> >> >>>>> d-
> >> >> >> 703
> >> >> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-
> >> >> >>>>> 588
> >> >> >>>>> d93
> >> >> >>>>> dd
> >> >> >>>>>
> >> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
> >> >> >>>>>
> >> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
> >> >> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait
> >> >> >>>>> ":0
> >> >> >>>>> }}]
> >> >> >>>>> }
> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >> >> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  {
> Ans:
> >> >> >>>>> ,
> >> >> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
> >> >> >>>>>
> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
> >> >> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans:
> >> >> >>>>> ,
> >> MgmtId:
> >> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, {
> >> >> >>>>> ResizeVolumeAnswer } }
> >> >> >>>>> 2013-02-27 17:01:55,192 DEBUG
> >> >> >>>>> [cloud.storage.StorageManagerImpl]
> >> >> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink
> >> >> >>>>> volumes of type QCOW2'
> >> >> >>>>> 2013-02-27 17:01:55,201 DEBUG
> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
> >> >> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus:
> >> >> >>>>> 2,
> >> >> >> resultCode:
> >> >> >>>>> 530, result: Error Code: 530 Error text: Failed to resize
> >> >> >>>>> volume
> >> >> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
> >> >> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
> >> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> >> >> >> ce738da07a
> >> >> >>>>>
> >> >> >>
> >> >>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> >> >> 6
> >> >> >>>>> 1964740184
> >> >> >>>>> 2013-02-27 17:01:58,081 DEBUG
> >> >> >>>>> [cloud.async.AsyncJobManagerImpl]
> >> >> >>>>> (catalina-exec-17:null) Async job-128 completed
> >> >> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
> >> >> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
> >> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> >> >> >> ce738da07a
> >> >> >>>>>
> >> >> >>
> >> >>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> >> >> 6
> >> >> >>>>> 1964740184
> >> >> >>>>>
> >> >> >>>>>
> >> >> >>>>
> >> >> >>>> Checking the code I found this in LibvirtComputingResource:
> >> >> >>>>
> >> >> >>>> boolean shrinkOk = cmd.getShrinkOk();
> >> >> >>>>
> >> >> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
> >> >> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to
> >> >> >>>> shrink volumes of type " + type); }
> >> >> >>>>
> >> >> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
> >> >> >>>>
> >> >> >>>
> >> >> >>> Not a logical mistake. It's saying if you are trying to shrink
> >> >> >>> a
> >> >> >>> qcow2 image, it's not supported.
> >> >> >>>
> >> >> >>
> >> >> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
> >> >> >>
> >> >> >> Wido
> >> >> >>
> >> >> >>>> Wido
> >> >> >>>>
> >> >> >>>>> Thanks,
> >> >> >>>>> Sailaja.M
> >> >> >>>>>
> >> >> >>>>
> >> >> > []
> >> >> >

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Marcus Sorensen <sh...@gmail.com>.
You're saying that growing doesn't work?

On Thu, Feb 28, 2013 at 7:54 AM, Rajesh Battala
<ra...@citrix.com> wrote:
> Hi Marcus,
> Increasing the size of disk is supported for the qcow2, I had verified it on rhel6.3. I had given the observations below.
> It would be good if you allow resize on qcow2 if it's going to be increase in size than shrink.
>
> Thanks
> Rajesh Battala
>
>
>> -----Original Message-----
>> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
>> Sent: Thursday, February 28, 2013 8:16 PM
>> To: cloudstack-dev@incubator.apache.org
>> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>>
>> This is why I disabled it via the code pointed out. It was unreliable.
>> When I originally developed it, it seemed to work. And then a few weeks later
>> during testing we got "qemu-img: This image format does not support resize".
>> Growing works fine, shrinking doesn't seem to be reliable, or depends on a
>> particular version of qemu-img or something... I'll need to investigate if I can
>> find the condition in which it worked. But anyway, that's why shrinking is in
>> resizevolume.sh, but disallowed in the code.
>>
>>
>> On Thu, Feb 28, 2013 at 3:54 AM, Rajesh Battala <ra...@citrix.com>
>> wrote:
>> > I had tried on rhel 6.3,
>> > Increase the volume size is happening without error. But while decreasing the
>> size its showing the error format not supported.
>> >
>> > qemu-img resize myvol.qcow2 +50G
>> > Image resized.
>> >
>> > [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
>> > qemu-img: This image format does not support resize
>> >
>> >
>> > Thanks
>> > Rajesh Battala
>> >
>> >> -----Original Message-----
>> >> From: Wido den Hollander [mailto:wido@widodh.nl]
>> >> Sent: Thursday, February 28, 2013 3:34 PM
>> >> To: cloudstack-dev@incubator.apache.org
>> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>> >>
>> >>
>> >>
>> >> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
>> >> > When I was going through the source and resizevolume.sh, In the
>> >> > libvirtcomputing resources, we are restricting to resize only for "raw" disks.
>> >> > But in the resizevolume.sh which will actually do the resizing of
>> >> > the disks, this
>> >> file has the function  resizeqcow2()  which is actually has the
>> >> capability to resize
>> >> qcow2 image.
>> >> >
>> >> >  From this source http://linux.die.net/man/1/qemu-img
>> >> > qemu-img resize supports qcow2 image format also. Am not sure why
>> >> > we are
>> >> restricting not to convert qcow2 images.
>> >>
>> >> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
>> >>
>> >> BUT, I just tried it on my desktop and that fails:
>> >>
>> >> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
>> >> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200 encryption=off
>> >> cluster_size=65536
>> >> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
>> >> qemu-img: This image format does not support resize
>> >> wido@wido-desktop:~$
>> >>
>> >> On my desktop at the office it works, but that is running a manually
>> >> compiled Qemu version.
>> >>
>> >> So the stock Ubuntu 12.04 Qemu version does not support shrinking
>> >> QCOW2 files. Not sure about CentOS/RHEL 6.3.
>> >>
>> >> Wido
>> >>
>> >> >
>> >> >
>> >> > Thanks
>> >> > Rajesh Battala
>> >> >
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
>> >> >> Sent: Thursday, February 28, 2013 3:05 PM
>> >> >> To: cloudstack-dev@incubator.apache.org
>> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>> >> >>
>> >> >>
>> >> >>
>> >> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
>> >> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander
>> >> >>> <wi...@widodh.nl>
>> >> >> wrote:
>> >> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>> >> >>>>>
>> >> >>>>> Hi,
>> >> >>>>>
>> >> >>>>> Out of my curiosity , I tried to resize the volume with shrink
>> >> >>>>> option set to true . It failed to resize volume from 20 GB to
>> >> >>>>> 10 GB . This is with KVM
>> >> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>> >> >>>>>
>> >> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>> >> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>> >> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
>> >> >> 4a1375f5a7c0&shrinko
>> >> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size
>> >> >>>>> =10
>> >> >>>>> &r
>> >> >>>>>
>> >> >>
>> >>
>> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
>> >> >> 4
>> >> >>>>> 737075
>> >> >>>>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
>> >> >>>>> (Job-Executor-66:job-128) Executing
>> >> >>>>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd
>> >> >>>>> for
>> >> >>>>> job-128
>> >> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
>> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
>> >> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-
>> b0b
>> >> >>>>> d-
>> >> >> 703
>> >> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588
>> >> >>>>> d93
>> >> >>>>> dd
>> >> >>>>>
>> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
>> >> >>>>>
>> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
>> >> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0
>> >> >>>>> }}]
>> >> >>>>> }
>> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> >> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans:
>> >> >>>>> ,
>> >> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>> >> >>>>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
>> >> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
>> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: ,
>> MgmtId:
>> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, {
>> >> >>>>> ResizeVolumeAnswer } }
>> >> >>>>> 2013-02-27 17:01:55,192 DEBUG
>> >> >>>>> [cloud.storage.StorageManagerImpl]
>> >> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink
>> >> >>>>> volumes of type QCOW2'
>> >> >>>>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
>> >> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2,
>> >> >> resultCode:
>> >> >>>>> 530, result: Error Code: 530 Error text: Failed to resize
>> >> >>>>> volume
>> >> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>> >> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> >> >> ce738da07a
>> >> >>>>>
>> >> >>
>> >>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> >> >> 6
>> >> >>>>> 1964740184
>> >> >>>>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
>> >> >>>>> (catalina-exec-17:null) Async job-128 completed
>> >> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>> >> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> >> >> ce738da07a
>> >> >>>>>
>> >> >>
>> >>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> >> >> 6
>> >> >>>>> 1964740184
>> >> >>>>>
>> >> >>>>>
>> >> >>>>
>> >> >>>> Checking the code I found this in LibvirtComputingResource:
>> >> >>>>
>> >> >>>> boolean shrinkOk = cmd.getShrinkOk();
>> >> >>>>
>> >> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
>> >> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to shrink
>> >> >>>> volumes of type " + type); }
>> >> >>>>
>> >> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>> >> >>>>
>> >> >>>
>> >> >>> Not a logical mistake. It's saying if you are trying to shrink a
>> >> >>> qcow2 image, it's not supported.
>> >> >>>
>> >> >>
>> >> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
>> >> >>
>> >> >> Wido
>> >> >>
>> >> >>>> Wido
>> >> >>>>
>> >> >>>>> Thanks,
>> >> >>>>> Sailaja.M
>> >> >>>>>
>> >> >>>>
>> >> > []
>> >> >

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Rajesh Battala <ra...@citrix.com>.
Hi Marcus, 
Increasing the size of disk is supported for the qcow2, I had verified it on rhel6.3. I had given the observations below.
It would be good if you allow resize on qcow2 if it's going to be increase in size than shrink.

Thanks
Rajesh Battala


> -----Original Message-----
> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
> Sent: Thursday, February 28, 2013 8:16 PM
> To: cloudstack-dev@incubator.apache.org
> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> 
> This is why I disabled it via the code pointed out. It was unreliable.
> When I originally developed it, it seemed to work. And then a few weeks later
> during testing we got "qemu-img: This image format does not support resize".
> Growing works fine, shrinking doesn't seem to be reliable, or depends on a
> particular version of qemu-img or something... I'll need to investigate if I can
> find the condition in which it worked. But anyway, that's why shrinking is in
> resizevolume.sh, but disallowed in the code.
> 
> 
> On Thu, Feb 28, 2013 at 3:54 AM, Rajesh Battala <ra...@citrix.com>
> wrote:
> > I had tried on rhel 6.3,
> > Increase the volume size is happening without error. But while decreasing the
> size its showing the error format not supported.
> >
> > qemu-img resize myvol.qcow2 +50G
> > Image resized.
> >
> > [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
> > qemu-img: This image format does not support resize
> >
> >
> > Thanks
> > Rajesh Battala
> >
> >> -----Original Message-----
> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> Sent: Thursday, February 28, 2013 3:34 PM
> >> To: cloudstack-dev@incubator.apache.org
> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >>
> >>
> >>
> >> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
> >> > When I was going through the source and resizevolume.sh, In the
> >> > libvirtcomputing resources, we are restricting to resize only for "raw" disks.
> >> > But in the resizevolume.sh which will actually do the resizing of
> >> > the disks, this
> >> file has the function  resizeqcow2()  which is actually has the
> >> capability to resize
> >> qcow2 image.
> >> >
> >> >  From this source http://linux.die.net/man/1/qemu-img
> >> > qemu-img resize supports qcow2 image format also. Am not sure why
> >> > we are
> >> restricting not to convert qcow2 images.
> >>
> >> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
> >>
> >> BUT, I just tried it on my desktop and that fails:
> >>
> >> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
> >> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200 encryption=off
> >> cluster_size=65536
> >> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
> >> qemu-img: This image format does not support resize
> >> wido@wido-desktop:~$
> >>
> >> On my desktop at the office it works, but that is running a manually
> >> compiled Qemu version.
> >>
> >> So the stock Ubuntu 12.04 Qemu version does not support shrinking
> >> QCOW2 files. Not sure about CentOS/RHEL 6.3.
> >>
> >> Wido
> >>
> >> >
> >> >
> >> > Thanks
> >> > Rajesh Battala
> >> >
> >> >
> >> >> -----Original Message-----
> >> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> >> Sent: Thursday, February 28, 2013 3:05 PM
> >> >> To: cloudstack-dev@incubator.apache.org
> >> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >> >>
> >> >>
> >> >>
> >> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
> >> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander
> >> >>> <wi...@widodh.nl>
> >> >> wrote:
> >> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> >> >>>>>
> >> >>>>> Hi,
> >> >>>>>
> >> >>>>> Out of my curiosity , I tried to resize the volume with shrink
> >> >>>>> option set to true . It failed to resize volume from 20 GB to
> >> >>>>> 10 GB . This is with KVM
> >> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
> >> >>>>>
> >> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
> >> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
> >> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
> >> >> 4a1375f5a7c0&shrinko
> >> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size
> >> >>>>> =10
> >> >>>>> &r
> >> >>>>>
> >> >>
> >>
> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
> >> >> 4
> >> >>>>> 737075
> >> >>>>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
> >> >>>>> (Job-Executor-66:job-128) Executing
> >> >>>>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd
> >> >>>>> for
> >> >>>>> job-128
> >> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
> >> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-
> b0b
> >> >>>>> d-
> >> >> 703
> >> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588
> >> >>>>> d93
> >> >>>>> dd
> >> >>>>>
> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
> >> >>>>>
> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
> >> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0
> >> >>>>> }}]
> >> >>>>> }
> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans:
> >> >>>>> ,
> >> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
> >> >>>>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
> >> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
> >> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: ,
> MgmtId:
> >> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, {
> >> >>>>> ResizeVolumeAnswer } }
> >> >>>>> 2013-02-27 17:01:55,192 DEBUG
> >> >>>>> [cloud.storage.StorageManagerImpl]
> >> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink
> >> >>>>> volumes of type QCOW2'
> >> >>>>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
> >> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2,
> >> >> resultCode:
> >> >>>>> 530, result: Error Code: 530 Error text: Failed to resize
> >> >>>>> volume
> >> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
> >> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> >> >> ce738da07a
> >> >>>>>
> >> >>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> >> 6
> >> >>>>> 1964740184
> >> >>>>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
> >> >>>>> (catalina-exec-17:null) Async job-128 completed
> >> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
> >> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
> >> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> >> >> ce738da07a
> >> >>>>>
> >> >>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> >> 6
> >> >>>>> 1964740184
> >> >>>>>
> >> >>>>>
> >> >>>>
> >> >>>> Checking the code I found this in LibvirtComputingResource:
> >> >>>>
> >> >>>> boolean shrinkOk = cmd.getShrinkOk();
> >> >>>>
> >> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
> >> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to shrink
> >> >>>> volumes of type " + type); }
> >> >>>>
> >> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
> >> >>>>
> >> >>>
> >> >>> Not a logical mistake. It's saying if you are trying to shrink a
> >> >>> qcow2 image, it's not supported.
> >> >>>
> >> >>
> >> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
> >> >>
> >> >> Wido
> >> >>
> >> >>>> Wido
> >> >>>>
> >> >>>>> Thanks,
> >> >>>>> Sailaja.M
> >> >>>>>
> >> >>>>
> >> > []
> >> >

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Marcus Sorensen <sh...@gmail.com>.
This is why I disabled it via the code pointed out. It was unreliable.
When I originally developed it, it seemed to work. And then a few
weeks later during testing we got "qemu-img: This image format does
not support resize". Growing works fine, shrinking doesn't seem to be
reliable, or depends on a particular version of qemu-img or
something... I'll need to investigate if I can find the condition in
which it worked. But anyway, that's why shrinking is in
resizevolume.sh, but disallowed in the code.


On Thu, Feb 28, 2013 at 3:54 AM, Rajesh Battala
<ra...@citrix.com> wrote:
> I had tried on rhel 6.3,
> Increase the volume size is happening without error. But while decreasing the size its showing the error format not supported.
>
> qemu-img resize myvol.qcow2 +50G
> Image resized.
>
> [root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
> qemu-img: This image format does not support resize
>
>
> Thanks
> Rajesh Battala
>
>> -----Original Message-----
>> From: Wido den Hollander [mailto:wido@widodh.nl]
>> Sent: Thursday, February 28, 2013 3:34 PM
>> To: cloudstack-dev@incubator.apache.org
>> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>>
>>
>>
>> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
>> > When I was going through the source and resizevolume.sh, In the
>> > libvirtcomputing resources, we are restricting to resize only for "raw" disks.
>> > But in the resizevolume.sh which will actually do the resizing of the disks, this
>> file has the function  resizeqcow2()  which is actually has the capability to resize
>> qcow2 image.
>> >
>> >  From this source http://linux.die.net/man/1/qemu-img
>> > qemu-img resize supports qcow2 image format also. Am not sure why we are
>> restricting not to convert qcow2 images.
>>
>> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
>>
>> BUT, I just tried it on my desktop and that fails:
>>
>> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
>> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200 encryption=off
>> cluster_size=65536
>> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
>> qemu-img: This image format does not support resize wido@wido-desktop:~$
>>
>> On my desktop at the office it works, but that is running a manually compiled
>> Qemu version.
>>
>> So the stock Ubuntu 12.04 Qemu version does not support shrinking QCOW2
>> files. Not sure about CentOS/RHEL 6.3.
>>
>> Wido
>>
>> >
>> >
>> > Thanks
>> > Rajesh Battala
>> >
>> >
>> >> -----Original Message-----
>> >> From: Wido den Hollander [mailto:wido@widodh.nl]
>> >> Sent: Thursday, February 28, 2013 3:05 PM
>> >> To: cloudstack-dev@incubator.apache.org
>> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>> >>
>> >>
>> >>
>> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
>> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander <wi...@widodh.nl>
>> >> wrote:
>> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> Out of my curiosity , I tried to resize the volume with shrink
>> >>>>> option set to true . It failed to resize volume from 20 GB to 10
>> >>>>> GB . This is with KVM
>> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>> >>>>>
>> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
>> >> 4a1375f5a7c0&shrinko
>> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10
>> >>>>> &r
>> >>>>>
>> >>
>> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
>> >> 4
>> >>>>> 737075
>> >>>>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
>> >>>>> (Job-Executor-66:job-128) Executing
>> >>>>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for
>> >>>>> job-128
>> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
>> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
>> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-
>> >> 703
>> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93
>> >>>>> dd
>> >>>>> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
>> >>>>> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
>> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}]
>> >>>>> }
>> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans:
>> >>>>> ,
>> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>> >>>>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
>> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
>> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
>> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer }
>> >>>>> }
>> >>>>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl]
>> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink
>> >>>>> volumes of type QCOW2'
>> >>>>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
>> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2,
>> >> resultCode:
>> >>>>> 530, result: Error Code: 530 Error text: Failed to resize volume
>> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> >> ce738da07a
>> >>>>>
>> >>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> >> 6
>> >>>>> 1964740184
>> >>>>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
>> >>>>> (catalina-exec-17:null) Async job-128 completed
>> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> >> ce738da07a
>> >>>>>
>> >>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> >> 6
>> >>>>> 1964740184
>> >>>>>
>> >>>>>
>> >>>>
>> >>>> Checking the code I found this in LibvirtComputingResource:
>> >>>>
>> >>>> boolean shrinkOk = cmd.getShrinkOk();
>> >>>>
>> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
>> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to shrink
>> >>>> volumes of type " + type); }
>> >>>>
>> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>> >>>>
>> >>>
>> >>> Not a logical mistake. It's saying if you are trying to shrink a
>> >>> qcow2 image, it's not supported.
>> >>>
>> >>
>> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
>> >>
>> >> Wido
>> >>
>> >>>> Wido
>> >>>>
>> >>>>> Thanks,
>> >>>>> Sailaja.M
>> >>>>>
>> >>>>
>> > []
>> >

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Rajesh Battala <ra...@citrix.com>.
I had tried on rhel 6.3,
Increase the volume size is happening without error. But while decreasing the size its showing the error format not supported. 

qemu-img resize myvol.qcow2 +50G
Image resized.

[root@kvm57 ~]# qemu-img resize myvol.qcow2 40G
qemu-img: This image format does not support resize


Thanks
Rajesh Battala

> -----Original Message-----
> From: Wido den Hollander [mailto:wido@widodh.nl]
> Sent: Thursday, February 28, 2013 3:34 PM
> To: cloudstack-dev@incubator.apache.org
> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> 
> 
> 
> On 02/28/2013 10:53 AM, Rajesh Battala wrote:
> > When I was going through the source and resizevolume.sh, In the
> > libvirtcomputing resources, we are restricting to resize only for "raw" disks.
> > But in the resizevolume.sh which will actually do the resizing of the disks, this
> file has the function  resizeqcow2()  which is actually has the capability to resize
> qcow2 image.
> >
> >  From this source http://linux.die.net/man/1/qemu-img
> > qemu-img resize supports qcow2 image format also. Am not sure why we are
> restricting not to convert qcow2 images.
> 
> Indeed, resizevolume.sh allows QCOW2 files to be shrunk.
> 
> BUT, I just tried it on my desktop and that fails:
> 
> wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
> Formatting 'volume.qcow2', fmt=qcow2 size=53687091200 encryption=off
> cluster_size=65536
> wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
> qemu-img: This image format does not support resize wido@wido-desktop:~$
> 
> On my desktop at the office it works, but that is running a manually compiled
> Qemu version.
> 
> So the stock Ubuntu 12.04 Qemu version does not support shrinking QCOW2
> files. Not sure about CentOS/RHEL 6.3.
> 
> Wido
> 
> >
> >
> > Thanks
> > Rajesh Battala
> >
> >
> >> -----Original Message-----
> >> From: Wido den Hollander [mailto:wido@widodh.nl]
> >> Sent: Thursday, February 28, 2013 3:05 PM
> >> To: cloudstack-dev@incubator.apache.org
> >> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> >>
> >>
> >>
> >> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
> >>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander <wi...@widodh.nl>
> >> wrote:
> >>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> Out of my curiosity , I tried to resize the volume with shrink
> >>>>> option set to true . It failed to resize volume from 20 GB to 10
> >>>>> GB . This is with KVM
> >>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
> >>>>>
> >>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
> >>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
> >>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
> >> 4a1375f5a7c0&shrinko
> >>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10
> >>>>> &r
> >>>>>
> >>
> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
> >> 4
> >>>>> 737075
> >>>>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
> >>>>> (Job-Executor-66:job-128) Executing
> >>>>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for
> >>>>> job-128
> >>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
> >>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-
> >> 703
> >>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93
> >>>>> dd
> >>>>> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
> >>>>> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
> >>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}]
> >>>>> }
> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans:
> >>>>> ,
> >>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
> >>>>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
> >>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
> >>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
> >>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer }
> >>>>> }
> >>>>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl]
> >>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink
> >>>>> volumes of type QCOW2'
> >>>>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
> >>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2,
> >> resultCode:
> >>>>> 530, result: Error Code: 530 Error text: Failed to resize volume
> >>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
> >>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> >> ce738da07a
> >>>>>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> 6
> >>>>> 1964740184
> >>>>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
> >>>>> (catalina-exec-17:null) Async job-128 completed
> >>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
> >>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
> >>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> >> ce738da07a
> >>>>>
> >>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> >> 6
> >>>>> 1964740184
> >>>>>
> >>>>>
> >>>>
> >>>> Checking the code I found this in LibvirtComputingResource:
> >>>>
> >>>> boolean shrinkOk = cmd.getShrinkOk();
> >>>>
> >>>> } else if (type.equals("QCOW2") && shrinkOk) {
> >>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to shrink
> >>>> volumes of type " + type); }
> >>>>
> >>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
> >>>>
> >>>
> >>> Not a logical mistake. It's saying if you are trying to shrink a
> >>> qcow2 image, it's not supported.
> >>>
> >>
> >> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
> >>
> >> Wido
> >>
> >>>> Wido
> >>>>
> >>>>> Thanks,
> >>>>> Sailaja.M
> >>>>>
> >>>>
> > []
> >

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Wido den Hollander <wi...@widodh.nl>.

On 02/28/2013 10:53 AM, Rajesh Battala wrote:
> When I was going through the source and resizevolume.sh,
> In the libvirtcomputing resources, we are restricting to resize only for "raw" disks.
> But in the resizevolume.sh which will actually do the resizing of the disks, this file has the function  resizeqcow2()  which is actually has the capability to resize qcow2 image.
>
>  From this source http://linux.die.net/man/1/qemu-img
> qemu-img resize supports qcow2 image format also. Am not sure why we are restricting not to convert qcow2 images.

Indeed, resizevolume.sh allows QCOW2 files to be shrunk.

BUT, I just tried it on my desktop and that fails:

wido@wido-desktop:~$ qemu-img create -f qcow2 volume.qcow2 50G
Formatting 'volume.qcow2', fmt=qcow2 size=53687091200 encryption=off 
cluster_size=65536
wido@wido-desktop:~$ qemu-img resize volume.qcow2 -20G
qemu-img: This image format does not support resize
wido@wido-desktop:~$

On my desktop at the office it works, but that is running a manually 
compiled Qemu version.

So the stock Ubuntu 12.04 Qemu version does not support shrinking QCOW2 
files. Not sure about CentOS/RHEL 6.3.

Wido

>
>
> Thanks
> Rajesh Battala
>
>
>> -----Original Message-----
>> From: Wido den Hollander [mailto:wido@widodh.nl]
>> Sent: Thursday, February 28, 2013 3:05 PM
>> To: cloudstack-dev@incubator.apache.org
>> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
>>
>>
>>
>> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
>>> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander <wi...@widodh.nl>
>> wrote:
>>>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Out of my curiosity , I tried to resize the volume with shrink
>>>>> option set to true . It failed to resize volume from 20 GB to 10 GB
>>>>> . This is with KVM
>>>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>>>>>
>>>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>>>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>>>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
>> 4a1375f5a7c0&shrinko
>>>>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&r
>>>>>
>> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
>> 4
>>>>> 737075
>>>>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
>>>>> (Job-Executor-66:job-128) Executing
>>>>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for
>>>>> job-128
>>>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>>>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
>>>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
>>>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-
>> 703
>>>>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd
>>>>> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
>>>>> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
>>>>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}]
>>>>> }
>>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>>>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans:
>>>>> ,
>>>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>>>>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
>>>>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
>>>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>>>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
>>>>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
>>>>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl]
>>>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes
>>>>> of type QCOW2'
>>>>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
>>>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2,
>> resultCode:
>>>>> 530, result: Error Code: 530 Error text: Failed to resize volume
>>>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>>>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> ce738da07a
>>>>>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> 6
>>>>> 1964740184
>>>>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
>>>>> (catalina-exec-17:null) Async job-128 completed
>>>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>>>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>>>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
>> ce738da07a
>>>>>
>> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
>> 6
>>>>> 1964740184
>>>>>
>>>>>
>>>>
>>>> Checking the code I found this in LibvirtComputingResource:
>>>>
>>>> boolean shrinkOk = cmd.getShrinkOk();
>>>>
>>>> } else if (type.equals("QCOW2") && shrinkOk) {
>>>>      return new ResizeVolumeAnswer(cmd, false, "Unable to shrink
>>>> volumes of type " + type); }
>>>>
>>>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>>>>
>>>
>>> Not a logical mistake. It's saying if you are trying to shrink a qcow2
>>> image, it's not supported.
>>>
>>
>> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
>>
>> Wido
>>
>>>> Wido
>>>>
>>>>> Thanks,
>>>>> Sailaja.M
>>>>>
>>>>
> []
>

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Rajesh Battala <ra...@citrix.com>.
When I was going through the source and resizevolume.sh,
In the libvirtcomputing resources, we are restricting to resize only for "raw" disks. 
But in the resizevolume.sh which will actually do the resizing of the disks, this file has the function  resizeqcow2()  which is actually has the capability to resize qcow2 image. 

>From this source http://linux.die.net/man/1/qemu-img 
qemu-img resize supports qcow2 image format also. Am not sure why we are restricting not to convert qcow2 images.


Thanks
Rajesh Battala


> -----Original Message-----
> From: Wido den Hollander [mailto:wido@widodh.nl]
> Sent: Thursday, February 28, 2013 3:05 PM
> To: cloudstack-dev@incubator.apache.org
> Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2
> 
> 
> 
> On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
> > On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander <wi...@widodh.nl>
> wrote:
> >> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> >>>
> >>> Hi,
> >>>
> >>> Out of my curiosity , I tried to resize the volume with shrink
> >>> option set to true . It failed to resize volume from 20 GB to 10 GB
> >>> . This is with KVM
> >>> 6.3 hypervisor.  Do we have support this feature with KVM ?
> >>>
> >>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
> >>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
> >>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-
> 4a1375f5a7c0&shrinko
> >>> k=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&r
> >>>
> esponse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=136196
> 4
> >>> 737075
> >>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
> >>> (Job-Executor-66:job-128) Executing
> >>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for
> >>> job-128
> >>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
> >>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
> >>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
> >>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-
> 703
> >>> 567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd
> >>> 749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","
> >>> port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize"
> >>> :10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}]
> >>> }
> >>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans:
> >>> ,
> >>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
> >>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details"
> >>> :"Unable to shrink volumes of type QCOW2","wait":0}}] }
> >>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
> >>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
> >>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
> >>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl]
> >>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes
> >>> of type QCOW2'
> >>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
> >>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2,
> resultCode:
> >>> 530, result: Error Code: 530 Error text: Failed to resize volume
> >>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
> >>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
> >>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> ce738da07a
> >>>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> 6
> >>> 1964740184
> >>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
> >>> (catalina-exec-17:null) Async job-128 completed
> >>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
> >>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
> >>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-
> ce738da07a
> >>>
> 9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=13
> 6
> >>> 1964740184
> >>>
> >>>
> >>
> >> Checking the code I found this in LibvirtComputingResource:
> >>
> >> boolean shrinkOk = cmd.getShrinkOk();
> >>
> >> } else if (type.equals("QCOW2") && shrinkOk) {
> >>     return new ResizeVolumeAnswer(cmd, false, "Unable to shrink
> >> volumes of type " + type); }
> >>
> >> Seems like a logical mistake? Shouldn't that be !shrinkOk?
> >>
> >
> > Not a logical mistake. It's saying if you are trying to shrink a qcow2
> > image, it's not supported.
> >
> 
> Heh? QCOW2 does support shrinking? So why isn't it allowed then?
> 
> Wido
> 
> >> Wido
> >>
> >>> Thanks,
> >>> Sailaja.M
> >>>
> >>
[]

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Wido den Hollander <wi...@widodh.nl>.

On 02/28/2013 07:39 AM, Marcus Sorensen wrote:
> On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander <wi...@widodh.nl> wrote:
>> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>>>
>>> Hi,
>>>
>>> Out of my curiosity , I tried to resize the volume with shrink option set
>>> to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM
>>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>>>
>>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
>>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
>>> (Job-Executor-66:job-128) Executing
>>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for job-128
>>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
>>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
>>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-703567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}]
>>> }
>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: ,
>>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"Unable
>>> to shrink volumes of type QCOW2","wait":0}}] }
>>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
>>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
>>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl]
>>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type
>>> QCOW2'
>>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
>>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode:
>>> 530, result: Error Code: 530 Error text: Failed to resize volume
>>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
>>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
>>> (catalina-exec-17:null) Async job-128 completed
>>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
>>>
>>>
>>
>> Checking the code I found this in LibvirtComputingResource:
>>
>> boolean shrinkOk = cmd.getShrinkOk();
>>
>> } else if (type.equals("QCOW2") && shrinkOk) {
>>     return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of
>> type " + type);
>> }
>>
>> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>>
>
> Not a logical mistake. It's saying if you are trying to shrink a qcow2
> image, it's not supported.
>

Heh? QCOW2 does support shrinking? So why isn't it allowed then?

Wido

>> Wido
>>
>>> Thanks,
>>> Sailaja.M
>>>
>>

Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Marcus Sorensen <sh...@gmail.com>.
On Wed, Feb 27, 2013 at 6:58 AM, Wido den Hollander <wi...@widodh.nl> wrote:
> On 02/27/2013 12:45 PM, Sailaja Mada wrote:
>>
>> Hi,
>>
>> Out of my curiosity , I tried to resize the volume with shrink option set
>> to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM
>> 6.3 hypervisor.  Do we have support this feature with KVM ?
>>
>> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet]
>> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET
>> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
>> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl]
>> (Job-Executor-66:job-128) Executing
>> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for job-128
>> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request]
>> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId:
>> 55487956346259, via: 1, Ver: v1, Flags: 100011,
>> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-703567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}]
>> }
>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: ,
>> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10,
>> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"Unable
>> to shrink volumes of type QCOW2","wait":0}}] }
>> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request]
>> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId:
>> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
>> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl]
>> (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type
>> QCOW2'
>> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl]
>> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode:
>> 530, result: Error Code: 530 Error text: Failed to resize volume
>> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet]
>> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET
>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
>> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl]
>> (catalina-exec-17:null) Async job-128 completed
>> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet]
>> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET
>> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
>>
>>
>
> Checking the code I found this in LibvirtComputingResource:
>
> boolean shrinkOk = cmd.getShrinkOk();
>
> } else if (type.equals("QCOW2") && shrinkOk) {
>    return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of
> type " + type);
> }
>
> Seems like a logical mistake? Shouldn't that be !shrinkOk?
>

Not a logical mistake. It's saying if you are trying to shrink a qcow2
image, it's not supported.

> Wido
>
>> Thanks,
>> Sailaja.M
>>
>

RE: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Sailaja Mada <sa...@citrix.com>.
Thanks Wido.  I have crated the bug for the same @ https://issues.apache.org/jira/browse/CLOUDSTACK-1445 

Regards,
Sailaja.M

-----Original Message-----
From: Wido den Hollander [mailto:wido@widodh.nl] 
Sent: Wednesday, February 27, 2013 7:29 PM
To: cloudstack-dev@incubator.apache.org
Subject: Re: [ACS41]Unable to shrink volumes of type QCOW2

On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> Hi,
>
> Out of my curiosity , I tried to resize the volume with shrink option set to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM 6.3 hypervisor.  Do we have support this feature with KVM ?
>
> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet] 
> (catalina-exec-1:null) ===END===  10.144.7.13 -- GET  
> command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=
> true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&respo
> nse=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (Job-Executor-66:job-128) Executing 
> org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for 
> job-128
> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request] 
> (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId: 
> 55487956346259, via: 1, Ver: v1, Flags: 100011, 
> [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-70356
> 7eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a
> ","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":
> 2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":1073741
> 8240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] 
> (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: , 
> MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, 
> [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"
> Unable to shrink volumes of type QCOW2","wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] 
> (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId: 
> 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl] (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type QCOW2'
> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, 
> resultCode: 530, result: Error Code: 530 Error text: Failed to resize 
> volume
> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet] 
> (catalina-exec-17:null) ===START===  10.144.7.13 -- GET  
> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b
> &response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964
> 740184
> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl] 
> (catalina-exec-17:null) Async job-128 completed
> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet] 
> (catalina-exec-17:null) ===END===  10.144.7.13 -- GET  
> command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b
> &response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964
> 740184
>
>

Checking the code I found this in LibvirtComputingResource:

boolean shrinkOk = cmd.getShrinkOk();

} else if (type.equals("QCOW2") && shrinkOk) {
    return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type); }

Seems like a logical mistake? Shouldn't that be !shrinkOk?

Wido

> Thanks,
> Sailaja.M
>


Re: [ACS41]Unable to shrink volumes of type QCOW2

Posted by Wido den Hollander <wi...@widodh.nl>.
On 02/27/2013 12:45 PM, Sailaja Mada wrote:
> Hi,
>
> Out of my curiosity , I tried to resize the volume with shrink option set to true . It failed to resize volume from 20 GB to 10 GB . This is with KVM 6.3 hypervisor.  Do we have support this feature with KVM ?
>
> 2013-02-27 17:01:55,052 DEBUG [cloud.api.ApiServlet] (catalina-exec-1:null) ===END===  10.144.7.13 -- GET  command=resizeVolume&id=ff94b87c-973c-4698-9fd2-4a1375f5a7c0&shrinkok=true&diskofferingid=8c61068f-f997-48f5-a8ee-dfe8fd3571f2&size=10&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964737075
> 2013-02-27 17:01:55,054 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Executing org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd for job-128
> 2013-02-27 17:01:55,078 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Sending  { Cmd , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 100011, [{"storage.ResizeVolumeCommand":{"path":"d6a5ce3c-ca40-426d-b0bd-703567eda58f","pool":{"id":200,"uuid":"17700ab0-df5a-3047-a631-588d93dd749a","host":"10.102.192.100","path":"/cpg_vol/sailaja/asf41kvmps","port":2049,"type":"NetworkFilesystem"},"vmInstance":"none","newSize":10737418240,"currentSize":21474836480,"shrinkOk":true,"wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (AgentManager-Handler-10:null) Seq 1-648544436: Processing:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, [{"storage.ResizeVolumeAnswer":{"newSize":0,"result":false,"details":"Unable to shrink volumes of type QCOW2","wait":0}}] }
> 2013-02-27 17:01:55,192 DEBUG [agent.transport.Request] (Job-Executor-66:job-128) Seq 1-648544436: Received:  { Ans: , MgmtId: 55487956346259, via: 1, Ver: v1, Flags: 10, { ResizeVolumeAnswer } }
> 2013-02-27 17:01:55,192 DEBUG [cloud.storage.StorageManagerImpl] (Job-Executor-66:job-128) Resize: returned 'Unable to shrink volumes of type QCOW2'
> 2013-02-27 17:01:55,201 DEBUG [cloud.async.AsyncJobManagerImpl] (Job-Executor-66:job-128) Complete async job-128, jobStatus: 2, resultCode: 530, result: Error Code: 530 Error text: Failed to resize volume
> 2013-02-27 17:01:58,073 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===START===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
> 2013-02-27 17:01:58,081 DEBUG [cloud.async.AsyncJobManagerImpl] (catalina-exec-17:null) Async job-128 completed
> 2013-02-27 17:01:58,085 DEBUG [cloud.api.ApiServlet] (catalina-exec-17:null) ===END===  10.144.7.13 -- GET  command=queryAsyncJobResult&jobId=68fdb060-343c-4a64-8ccd-ce738da07a9b&response=json&sessionkey=Ijl3uimE7kcZYn0P%2FK4AEvh%2B3fw%3D&_=1361964740184
>
>

Checking the code I found this in LibvirtComputingResource:

boolean shrinkOk = cmd.getShrinkOk();

} else if (type.equals("QCOW2") && shrinkOk) {
    return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes 
of type " + type);
}

Seems like a logical mistake? Shouldn't that be !shrinkOk?

Wido

> Thanks,
> Sailaja.M
>