libguestfs: update to use Nova's libvirt URI

Bug #1131768 reported by Dan Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Dan Prince

Bug Description

Using OpenStack Nova w/ libvirt on Fedora 18:

When I boot an instance and inject files (with libguestfs) I get the following stack trace in Nova's compute.log file:

2013-02-20 21:14:55.706 ERROR nova.virt.libvirt.driver [req-0834ec7c-d875-469f-9277-00e4fbfd20e8 696e681d17df4f8eb3f20c26dec5f093 3efc0abe163f44b9a890f66242dfcf73] [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] Error injecting data into image 93e67150-0f43-43d1-9ac6-6ff1777fdc69 (Error mounting /var/lib/nova/instances/2e8e19f1-137d-496b-b206-abc8919f5856/disk with libguestfs (could not connect to libvirt (URI = NULL): Failed to connect socket to '/home/nova/.cache/libvirt/libvirt-sock': No such file or directory [code=38 domain=7]))
2013-02-20 21:14:55.711 ERROR nova.compute.manager [req-0834ec7c-d875-469f-9277-00e4fbfd20e8 696e681d17df4f8eb3f20c26dec5f093 3efc0abe163f44b9a890f66242dfcf73] [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] Instance failed to spawn
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] Traceback (most recent call last):
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1028, in _spawn
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] block_device_info)
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1438, in spawn
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] admin_pass=admin_password)
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1815, in _create_image
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] mandatory=('files',))
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] File "/usr/lib/python2.7/site-packages/nova/virt/disk/api.py", line 304, in inject_data
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] fs.setup()
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] File "/usr/lib/python2.7/site-packages/nova/virt/disk/vfs/guestfs.py", line 108, in setup
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] {'imgfile': self.imgfile, 'e': e})
2013-02-20 21:14:55.711 18959 TRACE nova.compute.manager [instance: 2e8e19f1-137d-496b-b206-abc8919f5856] NovaException: Error mounting /var/lib/nova/instances/2e8e19f1-137d-496b-b206-abc8919f5856/disk with libguestfs (could not connect to libvirt (URI = NULL): Failed to connect socket to '/home/nova/.cache/libvirt/libvirt-sock': No such file or directory [code=38 domain=7])

-----

This issue seems to be that because libguestfs doesn't use the same libvirt URI as Nova and thus fails.

Full thread on the issue here:

https://bugzilla.redhat.com/show_bug.cgi?id=913345

Dan Prince (dan-prince)
Changed in nova:
assignee: nobody → Dan Prince (dan-prince)
importance: Undecided → High
status: New → In Progress
milestone: none → grizzly-rc1
Revision history for this message
Dan Prince (dan-prince) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/22596
Committed: http://github.com/openstack/nova/commit/4f0c2ddcf69d838b4954749091ae0056aa46ef07
Submitter: Jenkins
Branch: master

commit 4f0c2ddcf69d838b4954749091ae0056aa46ef07
Author: Dan Prince <email address hidden>
Date: Thu Feb 21 15:25:39 2013 -0500

    Make LibvirtDriver.uri() a staticmethod.

    LibvirtDriver's uri() function seems to be the most logical place
    where one can access the libvirt URL used by Nova. I would like
    access to this outside the scope of the internal libvirt
    driver (for libguestfs) so exposing it as a static
    resource seems to make sense.

    Partial fix for LP Bug #1131768.

    Change-Id: I653296414716b4e799d68f6bfc868e6039d6ea4a

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/22597
Committed: http://github.com/openstack/nova/commit/014499acf5d6d6a557c9415aa49c536817a02a0a
Submitter: Jenkins
Branch: master

commit 014499acf5d6d6a557c9415aa49c536817a02a0a
Author: Dan Prince <email address hidden>
Date: Thu Feb 21 15:28:38 2013 -0500

    Make guestfs use same libvirt URI as Nova.

    Updates our libguestfs vfs implementation so that it makes use of
    the same libvirt connection URI as Nova does when using
    attach mode 'libvirt'. Previously when libguestfs used attach
    mode 'libvirt' (the default on some newer distros like Fedora 18)
    you could get permissions issues and ultimately get a libvirt
    connection error from libguestfs:

      could not connect to libvirt (URI = NULL)

    Docs on guestfs attach method can be found here:

      http://libguestfs.org/guestfs.3.html#attach-method

    Having libguestfs use the same connection URL as Nova makes sense
    and gets past these permission issues. (avoiding things like forcing
    you to create a $HOME dir for the nova user among other things)

    Full thread on this is here:

      https://bugzilla.redhat.com/show_bug.cgi?id=913345

    Note that on most distros the default libguestfs attach method
    is still 'appliance' so this would have no affect unless explicitly
    enabled via LIBGUESTFS_ATTACH_METHOD.

    Fixes LP Bug #1131768.

    Change-Id: I7e9f010022731a43e8d793cf8415ec12b346fdb4

Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-rc1 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.