Bug 1372313

Summary: cloned image gets the same nvram file in the xml description
Product: [Community] Virtualization Tools Reporter: Eric Auger <eric.auger>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: abologna, berrange, crobinso, drjones, eric.auger, gscrivan, lersek, maurizio.antillon, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-07 16:02:14 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:

Comment 2 Andrea Bolognani 2016-09-01 14:07:38 UTC
(In reply to Eric Auger from comment #0)
> Description of problem:
> 
> 
> Version-Release number of selected component (if applicable):
> 
> libvirt.aarch64 2.0.0 6.el7
> virt-install.noarch 1.4.0 1.el7
> libguestfs.aarch64 1.32.7 3.el7
> 
> How reproducible: 100% on Cavium ThunderX, Mustang
> 
> When cloning a guest rhel image using virt-clone, the cloned image xml
> contains the same xml as the original VM.

Just to clarify, the issue is only in the contents of the
/domain/os/nvram element: the rest of the domain configuration
is altered correctly, but the original NVRAM file is still
referenced by the cloned guest.

virt-clone should instead make a copy of the original NVRAM
file and point to that in the /domain/os/nvram element of the
clone. No data should be shared between the original guest
and the clone.

> Steps to reproduce:
> 
> dd if=/dev/zero of=./guest8G.img bs=1M count=8192
> 
> virt-install -r 2048 --accelerate -n ess \
>   -f ./guest8G.img \

You should be able to use

  --disk guest8G.img,format=raw,size=8

instead of calling dd separately. You could also use the
simpler

  --disk size=8

to get a 8GB disk with format qcow2 allocated for you in
libvirt's default pool (~/.local/libvirt/images for regular
users); you could even use

  --disk size=9,bus=scsi \
  --controller scsi,model=virtio-scsi

to use virtio-scsi instead of virtio-blk.

[...]
>   --network bridge:br0 \
>   --vcpus <vcpus> \
>   --os-type linux \

I believe '--os-type' is the legacy name for '--os-variant'.

In any case, using 'rhel7.2' instead of 'linux' would be
more appropriate. You can get the list of known OS variants
by running

  osinfo-query os

>   --nographics

Again, I reckon '--nographics' is a legacy option, and that
'--graphics none' is the new, preferred variant.

> 
> virt-clone -o ess --auto-clone
> 
> check the resulting xml.
> 
> Both xmls should have different nvram files

Comment 3 Cole Robinson 2017-03-07 16:02:14 UTC
Since there's a RHEL bug tracking this already, and the initial report is in the RHEL context, I'm duping to that. This is fixed upstream now though:

commit 5e2b63c1ffa453f8664a2993ee6d8bec18294d50
Author: Pavel Hrdina <phrdina>
Date:   Mon Mar 6 09:43:10 2017 +0100

    virt-clone: add support to clone nvram VARS

*** This bug has been marked as a duplicate of bug 1243335 ***