#630478 Problem with size of virtual floppies

#630478#5
Date:
2011-06-11 15:46:35 UTC
From:
To:
virt-install appears to convert existing  disk image files sizes to
gigabytes at around line 650 of VirtualDisk.py which has this code:
	newsize = float(newsize) / 1024.0 / 1024.0 / 1024.0
Even with floppy disk images. Whether the above assumption is actually what happens, the
consequence is that I get this error:
[Sat, 11 Jun 2011 22:02:46 virt-install 32253] DEBUG (virt-install:330) parse_disk: returning {'format': None, 'bus': None, 'readOnly': True, 'volInstall': None, 'path': '/var/lib/libvirt/images/fd.img', 'device': 'floppy', 'volName': None, 'conn': <libvirt.virConnect instance at 0x2402998>, 'size': None, 'driverCache': None, 'shareable': False, 'sparse': True}
[Sat, 11 Jun 2011 22:02:47 virt-install 32253] DEBUG (VirtualDisk:860) Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'fd.img'.
[Sat, 11 Jun 2011 22:02:47 virt-install 32253] ERROR (cli:196) Error with storage parameters: Size must be specified for non existent volume path '/var/lib/libvirt/images/fd.img'
[Sat, 11 Jun 2011 22:02:47 virt-install 32253] DEBUG (_util:221) Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/virtinst/cli.py", line 480, in disk_prompt
    dev = VirtualDisk(**arg_dict)
  File "/usr/lib/pymodules/python2.6/virtinst/VirtualDisk.py", line 437, in __init__
    self.__validate_params()
  File "/usr/lib/pymodules/python2.6/virtinst/VirtualDisk.py", line 946, in __validate_params
    self.__check_if_path_managed()
  File "/usr/lib/pymodules/python2.6/virtinst/VirtualDisk.py", line 864, in __check_if_path_managed
    "existent volume path '%s'" % self.path))
ValueError: Size must be specified for non existent volume path '/var/lib/libvirt/images/fd.img'

This is the actual file:
-rw-r--r-- 1 root root 1474560 Jun 11 21:46 /var/lib/libvirt/images/fd.img

Note that this floppy image was okay in the RHEL6 beta where I created it ans used it for several Debian Squeeze installs using python-virtinst-0.500.3-7.el6.noarch or (slightly) earlier.

Note, if the disk image is missing, this message arises:
ERROR    A size must be specified for non-existent disks.

It does not identify the problem file, and the text is slightly different although the meaning,
it seems, is the same.

#630478#10
Date:
2011-07-07 17:21:59 UTC
From:
To:
Can you provide the full output of running this command with --debug?
Also, what's the output of

virsh --connect qemu:///system vol-list default

#630478#15
Date:
2011-07-07 17:21:59 UTC
From:
To:
Can you provide the full output of running this command with --debug?
Also, what's the output of

virsh --connect qemu:///system vol-list default

#630478#20
Date:
2011-08-07 02:44:58 UTC
From:
To:
It's not hard to reproduce, this does it:
  dd if=/dev/zero of=/var/lib/libvirt/images/fd1440.img count=2880
  /usr/bin/virt-install -n dummy  -r 192 --arch=i686 --vcpus=1 --os-type=linux --os-variant=debiansqueeze  --disk path=/var/lib/libvirt/images/fd1440.img,device=floppy --noreboot --pxe

