Description of problem ---------------------- When trying to import a disk image (which is _not_ named as f20btrfs.qcow2) via `virt-install`, it throws a useless error: ERROR cannot stat file '/var/lib/libvirt/images/f20btrfs.qcow2': No such file or directory NB: A guest named 'f20btrfs' _used_ to exist on this host, however it was undefined, and its log file and image removed from the file system: $ find / -name *f20btrfs.qcow2* $ echo $? 0 Version ------- $ uname -r; rpm -q libvirt-daemon-kvm qemu-system-x86 libguestfs 3.14.0-0.rc1.git3.1.fc21.x86_64 libvirt-daemon-kvm-1.2.1-2.fc21.x86_64 qemu-system-x86-1.7.0-4.fc21.x86_64 libguestfs-1.25.29-1.fc21.x86_64 How reproducible: Consistently. Steps to reproduce ------------------ 1. Install the guest: $ virt-builder fedora-20 --size 40G 2. Import it: $ virt-install --name devstack --ram 10240 \ --disk path=/root/fedora-20.img --import ERROR cannot stat file '/var/lib/libvirt/images/f20btrfs.qcow2': No such file or directory Actual results -------------- Invoke `virt-install` with debug (-d) to the stack trace: $ virt-install -d --name devstack1 --ram 10240 \ --disk path=/root/fedora-20.img --import [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (cli:217) Launched with command line: /usr/share/virt-manager/virt-install -d --name devstack1 -- ram 10240 --disk path=/root/fedora-20.img --import [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (cli:225) Requesting libvirt URI default [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (cli:229) Received libvirt URI qemu:///system [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (virt-install:279) Requesting virt method 'default', hv type 'default'. [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (virt-install:489) Received virt method 'kvm' [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (virt-install:490) Hypervisor name is 'hvm' [Wed, 12 Feb 2014 10:54:26 virt-install 20902] DEBUG (cli:702) DISPLAY is not set: defaulting to nographics. [Wed, 12 Feb 2014 10:54:27 virt-install 20902] ERROR (cli:264) cannot stat file '/var/lib/libvirt/images/f20btrfs.qcow2': No such file or directory [Wed, 12 Feb 2014 10:54:27 virt-install 20902] DEBUG (cli:266) Traceback (most recent call last): File "/usr/share/virt-manager/virt-install", line 1073, in <module> sys.exit(main()) File "/usr/share/virt-manager/virt-install", line 1058, in main guest = build_guest_instance(conn, options) File "/usr/share/virt-manager/virt-install", line 554, in build_guest_instance get_disks(guest, options.diskopts, options.nodisks, need_storage) File "/usr/share/virt-manager/virt-install", line 150, in get_disks d = cli.disk_prompt(guest.conn, path, size, sparse, origdev=dev) File "/usr/share/virt-manager/virtinst/cli.py", line 555, in disk_prompt if prompt_inuse_conflict(dev): File "/usr/share/virt-manager/virtinst/cli.py", line 491, in prompt_inuse_conflict names = dev.is_conflict_disk(conn) File "/usr/share/virt-manager/virtinst/devicedisk.py", line 803, in is_conflict_disk check_conflict=check_conflict) File "/usr/share/virt-manager/virtinst/devicedisk.py", line 349, in path_in_use_by for vol in conn.fetch_all_vols(): File "/usr/share/virt-manager/virtinst/connection.py", line 232, in fetch_all_vols return self._fetch_all_vols_cached() File "/usr/share/virt-manager/virtinst/connection.py", line 220, in _fetch_all_vols_cached for obj in vols.values()] File "/usr/lib64/python2.7/site-packages/libvirt.py", line 2985, in XMLDesc if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed', vol=self) libvirtError: cannot stat file '/var/lib/libvirt/images/f20btrfs.qcow2': No such file or directory Expected results ---------------- virt-install should import the guest image successfully. Additonal details ----------------- - virt-builder stderr: $ virt-builder fedora-20 --size 40G [ 1.0] Downloading: http://libguestfs.org/download/builder/fedora-20.xz [ 3.0] Planning how to build this image [ 3.0] Uncompressing [ 8.0] Resizing (using virt-resize) to expand the disk to 40.0G [ 107.0] Opening the new disk [ 118.0] Setting a random seed [ 118.0] Setting random root password [did you mean to use --root-password?] Setting random password of root to fNkYwtyeuPpTp47o [ 118.0] Finishing off Output: fedora-20.img Output size: 40.0G Output format: raw Total usable space: 38.6G Free space: 38.0G (98%) - Details of the image being imported (no backing file or any such): $ qemu-img info --backing-chain fedora-20.img image: fedora-20.img file format: raw virtual size: 40G (42949672960 bytes) disk size: 824M - As I noted in the Description, there's no trace of 'f20btrfs' the guest image in usual locations: $ ls /var/lib/libvirt/images/ | grep f20btrfs $ ls /var/lib/libvirt/qemu/snapshot/ | grep f20btrfs
Forgot to note 'virt-install' package version: $ rpm -q virt-install virt-install-0.10.0-5.git1ffcc0cc.fc21.noarch
Ok, I made an elementary UNIX permissions mistake, /root has: -rwx------- So, obviously it doesn't let QEMU to access disk image files located in that directory. Moving the guest image to elsewhere, and importing the image works just fine. Reminder to self: Do not use /root for _anything_ (thanks to DanPB for correction!) But still I wonder why was it trying to _stat_ a non-existent file. Is that a legitimate error?
Things like that have happened before, if the image is removed but the containing pool is not 'refreshed': $ touch /mnt/data/devel/images/foo $ sudo virsh pool-refresh default Pool default refreshed $ rm /mnt/data/devel/images/foo $ sudo virsh vol-dumpxml --pool default foo error: cannot stat file '/mnt/data/devel/images/foo': No such file or directory virt-install is supposed to be avoiding this case though, I'll try to reproduce
Fixed upstream now: commit a808bd669293ac66047a716b2e84a5a64c99667b Author: Cole Robinson <crobinso> Date: Wed Feb 12 13:57:44 2014 -0500 connection: Handle volume XMLDesc errors (bz 1064275) This commonly happens when a file is deleted from a storage pool behind libvirt's back.