Merge lp:~vishvananda/nova/lp702741 into lp:~hudson-openstack/nova/trunk

Proposed by Vish Ishaya
Status: Merged
Approved by: Soren Hansen
Approved revision: 568
Merged at revision: 576
Proposed branch: lp:~vishvananda/nova/lp702741
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 131 lines (+20/-17)
3 files modified
nova/tests/test_virt.py (+6/-3)
nova/virt/libvirt.xml.template (+5/-5)
nova/virt/libvirt_conn.py (+9/-9)
To merge this branch: bzr merge lp:~vishvananda/nova/lp702741
Reviewer Review Type Date Requested Status
Devin Carlen (community) Approve
Thierry Carrez (community) Approve
Soren Hansen (community) Approve
Review via email: mp+46245@code.launchpad.net

Description of the change

Works around the app-armor problem of requiring disks with backing files to be named appropriately by changing the name of our extra disks.

disk is fine, as is disk.local and disk.rescue.

To post a comment you must log in.
Revision history for this message
Soren Hansen (soren) wrote :

lgtm

review: Approve
Revision history for this message
Thierry Carrez (ttx) wrote :

lgtm

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (22.3 KiB)

The attempt to merge lp:~vishvananda/nova/lp702741 into lp:nova failed. Below is the output from the failed tests.

TrialTestCase
    runTest ok
AdminAPITest
    test_admin_disabled ok
    test_admin_enabled ok
APITest
    test_exceptions_are_converted_to_faults ok
Test
    test_authorize_token ok
    test_authorize_user ok
    test_bad_token ok
    test_bad_user ok
    test_no_user ok
    test_token_expiry ok
TestLimiter
    test_authorize_token ok
TestFaults
    test_fault_parts ok
    test_raise ok
    test_retry_header ok
FlavorsTest
    test_get_flavor_by_id ok
    test_get_flavor_list ok
GlanceImageServiceTest
    test_create ok
    test_create_and_show_non_existing_image ok
    test_delete ok
    test_update ok
ImageControllerWithGlanceServiceTest
    test_get_image_details ok
    test_get_image_index ok
LocalImageServiceTest
    test_create ok
    test_create_and_show_non_existing_image ok
    test_delete ok
    test_update ok
LimiterTest
    test_minute ok
    test_one_per_period ok
    test_second ok
    test_users_get_separate_buckets ok
    test_we_can_go_indefinitely_if_we_spread_out_requests ok
WSGIAppProxyTest
    test_200 ok
    test_403 ok
    test_failure ok
WSGIAppTest
    test_escaping ok
    test_good_urls ok
    test_invalid_methods ok
    test_invalid_urls ok
    test_response_to_delays ok
ServersTest
    test_create_backup_schedules ok
    test_create_instance ok
    test_delete_backup_schedules ok
    test_delete_server_instance ...

lp:~vishvananda/nova/lp702741 updated
567. By Vish Ishaya

merged trunk

568. By Vish Ishaya

