Bug 1321302 - Output allocation mode always is preallocated when using virt-v2v convert guest to openstack with setting disk type as raw
Summary: Output allocation mode always is preallocated when using virt-v2v convert gue...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-25 10:15 UTC by mxie@redhat.com
Modified: 2016-03-29 07:50 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-29 07:50:53 UTC
Target Upstream Version:


Attachments (Terms of Use)
default-raw.log (577.76 KB, text/plain)
2016-03-25 10:15 UTC, mxie@redhat.com
no flags Details
qcow2-raw.log (836.73 KB, text/plain)
2016-03-25 10:17 UTC, mxie@redhat.com
no flags Details

Description mxie@redhat.com 2016-03-25 10:15:44 UTC
Created attachment 1140295 [details]
default-raw.log

Description of problem:
Output allocation mode always is preallocated when using virt-v2v convert guest to openstack with setting disk type as raw

Version-Release number of selected component (if applicable):
virt-v2v-1.32.3-1.el7.x86_64
libguestfs-1.32.3-1.el7.x86_64
libvirt-1.3.2-1.el7.x86_64
qemu-kvm-1.5.3-109.el7.x86_64
spice-gtk-0.26-7.el7.x86_64
usbredir-0.6-8.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

Scenario1:
1.Prepare a guest, the disk type is "raw"
# qemu-img info /var/lib/libvirt/images/rhel5.11-mxie-sda 
image: /var/lib/libvirt/images/rhel5.11-mxie-sda
file format: raw
virtual size: 6.0G (6442450944 bytes)
disk size: 2.7G

2.Using virt-v2v convert guest to openstack with setting disk type as "raw" and without setting output allocate mode,details pls refer to log "default-raw.log"
# virt-v2v rhel5.11-mxie -on default-raw -o glance -of raw 
[   0.0] Opening the source -i libvirt rhel5.11-mxie
[   0.0] Creating an overlay to protect the source from being modified
[   0.3] Initializing the target -o glance
[   4.4] Opening the overlay
[   7.2] Inspecting the overlay
[  12.3] Checking for sufficient free disk space in the guest
[  12.3] Estimating space required on target for each disk
[  12.3] Converting Red Hat Enterprise Linux Server release 5.11 (Tikanga) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  22.2] Mapping filesystem data to avoid copying unused and blank areas
[  22.4] Closing the overlay
[  22.4] Checking if the guest needs BIOS or UEFI to boot
[  22.4] Assigning disks to buses
[  22.4] Copying disk 1/1 to /var/tmp/glance.Chzy72/sda (raw)
    (100.00/100%)
[  97.9] Creating output metadata
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | db789ec06a608f4b0974b798b346739f     |
| container_format | bare                                 |
| created_at       | 2016-03-25T09:06:18.000000           |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | raw                                  |
| id               | 958ba435-5487-44b8-a23e-039e6c242361 |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | default-raw                          |
| owner            | 6c4dac53186d44fcbac29d3f3f575125     |
| protected        | False                                |
| size             | 6442450944                           |
| status           | active                               |
| updated_at       | 2016-03-25T09:07:39.000000           |
| virtual_size     | None                                 |
+------------------+--------------------------------------+
+----------------------------+--------------------------------------+
| Property                   | Value                                |
+----------------------------+--------------------------------------+
| Property 'architecture'    | x86_64                               |
| Property 'hw_disk_bus'     | virtio                               |
| Property 'hw_vif_model'    | virtio                               |
| Property 'hypervisor_type' | kvm                                  |
| Property 'os_distro'       | rhel                                 |
| Property 'os_type'         | linux                                |
| Property 'os_version'      | 5.11                                 |
| Property 'vm_mode'         | hvm                                  |
| checksum                   | db789ec06a608f4b0974b798b346739f     |
| container_format           | bare                                 |
| created_at                 | 2016-03-25T09:06:18.000000           |
| deleted                    | False                                |
| deleted_at                 | None                                 |
| disk_format                | raw                                  |
| id                         | 958ba435-5487-44b8-a23e-039e6c242361 |
| is_public                  | False                                |
| min_disk                   | 0                                    |
| min_ram                    | 1024                                 |
| name                       | default-raw                          |
| owner                      | 6c4dac53186d44fcbac29d3f3f575125     |
| protected                  | False                                |
| size                       | 6442450944                           |
| status                     | active                               |
| updated_at                 | 2016-03-25T09:07:45.000000           |
| virtual_size               | None                                 |
+----------------------------+--------------------------------------+
[ 188.7] Finishing off

