summaryrefslogtreecommitdiff
path: root/nova/virt/xenapi/client
diff options
context:
space:
mode:
authorJohn Garbutt <john.garbutt@rackspace.com>2014-02-10 22:13:22 -0700
committerJohn Garbutt <john.garbutt@rackspace.com>2014-02-28 11:45:50 +0000
commit355e724387c04b644f4149472b827bda9377827c (patch)
tree024cd6223b5836f37067471f58e9b40cad8b4ddc /nova/virt/xenapi/client
parentc9480634c232d8afbdcd01c63f6650f71b748543 (diff)
downloadnova-355e724387c04b644f4149472b827bda9377827c.tar.gz
Move vbd plug/unplug into session object
To make it easier not to miss the VBD plug/unplug workaround I have moved this into the xenapi object, overriding the regular method. Change-Id: Ia0e677824b2bf700c5fb73a75c335f74a6ebb6a2
Diffstat (limited to 'nova/virt/xenapi/client')
-rw-r--r--nova/virt/xenapi/client/objects.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/nova/virt/xenapi/client/objects.py b/nova/virt/xenapi/client/objects.py
index 1dfc2a8e57..a358d41b8e 100644
--- a/nova/virt/xenapi/client/objects.py
+++ b/nova/virt/xenapi/client/objects.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from nova import utils
+
class XenAPISessionObject(object):
"""Wrapper to make calling and mocking the session easier
@@ -71,6 +73,26 @@ class VBD(XenAPISessionObject):
def __init__(self, session):
super(VBD, self).__init__(session, "VBD")
+ def plug(self, vbd_ref, vm_ref):
+ @utils.synchronized('xenapi-vbd-' + vm_ref)
+ def synchronized_plug():
+ self._call_method("plug", vbd_ref)
+
+ # NOTE(johngarbutt) we need to ensure there is only ever one
+ # VBD.unplug or VBD.plug happening at once per VM
+ # due to a bug in XenServer 6.1 and 6.2
+ synchronized_plug()
+
+ def unplug(self, vbd_ref, vm_ref):
+ @utils.synchronized('xenapi-vbd-' + vm_ref)
+ def synchronized_unplug():
+ self._call_method("unplug", vbd_ref)
+
+ # NOTE(johngarbutt) we need to ensure there is only ever one
+ # VBD.unplug or VBD.plug happening at once per VM
+ # due to a bug in XenServer 6.1 and 6.2
+ synchronized_unplug()
+
class VDI(XenAPISessionObject):
"""Virtual disk image."""