Bug 740482

Summary: [sVirt] sVirt should not force relabel the running guest's img and give it to a new defined guest
Product: Red Hat Enterprise Linux 6 Reporter: Wayne Sun <gsun>
Component: libvirtAssignee: Osier Yang <jyang>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.2CC: acathrow, dallan, mzhan, rwu, whuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-23 09:35:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Wayne Sun 2011-09-22 08:15:18 UTC
Description of problem:
Define a domain using a image already used by a running guest, then start the new defined domain. The img will be relabelled and taken over by the new defined domain, at the same time the running guest get broken for fail to read/write from the img.

Version-Release number of selected component (if applicable):
# rpm -q libvirt qemu-kvm kernel

How reproducible:

Steps to Reproduce:
1. prepare a running guest
2. define a new guest which using the img file of the runnning guest
# virsh define domain.xml
In domain.xml:
<source file='/img/of/already/running/domain'/>

and no <seclabel> in the xml

3. start the new defined guest
# virsh start $new_defined_guest

4. check both guest by virt-viewer

Actual results:
image label was forced change to owned by new domain, and the running domain is broken.

Expected results:
the new defined and started guest can not take over the running domain's img, sVirt should denied it

Additional info:
Test this also on libvirt-0.9.4-11 and libvirt-0.9.4-7.2, the result is the same as on -12.
But on libvirt-0.9.4-7 and -6, both guests can running well.

Comment 1 Dave Allan 2011-09-22 15:02:29 UTC
There is no relevant change between 0.9.4-7 and 0.9.4-7.2, so something else is different in your environment.

Comment 2 Wayne Sun 2011-09-23 03:36:10 UTC
(In reply to comment #1)
> There is no relevant change between 0.9.4-7 and 0.9.4-7.2, so something else is
> different in your environment.

There is something different, I use fresh install machine but with different qemu-kvm and kernel

For 7:
# rpm -q libvirt qemu-kvm kernel

For 7.2:
# rpm -q libvirt qemu-kvm kernel

For another try of direct downgrade libvirt from 11 to 7 and 6, the result is same with 11 and 12. The qemu-kvm is in this try.

Comment 3 Osier Yang 2011-09-23 07:35:02 UTC
@Wayne, can you test if it works well when the disk is shared or readonly?

Comment 4 Osier Yang 2011-09-23 08:24:21 UTC
Confirmed with Wayne, just as expected, there is no problem for disk which is specified as *shareable* or *readonly*.

But IMHO we need to prevent defining a domain which has disk used by other domains.

Posted RFC patch to upstream for further discussion.