3.After conversion, check the guest's image info on openstack

3.1 Login openstack/dashboard

3.2 Get guest image ID on openstack
Image Overview Information
Name:default-raw
ID:958ba435-5487-44b8-a23e-039e6c242361
Owner:6c4dac53186d44fcbac29d3f3f575125

3.3 check the guest's image info on openstack
# qemu-img info /var/lib/glance/images/958ba435-5487-44b8-a23e-039e6c242361 
image: 958ba435-5487-44b8-a23e-039e6c242361
file format: raw
virtual size: 6.0G (6442450944 bytes)
disk size: 6.0G

4.Find that the default output allocation mode is preallocated when using virt-v2v convert guest to openstack with setting disk type as "raw"




Scenario2:
1.Prepare a guest,the disk type is "qcow2"
# qemu-img info rhel7.2-snap4.qcow2
image: rhel7.2-snap4.qcow2
file format: qcow2
virtual size: 6.0G (6442450944 bytes)
disk size: 3.2G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: true

2.Using virt-v2v convert guest to openstack with setting disk type as "raw" and output allocate mode as "sparse", details pls refer to "qcow2-raw.log"
# virt-v2v rhel7.2-snap4 -on qcow2-raw-sparse -o glance -of raw -oa sparse
[   0.1] Opening the source -i libvirt rhel7.2-snap4
[   0.1] Creating an overlay to protect the source from being modified
[   0.7] Initializing the target -o glance
[   1.3] Opening the overlay
[   4.5] Inspecting the overlay
[  18.7] Checking for sufficient free disk space in the guest
[  18.7] Estimating space required on target for each disk
[  18.7] Converting Red Hat Enterprise Linux Server 7.2 Beta (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[  66.4] Mapping filesystem data to avoid copying unused and blank areas
[  66.9] Closing the overlay
[  67.2] Checking if the guest needs BIOS or UEFI to boot
[  67.2] Assigning disks to buses
[  67.2] Copying disk 1/1 to /var/tmp/glance.hI3x2X/sda (raw)
    (100.00/100%)
[ 158.2] Creating output metadata
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | d625eb1d822fa2683db6260ed303a973     |
| container_format | bare                                 |
| created_at       | 2016-03-25T09:32:18.000000           |
| deleted          | False                                |
| deleted_at       | None                                 |
| disk_format      | raw                                  |
| id               | bfe0d51a-6a86-451a-aef7-35286b8ce63a |
| is_public        | False                                |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | qcow2-raw-sparse                     |
| owner            | 6c4dac53186d44fcbac29d3f3f575125     |
| protected        | False                                |
| size             | 6442450944                           |
| status           | active                               |
| updated_at       | 2016-03-25T09:33:42.000000           |
| virtual_size     | None                                 |
+------------------+--------------------------------------+
Multiple image matches found for 'qcow2-raw-sparse', use an ID to be more specific.
virt-v2v: warning: glance: failed to set image properties (ignored)
Image properties:
  --min-ram 1024
  --property 'os_version'='7.2'  --property 'hw_disk_bus'='virtio'  --property 'hw_vif_model'='virtio'  --property 'architecture'='x86_64'  --property 'hypervisor_type'='kvm'  --property 'vm_mode'='hvm'  --property 'os_type'='linux'  --property 'os_distro'='rhel'[ 247.8] Finishing off


3.After conversion, check the guest's image info on openstack
3.1 Login openstack/dashboard

3.2 Get guest image ID on openstack
Image Overview Information
Name:qcow2-raw-sparse
ID:bfe0d51a-6a86-451a-aef7-35286b8ce63a 
Owner:6c4dac53186d44fcbac29d3f3f575125

3.3 check the guest's image info on openstack
#qemu-img info /var/lib/glance/images/bfe0d51a-6a86-451a-aef7-35286b8ce63a 
image: bfe0d51a-6a86-451a-aef7-35286b8ce63a 
file format: raw
virtual size: 6.0G (6442450944 bytes)
disk size: 6.0G


4.Find that the output allocation mode is preallocated even if set -oa as "sparse" when using virt-v2v convert guest to openstack with setting disk type as "raw"


Actual results:
As above description

Expected results:
1.The default output allocation mode should be sparse when using virt-v2v convert guest to openstack with setting disk type as raw
2.The output allocation mode should be sparse if set -oa as "sparse" when using virt-v2v convert guest to openstack with setting disk type as "raw"


Addtional info:
There is no problem when using virt-v2v convert guest to openstack with setting disk type as qcow2
1.The default output allocation mode is sparse when using virt-v2v convert guest to openstack with setting disk type as qcow2
2.The output allocation mode is sparse if set -oa as "sparse" when using virt-v2v convert guest to openstack with setting disk type as "qcow2"
3.The output allocation mode is preallocated if set -oa as "preallocated" when using virt-v2v convert guest to openstack with setting disk type as "qcow2"

Comment 1 mxie@redhat.com 2016-03-25 10:17:11 UTC
Created attachment 1140296 [details]
qcow2-raw.log

Comment 2 Richard W.M. Jones 2016-03-25 10:21:37 UTC
This is a bug in glance - it doesn't preserve sparseness.

You can try to use '-of qcow2'.  Since qcow2 doesn't require
sparseness to be preserved, the resulting image in glance will
be smaller.

We document this problem in the manual already:
http://libguestfs.org/virt-v2v.1.html#glance-and-sparseness
so I don't think this is a bug in libguestfs.  (It is certainly
a bug in glance however!)

