Bug 1139543

Summary: Improve the error info when converting guest with no space left
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, juzhou, mbooth, mzhan, ptoscano, rjones, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.27.41-1.1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:44:21 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:
Attachments:
Description Flags
Log file of converting guest with no space left none

Description tingting zheng 2014-09-09 07:39:25 UTC
Created attachment 935562 [details]
Log file of converting guest with no space left

Description
Improve the error info when converting guest with no space left

Version:
libguestfs-1.27.39-1.1.el7.x86_64
virt-v2v-1.27.39-1.1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a guest with no space left.
# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root  6.5G  6.5G     0 100% /
tmpfs                         939M   76K  939M   1% /dev/shm
/dev/sda1                     485M   35M  426M   8% /boot

2.Use virt-v2v to convert the guest.Error shows as:virt-v2v: error: libguestfs error: command: cp: writing 
`/tmp/initramfs.W9jxv6/lib/kbd/unimaps/cp437.uni': No space left on device
E: Failed to install /lib/kbd/unimaps/cp437.uni
/usr/share/dracut/dracut-functions: line 49: echo: write error: No space 
left on device

# virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm demo
[   0.0] Opening the source -i libvirt demo
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[   5.0] Initializing the target -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export
[   6.0] Inspecting the overlay
[  18.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: error: libguestfs error: command: cp: writing 
`/tmp/initramfs.W9jxv6/lib/kbd/unimaps/cp437.uni': No space left on device
E: Failed to install /lib/kbd/unimaps/cp437.uni
/usr/share/dracut/dracut-functions: line 49: echo: write error: No space 
left on device

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]


Actual results:
The error info is not clear and a bit confusing for whether no space left in guest or host.

Expected results:
No space left in guest or something like this.

Additional info:

Comment 1 Richard W.M. Jones 2014-09-09 09:48:46 UTC
Upstream fix:

https://github.com/libguestfs/libguestfs/commit/be1c6965006dec258b915c9561ac66c8cb36dfe6

This will appear in libguestfs >= 1.27.40.

Comment 3 zhoujunqin 2014-09-10 08:33:44 UTC
I can also reproduce this bug issue with new package version:
virt-v2v-1.27.41-1.1.el7.x86_64
libguestfs-1.27.41-1.1.el7.x86_64

1.Prepare a guest with no space left.
# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root  6.5G  6.5G     0 100% /
tmpfs                         939M   76K  939M   1% /dev/shm
/dev/sda1                     485M   35M  426M   8% /boot

2.Use virt-v2v to convert the guest.
# virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm demo
[   0.0] Opening the source -i libvirt demo
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[   2.0] Initializing the target -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export
[   3.0] Inspecting the overlay
[  11.0] Checking for sufficient free disk space in the guest
[  11.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: error: libguestfs error: command: cp: writing 
`/tmp/initramfs.ClQe2q/lib/kbd/unimaps/cp437.uni': No space left on device
E: Failed to install /lib/kbd/unimaps/cp437.uni

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

Since the error has not been improved, assigned back, and please check whether the patch in Comment 1 has been included by libguestfs package, thanks.

Comment 4 Richard W.M. Jones 2014-09-10 09:50:00 UTC
(In reply to zhoujunqin from comment #3)
> I can also reproduce this bug issue with new package version:
> virt-v2v-1.27.41-1.1.el7.x86_64
> libguestfs-1.27.41-1.1.el7.x86_64
> 
> 1.Prepare a guest with no space left.
> # df -h
> Filesystem                    Size  Used Avail Use% Mounted on
> /dev/mapper/VolGroup-lv_root  6.5G  6.5G     0 100% /
> tmpfs                         939M   76K  939M   1% /dev/shm
> /dev/sda1                     485M   35M  426M   8% /boot

df isn't a very accurate way to display the actual free space in
a filesystem.  It shows free space available to non-root users,
and the -h option obscures things further.

Use:

$ stat -f /

instead.  I'm betting there is free space on this filesystem, but
df is just not showing it to you.

Comment 5 zhoujunqin 2014-09-10 11:21:22 UTC
I tried as you suggestion on guest.
By root user:
# stat -f /
  File: "/"
    ID: dd12bb426bbe0a3a Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 1687234    Free: 5401       Available: 0
Inodes: Total: 429088     Free: 333905

By normal user:
$  stat -f /
  File: "/"
    ID: dd12bb426bbe0a3a Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 1687234    Free: 5352       Available: 0
Inodes: Total: 429088     Free: 333878

do you think it's ok to prove the guest with no space left.

Comment 6 Richard W.M. Jones 2014-09-10 15:14:32 UTC
(In reply to zhoujunqin from comment #5)
> I tried as you suggestion on guest.
> By root user:
> # stat -f /
>   File: "/"
>     ID: dd12bb426bbe0a3a Namelen: 255     Type: ext2/ext3
> Block size: 4096       Fundamental block size: 4096
> Blocks: Total: 1687234    Free: 5401       Available: 0

You're not quite triggering the error message.

The disk itself has 5401 free blocks.  Because the block size
is 4096 bytes, that means you have 22122496 bytes free.

The "Available: 0" in this case means that non-root users are
unable to use this space, because Linux filesystems reserve a
percentage of their space for the root user.  (Use 'tune2fs -l'
to find out what percentage).  Non-root users are irrelevant
because all conversion operations are done ignoring this
reserved space.

virt-v2v checks to see if you have at least 20000000 bytes
free on the root partition, which in this case you do
(20000000 < 22122496).  So the error is not printed.  But
the margin is so small that if you created even a 3 MB file on
the root filesystem then you should get the error.

Comment 7 zhoujunqin 2014-09-11 05:59:31 UTC
Thanks for your help, Richard W.M. Jones.
I tried again with package:
virt-v2v-1.27.41-1.1.el7.x86_64
libguestfs-1.27.41-1.1.el7.x86_64

1. Prepare a guest with no space( Login guest and check)
# stat -f /
  File: "/"
    ID: dd12bb426bbe0a3a Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 1687234    Free: 4096       Available: 0
Inodes: Total: 429088     Free: 333880

2. Use virt-v2v to convert the guest.
# virt-v2v -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export --network rhevm demo
[   0.0] Opening the source -i libvirt demo
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[   2.0] Initializing the target -o rhev -os 10.66.90.115:/vol/v2v_auto/auto_export
[   2.0] Inspecting the overlay
[  11.0] Checking for sufficient free disk space in the guest
virt-v2v: error: not enough free space for conversion on filesystem '/'.  
16887808 bytes free < 20000000 bytes needed

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

Can get the friendly error message, so move from ASSIGNED to VERIFIED.

Comment 9 errata-xmlrpc 2015-03-05 13:44:21 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://rhn.redhat.com/errata/RHBA-2015-0303.html