~#  /usr/bin/virt-install -n dummy  -r 192 --arch=i686 --vcpus=1 --os-type=linux --os-variant=debiansqueeze  --disk path=/var/lib/libvirt/images/fd1440.img,device=floppy --noreboot --pxe --debug 2>&1 | tee /tmp/virt
Sun, 07 Aug 2011 10:42:23 DEBUG    Launched with command line:
/usr/bin/virt-install -n dummy -r 192 --arch=i686 --vcpus=1 --os-type=linux --os-variant=debiansqueeze --disk path=/var/lib/libvirt/images/fd1440.img,device=floppy --noreboot --pxe --debug
Sun, 07 Aug 2011 10:42:23 DEBUG    Requesting libvirt URI default
Sun, 07 Aug 2011 10:42:23 DEBUG    Received libvirt URI qemu:///system
Sun, 07 Aug 2011 10:42:23 DEBUG    Requesting virt method 'default', hv type 'default'.
Sun, 07 Aug 2011 10:42:23 DEBUG    Received virt method 'hvm'
Sun, 07 Aug 2011 10:42:23 DEBUG    Hypervisor name is 'kvm'
Sun, 07 Aug 2011 10:42:23 DEBUG    parse_disk: returning {'format': None, 'bus': None, 'readOnly': False, 'volInstall': None, 'path': '/var/lib/libvirt/images/fd1440.img', 'device': 'floppy', 'volName': None, 'conn': <libvirt.virConnect instance at 0x1ae5908>, 'size': None, 'driverCache': None, 'shareable': False, 'sparse': True}
Sun, 07 Aug 2011 10:42:23 DEBUG    Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'fd1440.img'.
Sun, 07 Aug 2011 10:42:23 ERROR    Error with storage parameters: Size must be specified for non existent volume path '/var/lib/libvirt/images/fd1440.img'
Sun, 07 Aug 2011 10:42:23 DEBUG    Traceback (most recent call last):
   File "/usr/lib/pymodules/python2.6/virtinst/cli.py", line 480, in disk_prompt
     dev = VirtualDisk(**arg_dict)
   File "/usr/lib/pymodules/python2.6/virtinst/VirtualDisk.py", line 437, in __init__
     self.__validate_params()
   File "/usr/lib/pymodules/python2.6/virtinst/VirtualDisk.py", line 946, in __validate_params
     self.__check_if_path_managed()
   File "/usr/lib/pymodules/python2.6/virtinst/VirtualDisk.py", line 864, in __check_if_path_managed
     "existent volume path '%s'" % self.path))
ValueError: Size must be specified for non existent volume path '/var/lib/libvirt/images/fd1440.img'
root@Boomer:~#


t@Boomer:~# virsh --connect qemu:///system vol-list default
Name                 Path
-----------------------------------------
Donkey.img           /var/lib/libvirt/images/Donkey.img
fd.img               /var/lib/libvirt/images/fd.img
grub-floppy.img      /var/lib/libvirt/images/grub-floppy.img
root-rh-7.3.img      /var/lib/libvirt/images/root-rh-7.3.img
Win7.img             /var/lib/libvirt/images/Win7.img

root@Boomer:~#
root@Boomer:~#

#630478#25
Date:
2011-08-08 14:23:51 UTC
From:
To:
In the virt-install example, you try to use volume fd1440.img, which doesn't
show up in the vol-list output, meaning virt-install thinks that file doesn't
exist, hence why it says you need to specify a path

What's the output of ls -l /var/lib/libvirt/images

If the file is actually there, you might need to refresh the pool with 'virsh
pool-refresh default'

#630478#30
Date:
2011-08-15 13:12:15 UTC
From:
To:
It happens I have rebooted, and the problem wrt that particular disk image now does not occur.

The file did, in fact, exist; I've changed the way I pass data to my new guests and now do not use a floppy
image, so I used to commands I already showed you in order to recreate the problem.

Previously, I expanded the allocated size of the file using a dd command similar to this:
   dd if=/dev/zero of=/var/lib/libvirt/images/fd1440a.img seek=1 bs=2G count=0
   and the problem went away. Since that it now does not go away that way, I expect I must have done something
   else as well, lile restart libvirtd.

Since the message, "ValueError: Size must be specified for non existent volume path '/var/lib/libvirt/images/fd1440a.img'"
is clearly misleading because the ls command (which is the obvious way to check) reveals the file does exist.

I suggest that libvirtd (or whatever is the offending code) be changed to ask the filesystem whether the file exists
(stat() and/or access()) and that the error reporting be improved to more accurately reflect the actual problem.

Thanks for your time.

#630478#35
Date:
2011-08-15 14:07:39 UTC
From:
To:
This sounds like you've not refreshed the storage pool after adding the
image? I leave the bug open for now since the error message is
misleading indeed.
 -- Guido

#630478#40
Date:
2011-08-16 01:12:16 UTC
From:
To:
I certainly didn't, I don't recall any documentation to the effect that it's necessary.
Note that it's not required in this example:

# dd if=/dev/zero of=/tmp/fd1440.img count=2880
# /usr/bin/virt-install -n dummy --pxe --debug  -r 192 --arch=i686 --vcpus=1 --os-type=linux --os-variant=debiansqueeze  --disk path=/tmp/fd1440.img  >/tmp/vm.log 2>&1

#630478#45
Date:
2011-08-17 13:23:59 UTC
From:
To:
What virtinst version is this? Current release should refresh the storage pool
if it doesn't find the referenced basename.

- Cole