Guozhonghua
2013-Sep-03 05:29 UTC
[libvirt-users] Is virsh blockcommit supported? Thanks a lot
I had test the command virsh blockcommit, but it failed, with the libvirt version 1.1.0, and qemu version 1.6.0. Is this feature being developing? Thanks root at cvk-31:/vms/images# virsh -v 1.1.0 root at cvk-31:/vms/images# qemu-img -V qemu-img version 1.6.0, Copyright (c) 2004-2008 Fabrice Bellard usage: qemu-img command [command options] root at cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1 --base /vms/image s/Vmtest1_base --top /vms/images/Vmtest1_base_1 --wait --verbose ;echo $? error: invalid argument: top '/vms/images/Vmtest1_base_1' in chain for '/vms/images/Vmtest1' has no backing file 1 root at cvk-31:/vms/images# qemu-img info /vms/images/Vmtest1_base_1 image: /vms/images/Vmtest1_base_1 file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 6.0M cluster_size: 2097152 backing file: /vms/images/Vmtest1_base root at cvk-31:/vms/images# qemu-img info --backing-chain /vms/images/Vmtest1 image: /vms/images/Vmtest1 file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 140M cluster_size: 2097152 backing file: /vms/images/Vmtest1_base_1 image: /vms/images/Vmtest1_base_1 file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 6.0M cluster_size: 2097152 backing file: /vms/images/Vmtest1_base image: /vms/images/Vmtest1_base file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 3.4G cluster_size: 2097152 root at cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1 --base /vms/image s/Vmtest1_base --wait --verbose ;echo $? error: invalid argument: could not find base '/vms/images/Vmtest1_base' below '/vms/images/Vmtest1' in chain for '/vms/images/Vmtest1' 1 root at cvk-31:/vms/images# ls -al /vms/images/Vmtest1_base -rw------- 1 root root 3705667584 Aug 23 10:19 /vms/images/Vmtest1_base root at cvk-31:/vms/images# qemu-img info /vms/images/Vmtest1_base image: /vms/images/Vmtest1_base file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 3.4G cluster_size: 2097152 ------------------------------------------------------------------------------------------------------------------------------------- ???????????????????????????????????????? ???????????????????????????????????????? ???????????????????????????????????????? ??? This e-mail and its attachments contain confidential information from H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130903/4ce3e549/attachment.htm>
Eric Blake
2013-Sep-03 15:46 UTC
Re: [libvirt-users] Is virsh blockcommit supported? Thanks a lot
[dropping libvir-list - this is a usage question, not a development question] On 09/02/2013 11:29 PM, Guozhonghua wrote:> I had test the command virsh blockcommit, but it failed, with the libvirt version 1.1.0, and qemu version 1.6.0. > Is this feature being developing? ThanksThe feature is supported, but you have to use it correctly. In particular, your backing chain MUST label the backing format of all backing files in the image metadata, or you must set 'allow_disk_format_probing' to 1 in /etc/libvirt/qemu.conf (be aware that doing so is a security risk if you use any raw images and have untrustworthy guests).> root@cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1 --base /vms/image > s/Vmtest1_base --top /vms/images/Vmtest1_base_1 --wait --verbose ;echo $? > error: invalid argument: top '/vms/images/Vmtest1_base_1' in chain for '/vms/images/Vmtest1' has no backing fileYour command line looks correct, so I suspect that what happened is that you failed to mark the format of Vmtest1_base_1 in Vmtest1, which means that libvirt is treating it as raw rather than qcow2; and raw files do not have backing images. I _really_ need to add a command to virsh that will show the entire backing chain, according to libvirt, as it would immensely help in debugging such issues.> root@cvk-31:/vms/images# qemu-img info --backing-chain /vms/images/Vmtest1 > image: /vms/images/Vmtest1 > file format: qcow2 > virtual size: 9.8G (10485760000 bytes) > disk size: 140M > cluster_size: 2097152 > backing file: /vms/images/Vmtest1_base_1Yep, my suspicion is confirmed - libvirt is treating Vmtest1_base_1 as raw instead of qcow2, because Vmtest1 has missing metadata. When done PROPERLY, this block would ALSO have the following line: backing file format: qcow2 How are you creating your backing chain? By hand with 'qemu-img create'? If so, be sure you pass the '-o backing_fmt=qcow2' option for any file that wraps another qcow2 file.> This e-mail and its attachments contain confidential information from H3C, which isThis list is publicly archived, rendering such a disclaimer unenforceable. It is considered poor netiquette to send from an employer's account if they tack on such legalese, and you may want to consider using a personal account instead. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Guozhonghua
2013-Sep-04 00:35 UTC
[libvirt-users] 答复: Is virsh blockcommit supported? Thanks a lot
Thanks a lot. :) I will check it and have a test on it. Guozhonghua -----邮件原件----- 发件人: Eric Blake [mailto:eblake@redhat.com] 发送时间: 2013年9月3日 23:47 收件人: guozhonghua 02084 抄送: libvirt-users@redhat.com 主题: Re: [libvirt-users] Is virsh blockcommit supported? Thanks a lot [dropping libvir-list - this is a usage question, not a development question] On 09/02/2013 11:29 PM, Guozhonghua wrote:> I had test the command virsh blockcommit, but it failed, with the libvirt version 1.1.0, and qemu version 1.6.0. > Is this feature being developing? ThanksThe feature is supported, but you have to use it correctly. In particular, your backing chain MUST label the backing format of all backing files in the image metadata, or you must set 'allow_disk_format_probing' to 1 in /etc/libvirt/qemu.conf (be aware that doing so is a security risk if you use any raw images and have untrustworthy guests).> root@cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1 > --base /vms/image s/Vmtest1_base --top /vms/images/Vmtest1_base_1 --wait --verbose ;echo $? > error: invalid argument: top '/vms/images/Vmtest1_base_1' in chain for > '/vms/images/Vmtest1' has no backing fileYour command line looks correct, so I suspect that what happened is that you failed to mark the format of Vmtest1_base_1 in Vmtest1, which means that libvirt is treating it as raw rather than qcow2; and raw files do not have backing images. I _really_ need to add a command to virsh that will show the entire backing chain, according to libvirt, as it would immensely help in debugging such issues.> root@cvk-31:/vms/images# qemu-img info --backing-chain > /vms/images/Vmtest1 > image: /vms/images/Vmtest1 > file format: qcow2 > virtual size: 9.8G (10485760000 bytes) disk size: 140M > cluster_size: 2097152 > backing file: /vms/images/Vmtest1_base_1Yep, my suspicion is confirmed - libvirt is treating Vmtest1_base_1 as raw instead of qcow2, because Vmtest1 has missing metadata. When done PROPERLY, this block would ALSO have the following line: backing file format: qcow2 How are you creating your backing chain? By hand with 'qemu-img create'? If so, be sure you pass the '-o backing_fmt=qcow2' option for any file that wraps another qcow2 file.> This e-mail and its attachments contain confidential information from > H3C, which isThis list is publicly archived, rendering such a disclaimer unenforceable. It is considered poor netiquette to send from an employer's account if they tack on such legalese, and you may want to consider using a personal account instead. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------------------------------------------------------------------------------------------------------------------------------------- 本邮件及其附件含有杭州华三通信技术有限公司的保密信息,仅限于发送给上面地址中列出 的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、 或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本 邮件! This e-mail and its attachments contain confidential information from H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
Guozhonghua
2013-Sep-04 00:56 UTC
[libvirt-users] Is virsh blockcommit supported? Thanks a lot
Hi, I have another question, when I do the blockcommit command and get the result " Top image as the active layer is currently unsupported ", is it being developed? root@cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1;echo $? error: internal error unable to execute QEMU command 'block-commit': Top image as the active layer is currently unsupported 1 But as I specified the commit file which is not the current image file, it will be work, such as below: root@cvk-31:/vms/images# qemu-img info --backing-chain /vms/images/Vmtest1 image: /vms/images/Vmtest1 file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 18M cluster_size: 65536 backing file: /vms/images/Vmtest1_base_1 backing file format: qcow2 image: /vms/images/Vmtest1_base_1 file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 196K cluster_size: 65536 backing file: /vms/images/Vmtest1_base backing file format: qcow2 image: /vms/images/Vmtest1_base file format: qcow2 virtual size: 9.8G (10485760000 bytes) disk size: 3.4G cluster_size: 2097152 root@cvk-31:/vms/images# virsh blockcommit Vmtest /vms/images/Vmtest1 --base /vms/images/Vmtest1_base --top /vms/images/Vmtest1_base_1 --wait --verbose;echo $? Block Commit: [100 %] Commit complete 0 ------------------------------------------------------------------------------------------------------------------------------------- 本邮件及其附件含有杭州华三通信技术有限公司的保密信息,仅限于发送给上面地址中列出 的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、 或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本 邮件! This e-mail and its attachments contain confidential information from H3C, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!