1 |
prometheanfire 14/06/09 04:56:40 |
2 |
|
3 |
Added: 2014.1-CVE-2014-2573-2.patch |
4 |
2014.1-CVE-2014-2573-1.patch |
5 |
Log: |
6 |
fix for 2014.1-r1 bug 512296 CVE-2014-2573 |
7 |
|
8 |
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0x2471eb3e40ac5ac3) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 sys-cluster/nova/files/2014.1-CVE-2014-2573-2.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/nova/files/2014.1-CVE-2014-2573-2.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/nova/files/2014.1-CVE-2014-2573-2.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: 2014.1-CVE-2014-2573-2.patch |
17 |
=================================================================== |
18 |
From ffcb17678c7e5409a1f12a09945b18e8879a677d Mon Sep 17 00:00:00 2001 |
19 |
From: Gary Kotton <gkotton@××××××.com> |
20 |
Date: Thu, 13 Mar 2014 06:53:58 -0700 |
21 |
Subject: [PATCH] VMware: ensure rescue instance is deleted when instance is |
22 |
deleted |
23 |
|
24 |
If the user creates a rescue instance and then proceeded to delete |
25 |
the original instance then the rescue instance would still be up |
26 |
and running on the backend. |
27 |
|
28 |
This patch ensures that the rescue instance is cleaned up if |
29 |
necessary. |
30 |
|
31 |
The vmops unrescue method has a new parameter indicating if |
32 |
the original VM should be powered on. |
33 |
|
34 |
Closes-bug: 1269418 |
35 |
(cherry picked from commit efb66531bc37ee416778a70d46c657608ca767af) |
36 |
|
37 |
Conflicts: |
38 |
|
39 |
nova/virt/vmwareapi/vmops.py |
40 |
|
41 |
Change-Id: I3c1d0b1d003392b306094b80ea1ac99377441fbf |
42 |
--- |
43 |
nova/tests/virt/vmwareapi/test_driver_api.py | 26 +++++++++++++ |
44 |
nova/virt/vmwareapi/vmops.py | 55 ++++++++++++++++++++-------- |
45 |
2 files changed, 65 insertions(+), 16 deletions(-) |
46 |
|
47 |
diff --git a/nova/tests/virt/vmwareapi/test_driver_api.py b/nova/tests/virt/vmwareapi/test_driver_api.py |
48 |
index c1481aa..63f0c59 100644 |
49 |
--- a/nova/tests/virt/vmwareapi/test_driver_api.py |
50 |
+++ b/nova/tests/virt/vmwareapi/test_driver_api.py |
51 |
@@ -34,6 +34,7 @@ |
52 |
from nova.compute import api as compute_api |
53 |
from nova.compute import power_state |
54 |
from nova.compute import task_states |
55 |
+from nova.compute import vm_states |
56 |
from nova import context |
57 |
from nova import exception |
58 |
from nova.openstack.common import jsonutils |
59 |
@@ -1191,6 +1192,31 @@ def test_get_info(self): |
60 |
'node': self.instance_node}) |
61 |
self._check_vm_info(info, power_state.RUNNING) |
62 |
|
63 |
+ def destroy_rescued(self, fake_method): |
64 |
+ self._rescue() |
65 |
+ with ( |
66 |
+ mock.patch.object(self.conn._volumeops, "detach_disk_from_vm", |
67 |
+ fake_method) |
68 |
+ ): |
69 |
+ self.instance['vm_state'] = vm_states.RESCUED |
70 |
+ self.conn.destroy(self.context, self.instance, self.network_info) |
71 |
+ inst_path = '[%s] %s/%s.vmdk' % (self.ds, self.uuid, self.uuid) |
72 |
+ self.assertFalse(vmwareapi_fake.get_file(inst_path)) |
73 |
+ rescue_file_path = '[%s] %s-rescue/%s-rescue.vmdk' % (self.ds, |
74 |
+ self.uuid, |
75 |
+ self.uuid) |
76 |
+ self.assertFalse(vmwareapi_fake.get_file(rescue_file_path)) |
77 |
+ |
78 |
+ def test_destroy_rescued(self): |
79 |
+ def fake_detach_disk_from_vm(*args, **kwargs): |
80 |
+ pass |
81 |
+ self.destroy_rescued(fake_detach_disk_from_vm) |
82 |
+ |
83 |
+ def test_destroy_rescued_with_exception(self): |
84 |
+ def fake_detach_disk_from_vm(*args, **kwargs): |
85 |
+ raise exception.NovaException('Here is my fake exception') |
86 |
+ self.destroy_rescued(fake_detach_disk_from_vm) |
87 |
+ |
88 |
def test_destroy(self): |
89 |
self._create_vm() |
90 |
info = self.conn.get_info({'uuid': self.uuid, |
91 |
diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py |
92 |
index 30f8373..831da48 100644 |
93 |
--- a/nova/virt/vmwareapi/vmops.py |
94 |
+++ b/nova/virt/vmwareapi/vmops.py |
95 |
@@ -29,6 +29,7 @@ |
96 |
from nova import compute |
97 |
from nova.compute import power_state |
98 |
from nova.compute import task_states |
99 |
+from nova.compute import vm_states |
100 |
from nova import context as nova_context |
101 |
from nova import exception |
102 |
from nova.openstack.common import excutils |
103 |
@@ -985,13 +986,9 @@ def _delete(self, instance, network_info): |
104 |
except Exception as exc: |
105 |
LOG.exception(exc, instance=instance) |
106 |
|
107 |
- def destroy(self, instance, network_info, destroy_disks=True, |
108 |
- instance_name=None): |
109 |
- """Destroy a VM instance. Steps followed are: |
110 |
- 1. Power off the VM, if it is in poweredOn state. |
111 |
- 2. Un-register a VM. |
112 |
- 3. Delete the contents of the folder holding the VM related data. |
113 |
- """ |
114 |
+ def _destroy_instance(self, instance, network_info, destroy_disks=True, |
115 |
+ instance_name=None): |
116 |
+ # Destroy a VM instance |
117 |
# Get the instance name. In some cases this may differ from the 'uuid', |
118 |
# for example when the spawn of a rescue instance takes place. |
119 |
if not instance_name: |
120 |
@@ -1029,8 +1026,9 @@ def destroy(self, instance, network_info, destroy_disks=True, |
121 |
"UnregisterVM", vm_ref) |
122 |
LOG.debug(_("Unregistered the VM"), instance=instance) |
123 |
except Exception as excep: |
124 |
- LOG.warn(_("In vmwareapi:vmops:destroy, got this exception" |
125 |
- " while un-registering the VM: %s") % str(excep)) |
126 |
+ LOG.warn(_("In vmwareapi:vmops:_destroy_instance, got this " |
127 |
+ "exception while un-registering the VM: %s"), |
128 |
+ excep) |
129 |
# Delete the folder holding the VM related content on |
130 |
# the datastore. |
131 |
if destroy_disks and datastore_name: |
132 |
@@ -1053,15 +1051,39 @@ def destroy(self, instance, network_info, destroy_disks=True, |
133 |
{'datastore_name': datastore_name}, |
134 |
instance=instance) |
135 |
except Exception as excep: |
136 |
- LOG.warn(_("In vmwareapi:vmops:destroy, " |
137 |
- "got this exception while deleting" |
138 |
- " the VM contents from the disk: %s") |
139 |
- % str(excep)) |
140 |
+ LOG.warn(_("In vmwareapi:vmops:_destroy_instance, " |
141 |
+ "got this exception while deleting " |
142 |
+ "the VM contents from the disk: %s"), |
143 |
+ excep) |
144 |
except Exception as exc: |
145 |
LOG.exception(exc, instance=instance) |
146 |
finally: |
147 |
vm_util.vm_ref_cache_delete(instance_name) |
148 |
|
149 |
+ def destroy(self, instance, network_info, destroy_disks=True): |
150 |
+ """Destroy a VM instance. |
151 |
+ |
152 |
+ Steps followed for each VM are: |
153 |
+ 1. Power off, if it is in poweredOn state. |
154 |
+ 2. Un-register. |
155 |
+ 3. Delete the contents of the folder holding the VM related data. |
156 |
+ """ |
157 |
+ # If there is a rescue VM then we need to destroy that one too. |
158 |
+ LOG.debug(_("Destroying instance"), instance=instance) |
159 |
+ if instance['vm_state'] == vm_states.RESCUED: |
160 |
+ LOG.debug(_("Rescue VM configured"), instance=instance) |
161 |
+ try: |
162 |
+ self.unrescue(instance, power_on=False) |
163 |
+ LOG.debug(_("Rescue VM destroyed"), instance=instance) |
164 |
+ except Exception: |
165 |
+ rescue_name = instance['uuid'] + self._rescue_suffix |
166 |
+ self._destroy_instance(instance, network_info, |
167 |
+ destroy_disks=destroy_disks, |
168 |
+ instance_name=rescue_name) |
169 |
+ self._destroy_instance(instance, network_info, |
170 |
+ destroy_disks=destroy_disks) |
171 |
+ LOG.debug(_("Instance destroyed"), instance=instance) |
172 |
+ |
173 |
def pause(self, instance): |
174 |
msg = _("pause not supported for vmwareapi") |
175 |
raise NotImplementedError(msg) |
176 |
@@ -1139,7 +1161,7 @@ def rescue(self, context, instance, network_info, image_meta): |
177 |
adapter_type, disk_type, vmdk_path) |
178 |
self._power_on(instance, vm_ref=rescue_vm_ref) |
179 |
|
180 |
- def unrescue(self, instance): |
181 |
+ def unrescue(self, instance, power_on=True): |
182 |
"""Unrescue the specified instance.""" |
183 |
# Get the original vmdk_path |
184 |
vm_ref = vm_util.get_vm_ref(self._session, instance) |
185 |
@@ -1161,8 +1183,9 @@ def unrescue(self, instance): |
186 |
device = vm_util.get_vmdk_volume_disk(hardware_devices, path=vmdk_path) |
187 |
self._power_off_vm_ref(vm_rescue_ref) |
188 |
self._volumeops.detach_disk_from_vm(vm_rescue_ref, r_instance, device) |
189 |
- self.destroy(r_instance, None, instance_name=instance_name) |
190 |
- self._power_on(instance) |
191 |
+ self._destroy_instance(r_instance, None, instance_name=instance_name) |
192 |
+ if power_on: |
193 |
+ self._power_on(instance) |
194 |
|
195 |
def _power_off_vm_ref(self, vm_ref): |
196 |
"""Power off the specifed vm. |
197 |
-- |
198 |
1.9.3 |
199 |
|
200 |
|
201 |
|
202 |
|
203 |
1.1 sys-cluster/nova/files/2014.1-CVE-2014-2573-1.patch |
204 |
|
205 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/nova/files/2014.1-CVE-2014-2573-1.patch?rev=1.1&view=markup |
206 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-cluster/nova/files/2014.1-CVE-2014-2573-1.patch?rev=1.1&content-type=text/plain |
207 |
|
208 |
Index: 2014.1-CVE-2014-2573-1.patch |
209 |
=================================================================== |
210 |
From fb030283bed9e41a0343581fa21b81b2ebb07f15 Mon Sep 17 00:00:00 2001 |
211 |
From: Xiaoyan Ding <xyding@××××××.com> |
212 |
Date: Mon, 24 Feb 2014 16:17:46 +0800 |
213 |
Subject: [PATCH] VMWare: add power off vm before detach disk during unrescue |
214 |
|
215 |
Non Hot Plug type disk like IDE can only be detached when the VM is power off. |
216 |
|
217 |
Change-Id: Ib1f387a41abe2b52357854e90c2535ebb7b43f18 |
218 |
Close-bug: #1279199 |
219 |
(cherry picked from commit 1e1915aaaca38b5691794e0e052a42b9d95dd3c2) |
220 |
--- |
221 |
nova/tests/virt/vmwareapi/test_driver_api.py | 27 ++++++++++++++++++++++----- |
222 |
nova/virt/vmwareapi/vmops.py | 21 ++++++++++++++++----- |
223 |
2 files changed, 38 insertions(+), 10 deletions(-) |
224 |
|
225 |
diff --git a/nova/tests/virt/vmwareapi/test_driver_api.py b/nova/tests/virt/vmwareapi/test_driver_api.py |
226 |
index fb60335..c1481aa 100644 |
227 |
--- a/nova/tests/virt/vmwareapi/test_driver_api.py |
228 |
+++ b/nova/tests/virt/vmwareapi/test_driver_api.py |
229 |
@@ -1273,14 +1273,31 @@ def test_rescue_with_config_drive(self): |
230 |
|
231 |
def test_unrescue(self): |
232 |
self._rescue() |
233 |
+ self.test_vm_ref = None |
234 |
+ self.test_device_name = None |
235 |
|
236 |
- def fake_detach_disk_from_vm(*args, **kwargs): |
237 |
- pass |
238 |
+ def fake_power_off_vm_ref(vm_ref): |
239 |
+ self.test_vm_ref = vm_ref |
240 |
+ self.assertIsNotNone(vm_ref) |
241 |
|
242 |
- self.stubs.Set(self.conn._volumeops, "detach_disk_from_vm", |
243 |
- fake_detach_disk_from_vm) |
244 |
+ def fake_detach_disk_from_vm(vm_ref, instance, |
245 |
+ device_name, destroy_disk=False): |
246 |
+ self.test_device_name = device_name |
247 |
+ info = self.conn.get_info(instance) |
248 |
+ self._check_vm_info(info, power_state.SHUTDOWN) |
249 |
|
250 |
- self.conn.unrescue(self.instance, None) |
251 |
+ with contextlib.nested( |
252 |
+ mock.patch.object(self.conn._vmops, "_power_off_vm_ref", |
253 |
+ side_effect=fake_power_off_vm_ref), |
254 |
+ mock.patch.object(self.conn._volumeops, "detach_disk_from_vm", |
255 |
+ side_effect=fake_detach_disk_from_vm), |
256 |
+ ) as (poweroff, detach): |
257 |
+ self.conn.unrescue(self.instance, None) |
258 |
+ poweroff.assert_called_once_with(self.test_vm_ref) |
259 |
+ detach.assert_called_once_with(self.test_vm_ref, mock.ANY, |
260 |
+ self.test_device_name) |
261 |
+ self.test_vm_ref = None |
262 |
+ self.test_device_name = None |
263 |
info = self.conn.get_info({'name': 1, 'uuid': self.uuid, |
264 |
'node': self.instance_node}) |
265 |
self._check_vm_info(info, power_state.RUNNING) |
266 |
diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py |
267 |
index 0c28a29..30f8373 100644 |
268 |
--- a/nova/virt/vmwareapi/vmops.py |
269 |
+++ b/nova/virt/vmwareapi/vmops.py |
270 |
@@ -1159,12 +1159,26 @@ def unrescue(self, instance): |
271 |
"get_dynamic_property", vm_rescue_ref, |
272 |
"VirtualMachine", "config.hardware.device") |
273 |
device = vm_util.get_vmdk_volume_disk(hardware_devices, path=vmdk_path) |
274 |
+ self._power_off_vm_ref(vm_rescue_ref) |
275 |
self._volumeops.detach_disk_from_vm(vm_rescue_ref, r_instance, device) |
276 |
self.destroy(r_instance, None, instance_name=instance_name) |
277 |
self._power_on(instance) |
278 |
|
279 |
+ def _power_off_vm_ref(self, vm_ref): |
280 |
+ """Power off the specifed vm. |
281 |
+ |
282 |
+ :param vm_ref: a reference object to the VM. |
283 |
+ """ |
284 |
+ poweroff_task = self._session._call_method( |
285 |
+ self._session._get_vim(), |
286 |
+ "PowerOffVM_Task", vm_ref) |
287 |
+ self._session._wait_for_task(poweroff_task) |
288 |
+ |
289 |
def power_off(self, instance): |
290 |
- """Power off the specified instance.""" |
291 |
+ """Power off the specified instance. |
292 |
+ |
293 |
+ :param instance: nova.objects.instance.Instance |
294 |
+ """ |
295 |
vm_ref = vm_util.get_vm_ref(self._session, instance) |
296 |
|
297 |
pwr_state = self._session._call_method(vim_util, |
298 |
@@ -1173,10 +1187,7 @@ def power_off(self, instance): |
299 |
# Only PoweredOn VMs can be powered off. |
300 |
if pwr_state == "poweredOn": |
301 |
LOG.debug(_("Powering off the VM"), instance=instance) |
302 |
- poweroff_task = self._session._call_method( |
303 |
- self._session._get_vim(), |
304 |
- "PowerOffVM_Task", vm_ref) |
305 |
- self._session._wait_for_task(poweroff_task) |
306 |
+ self._power_off_vm_ref(vm_ref) |
307 |
LOG.debug(_("Powered off the VM"), instance=instance) |
308 |
# Raise Exception if VM is suspended |
309 |
elif pwr_state == "suspended": |
310 |
-- |
311 |
1.9.3 |