Bug 1445198

Summary: virt-install cannot create a new image by source/volume path format
Product: Red Hat Enterprise Linux 7 Reporter: zhoujunqin <juzhou>
Component: virt-managerAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: crobinso, kuwei, mxie, tzheng, xiaodwan, yualiu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.4.1-3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 21:04:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhoujunqin 2017-04-25 08:56:57 UTC
Description of problem:
virt-install cannot create a new image by source/volume path format

Version-Release number of selected component (if applicable):
virt-install-1.4.1-2.el7.noarch
libvirt-3.2.0-3.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Check --disk supporting option.
# virt-install --disk ?
--disk options:
  address.base
  address.bus
  address.controller
  address.cssid
  address.devno
  address.domain
  address.function
  address.iobase
  address.irq
  address.multifunction
  address.port
  address.reg
  address.slot
  address.ssid
  address.target
  address.type
  address.unit
  backing_format
  backing_store
  boot_order
  bus
  cache
  clearxml
  device
  discard
  driver_name
  driver_type
  error_policy
  format
  io
  path
  pool
  read_bytes_sec
  read_iops_sec
  readonly
  removable
  seclabel[0-9]*.label
  seclabel[0-9]*.model
  seclabel[0-9]*.relabel
  serial
  sgio
  shareable
  size
  source_host_name
  source_host_port
  source_host_socket
  source_host_transport
  source_name
  source_pool <-----
  source_protocol
  source_volume<-----
  sparse
  startup_policy
  target
  total_bytes_sec
  total_iops_sec
  vol
  write_bytes_sec
  write_iops_sec

2. Install a vm with a non-existing image.
# virsh pool-refresh default
Pool default refreshed

# virsh vol-list --pool default
 Name                 Path                                    
------------------------------------------------------------------------------
 rhel6.8.qcow2        /var/lib/libvirt/images/rhel6.8.qcow2   
 rhel6.9.qcow2        /var/lib/libvirt/images/rhel6.9.qcow2   
 rhel7.3.qcow2        /var/lib/libvirt/images/rhel7.3.qcow2   


# virt-install --name demo1 --memory 1024 --connect qemu:///system --disk source_pool=default,source_volume=demo1,size=10000000000 -l http://download.eng.pek2.redhat.com/pub/rhel/released/RHEL-6/6.9/Server/x86_64/os/
ERROR    Error: --disk source_pool=default,source_volume=demo1,size=10000000000: Device type 'disk' requires a path

Actual results:
1) Error message is not clear, in fact i have give a path.
2) virt-install cannot create a new image by source/volume.

Expected results:
Fix it.

Additional info:

Comment 2 Cole Robinson 2017-04-27 19:48:48 UTC
We should report a better error when storage vol lookup fails (like when passed a non-existent volume). I've fixed this upstream now:

commit 7a4acfcd0cd9fa300fbbc0551cd5c20000b8d583
Author: Cole Robinson <crobinso>
Date:   Thu Apr 27 15:44:46 2017 -0400

    devicedisk: Raise proper error on invalid source_volume (bz 1445198)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1445198


But otherwise I don't think we should bother trying to make source_pool/volume parameters work with storage creation, I don't really see the point

Comment 5 zhoujunqin 2017-05-05 06:55:50 UTC
Try to verify this bug with new package version:
virt-manager-1.4.1-3.el7.noarch
virt-manager-common-1.4.1-3.el7.noarch
virt-install-1.4.1-3.el7.noarch

Steps:
Try to install a with a non-existing image using source pool/volume disk path format.(Using default pool)

# virsh pool-refresh default
Pool default refreshed

# virsh vol-list --pool default
 Name                 Path                                    
------------------------------------------------------------------------------
 cachea.img           /var/lib/libvirt/images/cachea.img      
 myVm2raw.img         /var/lib/libvirt/images/myVm2raw.img    
 rhel6.9r.qcow2       /var/lib/libvirt/images/rhel6.9r.qcow2  
 rhel7.3-clone.qcow2  /var/lib/libvirt/images/rhel7.3-clone.qcow2
 rhel7.3.qcow2        /var/lib/libvirt/images/rhel7.3.qcow2   
 test.img             /var/lib/libvirt/images/test.img        
 test.qed             /var/lib/libvirt/images/test.qed        

# virt-install --name demo1 --memory 1024 --connect qemu:///system --disk source_pool=default,source_volume=demo1,size=10000000000 -l http://download.eng.pek2.redhat.com/pub/rhel/released/RHEL-6/6.9/Server/x86_64/os/
ERROR    Error: --disk source_pool=default,source_volume=demo1,size=10000000000: Storage volume not found: no storage vol with matching name 'demo1'

Also tested with non-existing pool:
# virt-install --name demo1 --memory 1024 --connect qemu:///system --disk source_pool=defaultttttttttttttt,source_volume=testztetst,size=10000000000 -l http://download.eng.pek2.redhat.com/pub/rhel/released/RHEL-6/6.9/Server/x86_64/os/
ERROR    Error: --disk source_pool=defaultttttttttttttt,source_volume=testztetst,size=10000000000: Storage pool not found: no storage pool with matching name 'defaultttttttttttttt'

Result:
When install a guest with a non-exiting volume/pool, installation failed with clear error to user, so move this bug from ON_QA to VERIFIED.

Comment 6 errata-xmlrpc 2017-08-01 21:04:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2072