Bug 800253

Summary: [libvirt] missing 'source file' attribute when passing 'optional' param in xml
Product: [Fedora] Fedora Reporter: Haim <hateya>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 16CC: abaron, berrange, clalancette, crobinso, dallan, danken, dougsland, ewarszaw, itamar, jforbes, jyang, laine, libvirt-maint, mgoldboi, veillard, virt-maint, xen-maint, yeylon
Target Milestone: ---Keywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-07 19:55:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 805411    

Description Haim 2012-03-06 07:07:59 UTC
Description of problem:

bug was originally opened for RHEL - https://bugzilla.redhat.com/show_bug.cgi?id=795093

we need this back-port for Fedora. 

missing 'source dev' attribute when passing 'optional' param in XML with
regardless wither source-dev exists or not. 

xml:

<disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <serial></serial>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>

log (vdsm):

Thread-221::ERROR::2012-02-19 09:59:17,807::utils::399::vm.Vm::(collect)
vmId=`2aed27de-bc3f-40cb-85b3-1839f8e38279`::Stats function failed:
<AdvancedStatsFunction _sampleDiskLatency at 0x207a7a0>
Traceback (most recent call last):
  File "/usr/share/vdsm/utils.py", line 395, in collect
    statsFunction()
  File "/usr/share/vdsm/utils.py", line 272, in __call__
    retValue = self._function(*args, **kwargs)
  File "/usr/share/vdsm/libvirtvm.py", line 158, in _sampleDiskLatency
    diskLatency[vmDrive.name] = stats[vmDrive.alias]
AttributeError: 'Drive' object has no attribute 'alias'


domain was started with

<disk device="cdrom" snapshot="no" type="file">
 <source
file="/rhev/data-center/2319b7ff-09f6-488c-83c4-aa78139db3b4/019d4b6f-5450-4eb6-80ee-c63ea062de49/images/11111111-1111-1111-1111-111111111111/en_windows_7_enterprise_x64_dvd_x15-70749.iso"
startupPolicy="optional"/>
 <target bus="ide" dev="hdc"/>
 <serial></serial>
</disk>

the source file is accessible on the nfs mount. However, libvirt claims

2012-02-19 11:54:41.779+0000: 22269: debug : qemuDomainCheckDiskPresence:1634 :
Dropping disk 'hdc' on domain 'xtream-vm-001' (UUID
'f9ea04b0-1a1e-4793-870f-b3b1f8b6c6e4') due to inaccessible source
'/rhev/data-center/2319b7ff-09f6-488c-83c4-aa78139db3b4/019d4b6f-5450-4eb6-80ee-c63ea062de49/images/11111111-1111-1111-1111-111111111111/en_windows_7_enterprise_x64_dvd_x15-70749.iso'

and drops the "file" attribute from the <source> element.

If startupPolicy="optional" is dropped, the domain starts up fine.

libvirt-0.9.9-1.fc16.x86_64

note also that libvirt's behaviour is inconsistent with the case of starting
with an empty cdrom. There, the <source> element is completely dropped from
XMLDesc().

Comment 1 Laine Stump 2012-03-12 17:03:24 UTC
We need to backport the following upstream commit to F16:

commit b90d4722a5dcf30986f520a4674976f3a55b06ad
Author: Michal Privoznik <mprivozn>
Date:   Wed Feb 22 09:55:27 2012 +0100

    util: Fix virFileAccessibleAs return path from parent
    
    Despite documentation, if we do fork() parent always returns -1
    even if file is accessible. Which is wrong obviously.

Comment 2 Laine Stump 2012-03-12 18:23:44 UTC
On further investigation - that patch doesn't apply to libvirt in Fedora 16 (0.9.6) because the function virFileAccessibleAs doesn't yet exist, nor does the caller of that function (qemuDomainCheckDiskPresence).

This is going to need a farther-reaching (or at least different) backport than the one patch indicated above. To figure out what needs to be backported, can you provide the error log produced when running libvirt-0.9.6 (the version that's in Fedora 16)?

Comment 3 Haim 2012-03-21 08:34:16 UTC
(In reply to comment #2)
> On further investigation - that patch doesn't apply to libvirt in Fedora 16
> (0.9.6) because the function virFileAccessibleAs doesn't yet exist, nor does
> the caller of that function (qemuDomainCheckDiskPresence).
> 
> This is going to need a farther-reaching (or at least different) backport than
> the one patch indicated above. To figure out what needs to be backported, can
> you provide the error log produced when running libvirt-0.9.6 (the version
> that's in Fedora 16)?

2012-03-21 08:25:32.554+0000: 3279: debug : qemuDomainCheckDiskPresence:1737 : Dropping disk 'hdc' on domain 'MyVm3-0-Windows' (UUID '301d5fdb-cb3c-4c17-81ce-98f0e654b023') due to inaccessible source '/rhev/data-center/fcb97cf1-42f3-4a2
d-90fa-f320f216f483/2612f0b2-8310-4d1f-adba-b708eb95f5cf/images/11111111-1111-1111-1111-111111111111/en_windows_xp_professional_with_service_pack_3_x86_cd_vl_x14-73974.iso'

Comment 4 Osier Yang 2012-03-29 08:31:56 UTC
startupPolicy is even not supported on f16, if we want to support it, we have to backport the whole patches for startupPolicy and a bunch of follow up small problem fixing patches. Much conflicts, and it might casue regression or something
like risk, so I'd think we should fix the problem on f17 instead, f17 already supported the startupPolicy, but just doesn't work well for the bug.

Comment 5 Dan Kenigsberg 2012-04-03 09:50:36 UTC
*** Bug 805411 has been marked as a duplicate of this bug. ***

Comment 6 Cole Robinson 2012-06-07 19:55:42 UTC
Yeah, this isn't backport material IMO. If vdsm is wants to support multiple versions of libvirt it will need to tease these issues out.