Merge lp:~corey.bryant/charms/trusty/nova-compute/fix-for-oil-1352506 into lp:~openstack-charmers-archive/charms/trusty/nova-compute/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 78
Proposed branch: lp:~corey.bryant/charms/trusty/nova-compute/fix-for-oil-1352506
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/next
Diff against target: 37 lines (+13/-3)
1 file modified
hooks/nova_compute_utils.py (+13/-3)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/nova-compute/fix-for-oil-1352506
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
OpenStack Charmers Pending
Review via email: mp+231487@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

This fixes an error where the virsh command uses the default URI, which may or may not match the hypervisor specified in the virt-type config option. For example, if virt-type=lxc, the qemu:///system URI is used, whereas the correct URI that should be used is lxc:///.

Revision history for this message
Liam Young (gnuoy) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/nova_compute_utils.py'
2--- hooks/nova_compute_utils.py 2014-07-09 13:42:57 +0000
3+++ hooks/nova_compute_utils.py 2014-08-20 02:39:53 +0000
4@@ -128,6 +128,15 @@
5 'lxc': ['nova-compute-lxc'],
6 }
7
8+# Maps virt-type config to a libvirt URI.
9+LIBVIRT_URIS = {
10+ 'kvm': 'qemu:///system',
11+ 'qemu': 'qemu:///system',
12+ 'xen': 'xen:///',
13+ 'uml': 'uml:///system',
14+ 'lxc': 'lxc:///',
15+}
16+
17
18 def ceph_config_file():
19 return CHARM_CEPH_CONF.format(service_name())
20@@ -422,14 +431,15 @@
21
22
23 def create_libvirt_secret(secret_file, secret_uuid, key):
24- if secret_uuid in check_output(['virsh', 'secret-list']):
25+ uri = LIBVIRT_URIS[config('virt-type')]
26+ if secret_uuid in check_output(['virsh', '-c', uri, 'secret-list']):
27 log('Libvirt secret already exists for uuid %s.' % secret_uuid,
28 level=DEBUG)
29 return
30 log('Defining new libvirt secret for uuid %s.' % secret_uuid)
31- cmd = ['virsh', 'secret-define', '--file', secret_file]
32+ cmd = ['virsh', '-c', uri, 'secret-define', '--file', secret_file]
33 check_call(cmd)
34- cmd = ['virsh', 'secret-set-value', '--secret', secret_uuid,
35+ cmd = ['virsh', '-c', uri, 'secret-set-value', '--secret', secret_uuid,
36 '--base64', key]
37 check_call(cmd)
38

Subscribers

People subscribed via source and target branches