fix test to respect xml changes

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Fixed the tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/tests/test_virt.py'
--- nova/tests/test_virt.py 2011-01-11 19:49:18 +0000
+++ nova/tests/test_virt.py 2011-01-18 20:45:38 +0000
@@ -122,10 +122,10 @@
122122
123 if rescue:123 if rescue:
124 check = (lambda t: t.find('./os/kernel').text.split('/')[1],124 check = (lambda t: t.find('./os/kernel').text.split('/')[1],
125 'rescue-kernel')125 'kernel.rescue')
126 check_list.append(check)126 check_list.append(check)
127 check = (lambda t: t.find('./os/initrd').text.split('/')[1],127 check = (lambda t: t.find('./os/initrd').text.split('/')[1],
128 'rescue-ramdisk')128 'ramdisk.rescue')
129 check_list.append(check)129 check_list.append(check)
130 else:130 else:
131 if expect_kernel:131 if expect_kernel:
@@ -161,13 +161,16 @@
161 if rescue:161 if rescue:
162 common_checks += [162 common_checks += [
163 (lambda t: t.findall('./devices/disk/source')[0].get(163 (lambda t: t.findall('./devices/disk/source')[0].get(
164 'file').split('/')[1], 'rescue-disk'),164 'file').split('/')[1], 'disk.rescue'),
165 (lambda t: t.findall('./devices/disk/source')[1].get(165 (lambda t: t.findall('./devices/disk/source')[1].get(
166 'file').split('/')[1], 'disk')]166 'file').split('/')[1], 'disk')]
167 else:167 else:
168 common_checks += [(lambda t: t.findall(168 common_checks += [(lambda t: t.findall(
169 './devices/disk/source')[0].get('file').split('/')[1],169 './devices/disk/source')[0].get('file').split('/')[1],
170 'disk')]170 'disk')]
171 common_checks += [(lambda t: t.findall(
172 './devices/disk/source')[1].get('file').split('/')[1],
173 'disk.local')]
171174
172 for (libvirt_type, (expected_uri, checks)) in type_uri_map.iteritems():175 for (libvirt_type, (expected_uri, checks)) in type_uri_map.iteritems():
173 FLAGS.libvirt_type = libvirt_type176 FLAGS.libvirt_type = libvirt_type
174177
=== modified file 'nova/virt/libvirt.xml.template'
--- nova/virt/libvirt.xml.template 2011-01-14 02:40:50 +0000
+++ nova/virt/libvirt.xml.template 2011-01-18 20:45:38 +0000
@@ -18,10 +18,10 @@
18 #set $disk_prefix = 'vd'18 #set $disk_prefix = 'vd'
19 #set $disk_bus = 'virtio'19 #set $disk_bus = 'virtio'
20 <type>hvm</type>20 <type>hvm</type>
21 #end if21 #end if
22 #if $getVar('rescue', False)22 #if $getVar('rescue', False)
23 <kernel>${basepath}/rescue-kernel</kernel>23 <kernel>${basepath}/kernel.rescue</kernel>
24 <initrd>${basepath}/rescue-ramdisk</initrd>24 <initrd>${basepath}/ramdisk.rescue</initrd>
25 #else25 #else
26 #if $getVar('kernel', None)26 #if $getVar('kernel', None)
27 <kernel>${kernel}</kernel>27 <kernel>${kernel}</kernel>
@@ -47,7 +47,7 @@
47#if $getVar('rescue', False)47#if $getVar('rescue', False)
48 <disk type='file'>48 <disk type='file'>
49 <driver type='${driver_type}'/>49 <driver type='${driver_type}'/>
50 <source file='${basepath}/rescue-disk'/>50 <source file='${basepath}/disk.rescue'/>
51 <target dev='${disk_prefix}a' bus='${disk_bus}'/>51 <target dev='${disk_prefix}a' bus='${disk_bus}'/>
52 </disk>52 </disk>
53 <disk type='file'>53 <disk type='file'>
@@ -64,7 +64,7 @@
64 #if $getVar('local', False)64 #if $getVar('local', False)
65 <disk type='file'>65 <disk type='file'>
66 <driver type='${driver_type}'/>66 <driver type='${driver_type}'/>
67 <source file='${basepath}/local'/>67 <source file='${basepath}/disk.local'/>
68 <target dev='${disk_prefix}b' bus='${disk_bus}'/>68 <target dev='${disk_prefix}b' bus='${disk_bus}'/>
69 </disk>69 </disk>
70 #end if70 #end if
7171
=== modified file 'nova/virt/libvirt_conn.py'
--- nova/virt/libvirt_conn.py 2011-01-18 23:50:47 +0000
+++ nova/virt/libvirt_conn.py 2011-01-18 20:45:38 +0000
@@ -367,7 +367,7 @@
367 rescue_images = {'image_id': FLAGS.rescue_image_id,367 rescue_images = {'image_id': FLAGS.rescue_image_id,
368 'kernel_id': FLAGS.rescue_kernel_id,368 'kernel_id': FLAGS.rescue_kernel_id,
369 'ramdisk_id': FLAGS.rescue_ramdisk_id}369 'ramdisk_id': FLAGS.rescue_ramdisk_id}
370 self._create_image(instance, xml, 'rescue-', rescue_images)370 self._create_image(instance, xml, '.rescue', rescue_images)
371 self._conn.createXML(xml, 0)371 self._conn.createXML(xml, 0)
372372
373 timer = utils.LoopingCall(f=None)373 timer = utils.LoopingCall(f=None)
@@ -549,23 +549,23 @@
549 utils.execute('truncate %s -s %dG' % (target, local_gb))549 utils.execute('truncate %s -s %dG' % (target, local_gb))
550 # TODO(vish): should we format disk by default?550 # TODO(vish): should we format disk by default?
551551
552 def _create_image(self, inst, libvirt_xml, prefix='', disk_images=None):552 def _create_image(self, inst, libvirt_xml, suffix='', disk_images=None):
553 # syntactic nicety553 # syntactic nicety
554 def basepath(fname='', prefix=prefix):554 def basepath(fname='', suffix=suffix):
555 return os.path.join(FLAGS.instances_path,555 return os.path.join(FLAGS.instances_path,
556 inst['name'],556 inst['name'],
557 prefix + fname)557 fname + suffix)
558558
559 # ensure directories exist and are writable559 # ensure directories exist and are writable
560 utils.execute('mkdir -p %s' % basepath(prefix=''))560 utils.execute('mkdir -p %s' % basepath(suffix=''))
561 utils.execute('chmod 0777 %s' % basepath(prefix=''))561 utils.execute('chmod 0777 %s' % basepath(suffix=''))
562562
563 LOG.info(_('instance %s: Creating image'), inst['name'])563 LOG.info(_('instance %s: Creating image'), inst['name'])
564 f = open(basepath('libvirt.xml'), 'w')564 f = open(basepath('libvirt.xml'), 'w')
565 f.write(libvirt_xml)565 f.write(libvirt_xml)
566 f.close()566 f.close()
567567
568 # NOTE(vish): No need add the prefix to console.log568 # NOTE(vish): No need add the suffix to console.log
569 os.close(os.open(basepath('console.log', ''),569 os.close(os.open(basepath('console.log', ''),
570 os.O_CREAT | os.O_WRONLY, 0660))570 os.O_CREAT | os.O_WRONLY, 0660))
571571
@@ -594,7 +594,7 @@
594594
595 root_fname = disk_images['image_id']595 root_fname = disk_images['image_id']
596 size = FLAGS.minimum_root_size596 size = FLAGS.minimum_root_size
597 if inst['instance_type'] == 'm1.tiny' or prefix == 'rescue-':597 if inst['instance_type'] == 'm1.tiny' or suffix == '.rescue':
598 size = None598 size = None
599 root_fname += "_sm"599 root_fname += "_sm"
600600
@@ -610,7 +610,7 @@
610610
611 if type_data['local_gb']:611 if type_data['local_gb']:
612 self._cache_image(fn=self._create_local,612 self._cache_image(fn=self._create_local,
613 target=basepath('local'),613 target=basepath('disk.local'),
614 fname="local_%s" % type_data['local_gb'],614 fname="local_%s" % type_data['local_gb'],
615 cow=FLAGS.use_cow_images,615 cow=FLAGS.use_cow_images,
616 local_gb=type_data['local_gb'])616 local_gb=type_data['local_gb'])