Hi all,
I am trying to clone a lvm2 image following thing haapens when I clone a image
with virt-clone command
virt-clone --prompt --force --original lvm_thin_1 --name lvm_thin_2 --file
/dev/volgrp/lvm_thin2
Now when I clone this, It clone successfully but the cloned image is fully
expanded , I mean it takes all 100% space
#lvs
LV
VG
Attr
LSize
Pool Origin
Data%
lvm_thin_1
Volgrp
Vwi-aotz
8.00g
pool
10.18
lvm_thin_2
volgrp
Vwi-a-tz
8.00g
pool
100.00
pool
volgrp
twi-a-tz
100.00g
8.97
Now as you can see The 2nd lvm thin disk is fully expanded to 100%
I then downloaded the virtinst source code from the http://virt-manager.org/
site
Package:- virtinst-0.600.3.tar.gz
The I dig into to the code
Now here is what I notice
In file VirtualDisk.py
Function:- def _clone_local(self, meter, size_bytes)
I changed some code
Here is the diff
[root@localhost work]# diff
changedcode/virtinst-0.600.3/virtinst/VirtualDisk.py
virtinst-0.600.3/virtinst/VirtualDisk.py
1383a1384
> clone_block_size = 4096
1391a1393
>
1399c1401
< if sparse and zeros == l:
---
> if zeros == l:
1411a1414
>
Here I removed the sparse from the condition, and also change the
cloned_block_size(varying this value change the cloned image size to some
extent)
Initially the sparse is false That's why the condition is not checked , I
skipped that part
Now
#lvs
LV
VG
Attr
LSize
Pool Origin
Data%
lvm_thin_1
Volgrp
Vwi-aotz
8.00g
pool
10.18
lvm_thin_2
volgrp
Vwi-a-tz
8.00g
pool
8.51
pool
volgrp
twi-a-tz
100.00g
8.97
As you can see clone disk is even more compressed, as all the unnecessary zeros
are removed from the source file.
The cloned VM is working file , I double checked it.
Now I am not sure whether this is a correct solution for cloning,
What I actually want to know is what actually sparse is representing here, why
it was initially set to false?
And it what case the sparse condition is actually met?
Regards
Pankaj Rawat
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and
intended
for the named recipient(s) only.
It shall not attach any liability on the originator or NECHCL or its
affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of NECHCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. .
-----------------------------------------------------------------------------------------------------------------------
_______________________________________________
virt-tools-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list