Bug 1404182 - RFE: virt-resize should support a URL as the outdisk
Summary: RFE: virt-resize should support a URL as the outdisk
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.4
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
Yehuda Zimmerman
URL:
Whiteboard:
Depends On: 1359086
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-13 09:32 UTC by Xianghua Chen
Modified: 2017-08-02 07:29 UTC (History)
5 users (show)

Fixed In Version: libguestfs-1.36.1-1.el7
Doc Type: Enhancement
Doc Text:
Resized disks can be written directly to a remote location With this update, the *virt-resize* utility can write its output to a remote location. This may be useful, for example, in directly writing the resized disk image to a Ceph storage volume. The *virt-resize* output disk can be specified using a URI. Any supported input protocol and format can be used to specify the output.
Clone Of:
Environment:
Last Closed: 2017-08-01 22:11:26 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2023 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2017-08-01 19:32:01 UTC

Description Xianghua Chen 2016-12-13 09:32:30 UTC
Description of problem:
RFE: virt-resize should support a URL as the outdisk.

Version-Release number of selected component (if applicable):
libguestfs-1.32.7-3.el7.x86_64

How reproducible:
100%

Steps:
1. Prepare a ceph server :
Refer to: https://drive.google.com/open?id=1ryfe-6D968kEiy2YzloMnLXC0tw1cfmeGeIKBndpbUg

In this bug, we use 10.66.10.242 as the ceph mon.
Create a pool: libvirt-pool
Prepare a guest image:rbd1.img

2.
# qemu-img create -f raw rbd:libvirt-pool/new-disk.raw:mon_host=10.66.10.242 10G
#  virt-resize --format=raw --resize /dev/sda1=+200M --expand /dev/sda2 rbd://10.66.10.242:6789/libvirt-pool/rbd1.img  rbd://10.66.10.242:6789/libvirt-pool/new-disk.raw -v -x
command line: virt-resize --format=raw --resize /dev/sda1=+200M --expand /dev/sda2 rbd://10.66.10.242:6789/libvirt-pool/rbd1.img rbd://10.66.10.242:6789/libvirt-pool/new-disk.raw -v -x
[   0.0] Examining rbd://10.66.10.242:6789/libvirt-pool/rbd1.img
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: add_drive "libvirt-pool/rbd1.img" "readonly:true" "format:raw" "protocol:rbd" "server:tcp:10.66.10.242:6789"
libguestfs: creating COW overlay to protect original drive content
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: disk_create "/tmp/libguestfs7VTwD9/overlay1" "qcow2" -1 "backingfile:rbd:libvirt-pool/rbd1.img:mon_host=10.66.10.242\:6789:auth_supported=none" "backingformat:raw"
libguestfs: command: run: qemu-img
libguestfs: command: run: \ create
libguestfs: command: run: \ -f qcow2
libguestfs: command: run: \ -o backing_file=rbd:libvirt-pool/rbd1.img:mon_host=10.66.10.242\:6789:auth_supported=none,backing_fmt=raw
libguestfs: command: run: \ /tmp/libguestfs7VTwD9/overlay1
Formatting '/tmp/libguestfs7VTwD9/overlay1', fmt=qcow2 size=8589934592 backing_file='rbd:libvirt-pool/rbd1.img:mon_host=10.66.10.242\:6789:auth_supported=none' backing_fmt='raw' encryption=off cluster_size=65536 lazy_refcounts=off
libguestfs: trace: disk_create = 0
libguestfs: trace: get_backend_setting "internal_libvirt_imagelabel"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive "rbd://10.66.10.242:6789/libvirt-pool/new-disk.raw" "readonly:false" "cachemode:unsafe"
libguestfs: trace: add_drive = -1 (error)
virt-resize: error: libguestfs error:
rbd://10.66.10.242:6789/libvirt-pool/new-disk.raw: No such file or
directory
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1691380 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfs7VTwD9


Actual results:
The command line in step 2 does not support the rbd URI as outdisk.

Expected results:
The command line in step 2 should support the rbd URI as outdisk.


Additional info:
Same to virt-sparsify, it should support URL too.

Comment 1 Xianghua Chen 2016-12-14 01:53:22 UTC
Also,  the virt-builder should support URL too.

Comment 2 Richard W.M. Jones 2016-12-14 10:29:18 UTC
(In reply to Xianghua Chen from comment #1)
> Also,  the virt-builder should support URL too.

Needs a separate RFE for that one.

Comment 3 Xianghua Chen 2016-12-16 05:22:18 UTC
(In reply to Richard W.M. Jones from comment #2)
> (In reply to Xianghua Chen from comment #1)
> > Also,  the virt-builder should support URL too.
> 
> Needs a separate RFE for that one.
Ok, thanks. New bug for this: #1405273

Comment 4 Pino Toscano 2017-01-12 10:39:34 UTC
Patch (apparently easier than expected) posted for this:
https://www.redhat.com/archives/libguestfs/2017-January/msg00038.html

Comment 5 Pino Toscano 2017-02-06 15:47:31 UTC
Fixed upstream with
https://github.com/libguestfs/libguestfs/commit/8a2b0738d1b79f288b14fc35294567430d10b7ec
which is in libguestfs >= 1.35.21.

Comment 7 YongkuiGuo 2017-04-24 12:09:17 UTC
Verified with package:
libguestfs-1.36.3-3.el7.x86_64


Steps:
1. Prepare a ceph server (10.66.144.75 as the ceph mon)
Create a pool: libvirt-pool
Prepare a guest image:rbd-secret.img

2. On remote machine:
# qemu-img create -f raw rbd:libvirt-pool/out-disk.raw:mon_host=10.66.144.75 10G

3.
$ rbd -p libvirt-pool ls
out-disk.raw
rbd-secret.img

4. On remote machine:
# virt-resize --format=raw --resize /dev/sda1=+200M --expand /dev/sda2 rbd://10.66.144.75:6789/libvirt-pool/rbd-secret.img --output-format=raw rbd://10.66.144.75:6789/libvirt-pool/out-disk.raw


Actual results:
-------------------------------------------------------------------------
[   0.0] Examining rbd://10.66.144.75:6789/libvirt-pool/rbd-secret.img
**********

Summary of changes:

/dev/sda1: This partition will be resized from 1.0G to 1.2G.  The 
filesystem xfs on /dev/sda1 will be expanded using the 'xfs_growfs' method.

/dev/sda2: This partition will be resized from 7.0G to 8.8G.  The LVM PV on 
/dev/sda2 will be expanded using the 'pvresize' method.

**********
[   2.4] Setting up initial partition table on rbd://10.66.144.75:6789/libvirt-pool/out-disk.raw
[   2.9] Copying /dev/sda1
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[  10.1] Copying /dev/sda2
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[  71.4] Expanding /dev/sda1 using the 'xfs_growfs' method
[  72.5] Expanding /dev/sda2 using the 'pvresize' method

Resize operation completed with no errors.  Before deleting the old disk, 
carefully check that the resized disk boots and works correctly.
------------------------------------------------------------------------------
In step 4, the command can be executed successfully. So verified this bug.

Comment 10 errata-xmlrpc 2017-08-01 22:11:26 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:2023


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