Thanks Marcus for the info.
> -----Original Message----- > From: Marcus Sorensen [mailto:shadow...@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 <rajesh.batt...@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:shadow...@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 > >> <rajesh.batt...@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:shadow...@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 > >> >> <rajesh.batt...@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:w...@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:w...@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 > >> >> >> >>> <w...@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 > >> >> >> >>>>> > >> >> >> >>>> > >> >> >> > [] > >> >> >> >