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

Proposed by Vish Ishaya
Status: Merged
Approved by: Vish Ishaya
Approved revision: 476
Merged at revision: 486
Proposed branch: lp:~vishvananda/nova/fix-reboot
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 122 lines (+5/-71)
4 files modified
nova/compute/manager.py (+3/-1)
nova/virt/libvirt.rescue.qemu.xml.template.THIS (+0/-38)
nova/virt/libvirt.rescue.uml.xml.template.THIS (+0/-31)
nova/virt/libvirt_conn.py (+2/-1)
To merge this branch: bzr merge lp:~vishvananda/nova/fix-reboot
Reviewer Review Type Date Requested Status
Jesse Andrews (community) Approve
Ed Leafe (community) Approve
Review via email: mp+44532@code.launchpad.net

Description of the change

Fixes reboot (and rescue) to work even if libvirt doesn't know about the instance and the network doesn't exist.

To post a comment you must log in.
Revision history for this message
Vish Ishaya (vishvananda) wrote :

note: there were a couple extra merge artifact files (the .THIS) which i removed in this patch as well.

Revision history for this message
Ed Leafe (ed-leafe) wrote :

Changes look good to me.

review: Approve
Revision history for this message
Jesse Andrews (anotherjesse) wrote :

lgtm

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

lgtm

lp:~vishvananda/nova/fix-reboot updated
476. By Vish Ishaya

merged trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/compute/manager.py'
2--- nova/compute/manager.py 2010-12-22 21:38:44 +0000
3+++ nova/compute/manager.py 2010-12-22 23:02:52 +0000
4@@ -205,8 +205,8 @@
5 def reboot_instance(self, context, instance_id):
6 """Reboot an instance on this server."""
7 context = context.elevated()
8+ self._update_state(context, instance_id)
9 instance_ref = self.db.instance_get(context, instance_id)
10- self._update_state(context, instance_id)
11
12 if instance_ref['state'] != power_state.RUNNING:
13 logging.warn(_('trying to reboot a non-running '
14@@ -220,6 +220,7 @@
15 instance_id,
16 power_state.NOSTATE,
17 'rebooting')
18+ self.network_manager.setup_compute_network(context, instance_id)
19 self.driver.reboot(instance_ref)
20 self._update_state(context, instance_id)
21
22@@ -235,6 +236,7 @@
23 instance_id,
24 power_state.NOSTATE,
25 'rescuing')
26+ self.network_manager.setup_compute_network(context, instance_id)
27 self.driver.rescue(instance_ref)
28 self._update_state(context, instance_id)
29
30
31=== removed file 'nova/virt/libvirt.rescue.qemu.xml.template.THIS'
32--- nova/virt/libvirt.rescue.qemu.xml.template.THIS 2010-12-22 20:59:53 +0000
33+++ nova/virt/libvirt.rescue.qemu.xml.template.THIS 1970-01-01 00:00:00 +0000
34@@ -1,38 +0,0 @@
35-<domain type='%(type)s'>
36- <name>%(name)s</name>
37- <os>
38- <type>hvm</type>
39- <kernel>%(basepath)s/rescue-kernel</kernel>
40- <initrd>%(basepath)s/rescue-ramdisk</initrd>
41- <cmdline>root=/dev/vda1 console=ttyS0</cmdline>
42- </os>
43- <features>
44- <acpi/>
45- </features>
46- <memory>%(memory_kb)s</memory>
47- <vcpu>%(vcpus)s</vcpu>
48- <devices>
49- <disk type='file'>
50- <source file='%(basepath)s/rescue-disk'/>
51- <target dev='vda' bus='virtio'/>
52- </disk>
53- <disk type='file'>
54- <source file='%(basepath)s/disk'/>
55- <target dev='vdb' bus='virtio'/>
56- </disk>
57- <interface type='bridge'>
58- <source bridge='%(bridge_name)s'/>
59- <mac address='%(mac_address)s'/>
60- <!-- <model type='virtio'/> CANT RUN virtio network right now -->
61- <filterref filter="nova-instance-%(name)s">
62- <parameter name="IP" value="%(ip_address)s" />
63- <parameter name="DHCPSERVER" value="%(dhcp_server)s" />
64- %(extra_params)s
65- </filterref>
66- </interface>
67- <serial type="file">
68- <source path='%(basepath)s/console.log'/>
69- <target port='1'/>
70- </serial>
71- </devices>
72-</domain>
73
74=== removed file 'nova/virt/libvirt.rescue.uml.xml.template.THIS'
75--- nova/virt/libvirt.rescue.uml.xml.template.THIS 2010-12-22 20:59:53 +0000
76+++ nova/virt/libvirt.rescue.uml.xml.template.THIS 1970-01-01 00:00:00 +0000
77@@ -1,31 +0,0 @@
78-<domain type='%(type)s'>
79- <name>%(name)s</name>
80- <memory>%(memory_kb)s</memory>
81- <os>
82- <type>%(type)s</type>
83- <kernel>/usr/bin/linux</kernel>
84- <root>/dev/ubda1</root>
85- </os>
86- <devices>
87- <disk type='file'>
88- <source file='%(basepath)s/rescue-disk'/>
89- <target dev='ubd0' bus='uml'/>
90- </disk>
91- <disk type='file'>
92- <source file='%(basepath)s/disk'/>
93- <target dev='ubd1' bus='uml'/>
94- </disk>
95- <interface type='bridge'>
96- <source bridge='%(bridge_name)s'/>
97- <mac address='%(mac_address)s'/>
98- <filterref filter="nova-instance-%(name)s">
99- <parameter name="IP" value="%(ip_address)s" />
100- <parameter name="DHCPSERVER" value="%(dhcp_server)s" />
101- %(extra_params)s
102- </filterref>
103- </interface>
104- <console type="file">
105- <source path='%(basepath)s/console.log'/>
106- </console>
107- </devices>
108-</domain>
109
110=== modified file 'nova/virt/libvirt_conn.py'
111--- nova/virt/libvirt_conn.py 2010-12-22 21:38:44 +0000
112+++ nova/virt/libvirt_conn.py 2010-12-22 23:02:52 +0000
113@@ -192,7 +192,8 @@
114 # everything has been vetted a bit
115 def _wait_for_timer():
116 timer_done.wait()
117- self._cleanup(instance)
118+ if cleanup:
119+ self._cleanup(instance)
120 done.send()
121
122 greenthread.spawn(_wait_for_timer)