Bug 1661683 - virt-install mis-setting driver type to raw when import qcow2
Summary: virt-install mis-setting driver type to raw when import qcow2
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-22 04:24 UTC by Robert Wang
Modified: 2022-06-29 08:06 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-03-26 21:19:59 UTC
Embargoed:


Attachments (Terms of Use)

Description Robert Wang 2018-12-22 04:24:07 UTC
Description of problem:
when create kvm vm by importing the qcow2 base disk, it setup type raw to driver type

Version-Release number of selected component (if applicable):
# virt-install --version
1.5.0

virt-install.noarch                     1.5.0-1.el7                    @base

How reproducible:

Steps to Reproduce:
1.generate qcow2 base image by virt-builder 

virt-builder centos-7.6 \
--format qcow2 \
--size 20G -o /var/lib/libvist/boot/centos-7.6-20G.qcow2 

2.copy base image disk to vm disk

cp /var/lib/libvist/boot/centos-7.6-20G.qcow2 /var/lib/libvist/images/testvm.qcow2

3.create vm testvm by importing qcow2 base disk, 

virt-install --import --name testvm2 \
--ram 1024 \
--vcpu 1 \
--disk path=/var/lib/libvist/images/testvm.qcow2,device=disk,format=qcow2 \
--nographics --serial=pty --os-type=linux --os-variant rhel7 \
--noautoconsole --noreboot

Actual results:
the testvm driver type is raw instead of qcow2

# virsh dumpxml testvm|grep driver
      <driver name='qemu' type='raw'/>

in this case, cannot start up vm

Expected results:

# virsh dumpxml testvm|grep driver
      <driver name='qemu' type='qcow2'/>

Additional info:

as remedy, change driver type to qcow2 then start up vm.

virsh edit testvm

Comment 1 Cole Robinson 2019-01-10 18:04:19 UTC
You are using an older version of virt-install so I won't be able to fix that, but maybe we can identify what's going wrong.

Please provide:
- qemu-img info /var/lib/libvist/images/testvm.qcow2
- full virt-install --debug output when reproducing

Comment 2 Luis Smith 2022-06-21 20:51:36 UTC
I'm getting the same issue with virt-install-3.2.0-4.el8.noarch (libvirt-client-8.0.0-5.module+el8.6.0+847+b490afdd.x86_64)

To answer the questions that were asked to Robert (with identifying info scrubbed):

qemu-img info /path/to/testvm.qcow2:
image: /path/to/testvm.qcow2
file format: qcow2
virtual size: 99 GiB (106300440576 bytes)
disk size: 52.5 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

virt-install --import --name deploy-ex40 \
--ram 4096 --vcpus 4 --cpu host --os-type linux \
--os-variant rocky8-unknown  --network network=default \
--disk /path/to/testvm.qcow2,format=qcow2 --debug

Debug output:
[Tue, 21 Jun 2022 20:42:18 virt-install 930301] DEBUG (cli:204) Launched with command line: /bin/virt-install --name deploy-ex --ram 4096 --vcpus 4 --cpu host --os-type linux --os-variant rocky8-unknown --network network=default --disk /path/to/testvm.qcow2,format=qcow2 --import --noautoconsole --debug
[Tue, 21 Jun 2022 20:42:18 virt-install 930301] DEBUG (virtinstall:212) Distilled --network options: ['network=default']
[Tue, 21 Jun 2022 20:42:18 virt-install 930301] DEBUG (virtinstall:144) Distilled --disk options: ['/path/to/testvm.qcow2,format=qcow2']
[Tue, 21 Jun 2022 20:42:18 virt-install 930301] DEBUG (cli:216) Requesting libvirt URI default
[Tue, 21 Jun 2022 20:42:18 virt-install 930301] DEBUG (cli:219) Received libvirt URI qemu:///system
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (guest:320) Setting Guest osinfo name <_OsVariant name=generic>
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (guest:320) Setting Guest osinfo name <_OsVariant name=rocky8-unknown>
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (installer:542) No media for distro detection.
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (installer:544) installer.detect_distro returned=None
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (osdict:345) No recommended value found for key='n-cpus', using minimum=1 * 2
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (disk:242) DeviceDisk.check_path_search path=/path/to/testvm.qcow2
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (cli:265)
Starting install...

Starting install...
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (installer:600) Generated install XML: None required
[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (installer:601) Generated boot XML:
<domain type="kvm">
  <name>deploy-ex</name>
  <uuid>bd204f14-511e-48aa-a75f-01e71128c12e</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://rockylinux.org/rocky/8-unknown"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory>4194304</memory>
  <currentMemory>4194304</currentMemory>
  <vcpu>4</vcpu>
  <os>
    <type arch="x86_64" machine="q35">hvm</type>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode="host-model"/>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
  </clock>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type="file" device="disk">
      <driver name="qemu"/>
      <source file="/path/to/testvm.qcow2"/>
      <target dev="vda" bus="virtio"/>
    </disk>
    <controller type="usb" model="qemu-xhci" ports="15"/>
    <interface type="network">
      <source network="default"/>
      <mac address="52:54:00:b6:ff:1a"/>
      <model type="virtio"/>
    </interface>
    <console type="pty"/>
    <channel type="unix">
      <source mode="bind"/>
      <target type="virtio" name="org.qemu.guest_agent.0"/>
    </channel>
    <input type="tablet" bus="usb"/>
    <graphics type="vnc" port="-1" listen="0.0.0.0"/>
    <video>
      <model type="vga"/>
    </video>
    <memballoon model="virtio"/>
    <rng model="virtio">
      <backend model="random">/dev/urandom</backend>
    </rng>
  </devices>
</domain>

[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (installer:655) XML fetched from libvirt object:
<domain type='kvm' id='1'>
  <name>deploy-ex</name>
  <uuid>bd204f14-511e-48aa-a75f-01e71128c12e</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://rockylinux.org/rocky/8-unknown"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-rhel8.6.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Skylake-Client-IBRS</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='vmx'/>
    <feature policy='require' name='pdcm'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='umip'/>
    <feature policy='require' name='md-clear'/>
    <feature policy='require' name='stibp'/>
    <feature policy='require' name='arch-capabilities'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='xsaves'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='ibpb'/>
    <feature policy='require' name='ibrs'/>
    <feature policy='require' name='amd-stibp'/>
    <feature policy='require' name='amd-ssbd'/>
    <feature policy='require' name='skip-l1dfl-vmentry'/>
    <feature policy='require' name='pschange-mc-no'/>
    <feature policy='disable' name='mpx'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/path/to/testvm.qcow2' index='1'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0x15'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0x16'/>
      <alias name='pci.7'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x6'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:b6:ff:1a'/>
      <source network='default' portid='476dfa26-83c7-47e0-965c-b1dd3373145a' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/7'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/7'>
      <source path='/dev/pts/7'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-1-deploy-ex/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='vga' vram='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
    <rng model='virtio'>
      <backend model='random'>/dev/urandom</backend>
      <alias name='rng0'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </rng>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c316,c515</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c316,c515</imagelabel>
  </seclabel>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+107:+107</label>
    <imagelabel>+107:+107</imagelabel>
  </seclabel>
</domain>

[Tue, 21 Jun 2022 20:42:19 virt-install 930301] DEBUG (cli:265) Domain creation completed.
Domain creation completed.

Comment 3 Daniel Berrangé 2022-06-29 08:06:30 UTC
Please don't add comments on bugs closed years ago. Please file a new bug report, and if you think this old one is relevant just mention that as a link in the new bug report.


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