Comment 4 mxie@redhat.com 2016-03-28 11:28:35 UTC
(In reply to Richard W.M. Jones from comment #2)
> This is a bug in glance - it doesn't preserve sparseness.
> 
> You can try to use '-of qcow2'.  Since qcow2 doesn't require
> sparseness to be preserved, the resulting image in glance will
> be smaller.
> 
> We document this problem in the manual already:
> http://libguestfs.org/virt-v2v.1.html#glance-and-sparseness
> so I don't think this is a bug in libguestfs.  (It is certainly
> a bug in glance however!)

Hi Richard,

Thanks for your reply, yes, it is the openstack bug rather than virt-v2v, could you provide bug ID about openstack doesn't preserve sparseness for us further tracking which I didn't find in bugzilla.

Comment 5 tingting zheng 2016-03-29 02:26:23 UTC
(In reply to mxie@redhat.com from comment #4)
> (In reply to Richard W.M. Jones from comment #2)
> > This is a bug in glance - it doesn't preserve sparseness.
> > 
> > You can try to use '-of qcow2'.  Since qcow2 doesn't require
> > sparseness to be preserved, the resulting image in glance will
> > be smaller.
> > 
> > We document this problem in the manual already:
> > http://libguestfs.org/virt-v2v.1.html#glance-and-sparseness
> > so I don't think this is a bug in libguestfs.  (It is certainly
> > a bug in glance however!)
> 
> Hi Richard,
> 
> Thanks for your reply, yes, it is the openstack bug rather than virt-v2v,
> could you provide bug ID about openstack doesn't preserve sparseness for us
> further tracking which I didn't find in bugzilla.

I think Richard means the bug you file is an openstack bug instead of virt-v2v.

Comment 6 Richard W.M. Jones 2016-03-29 07:50:53 UTC
The glance bug is this one:
https://bugs.launchpad.net/glance-store/+bug/810493

I'm closing the current bug as this is a known issue in
glance that can't be solved in virt-v2v, and in any case it
is already documented in the virt-v2v manual page.


Note You need to log in before you can comment on or make changes to this bug.