# HG changeset patch # User kfraser@localhost.localdomain # Date 1181730467 -3600 # Node ID ffdbe8aebde21710deca4ae84bba95e38f4b089b # Parent 7f9362a8ae3daeb5dc7bc62069eae872c42a5a14 xenapi: Implement XenAPI method VBD.set_mode in python. Signed-off-by: Jim Fehlig Index: xen-3.1-testing/tools/python/xen/xend/XendAPI.py =================================================================== --- xen-3.1-testing.orig/tools/python/xen/xend/XendAPI.py +++ xen-3.1-testing/tools/python/xen/xend/XendAPI.py @@ -1873,6 +1873,17 @@ class XendAPI(object): xd.managed_config_save(vm) return xen_api_success_void() + def VBD_set_mode(self, session, vbd_ref, mode): + if mode == 'RW': + mode = 'w' + else: + mode = 'r' + xd = XendDomain.instance() + vm = xd.get_vm_with_dev_uuid('vbd', vbd_ref) + vm.set_dev_property('vbd', vbd_ref, 'mode', mode) + xd.managed_config_save(vm) + return xen_api_success_void() + def VBD_get_all(self, session): xendom = XendDomain.instance() vbds = [d.get_vbds() for d in XendDomain.instance().list('all')]