Bug 1732998

Summary: virt-sparsify --key option is not working
Product: Red Hat Enterprise Linux 7 Reporter: Jawad Rajput <jawadmasroor>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.7CC: ptoscano, yoguo
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-25 15:58:08 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:

Description Jawad Rajput 2019-07-25 00:06:11 UTC
We have a virtual machine guest running on CentOS-7 KVM that is taking more disk space than the pre-allocated space, guest was made through Virt-Manager. Now, there is almost no space left on the hypervisor. Guest has 12TB encrypted /opt partition but actual use is 1 TB. Hypervisor had 14TB which now used by the guest qcow2 image. Both hypervisor and guest are CentOS-7. Guest currently has no snapshot either.   
   
I recently come across virt-sparsify tool, but when using "virt-sparsify --in-place some.qcow2 --key" it is not asking for key. I am hoping if someone can tell me the right syntax.

Tried all the following options given in the help, but none of them worked, and keep getting syntax error. There is not much information online about virt-sparsify key option.  

    --key /opt:key:"encryption password"

    --key /opt:file:enc_pass_file

Comment 2 YongkuiGuo 2019-07-25 02:54:53 UTC
There is no '--key' option for virt-sparsify command. You can use '--echo-keys' or '--keys-from-stdin' option instead. Please see the man page.

Comment 3 Pino Toscano 2019-07-25 08:21:28 UTC
(In reply to YongkuiGuo from comment #2)
> There is no '--key' option for virt-sparsify command. You can use
> '--echo-keys' or '--keys-from-stdin' option instead. Please see the man page.

It is a new option in libguestfs 1.40.0, in virt-sparsify and other OCaml tools.
Which version of libguestfs are you using? What is the OS where you are using it?

(In reply to Jawad Rajput from comment #0)
> Tried all the following options given in the help, but none of them worked,
> and keep getting syntax error. There is not much information online about
> virt-sparsify key option.

http://libguestfs.org/virt-sparsify.1.html describes it.

>     --key /opt:key:"encryption password"
> 
>     --key /opt:file:enc_pass_file

The first part of the selector for --key is the encrypted device.

Comment 4 Jawad Rajput 2019-07-25 15:46:03 UTC
Thanks Pino for the response. The OS is CentOS Linux release 7.6.1810 (Core)  and libguestfs is 1.38.2. 

# uname -r
3.10.0-957.21.3.el7.x86_64

# rpm -qa libguestfs
libguestfs-1.38.2-12.el7_6.2.x86_64

Comment 5 Jawad Rajput 2019-07-25 15:46:42 UTC
(In reply to YongkuiGuo from comment #2)
> There is no '--key' option for virt-sparsify command. You can use
> '--echo-keys' or '--keys-from-stdin' option instead. Please see the man page.

Thanks Yong, I will give it a try.

Comment 6 Pino Toscano 2019-07-25 15:58:08 UTC
(In reply to Jawad Rajput from comment #4)
> Thanks Pino for the response. The OS is CentOS Linux release 7.6.1810 (Core)
> and libguestfs is 1.38.2. 

virt-sparsify in this version does not have --key.
The version that will be in RHEL 7.7 (and thus CentOS 7.7) will have it.