Let xm commands use domids with XenAPI

signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
This commit is contained in:
Tom Wilkie committed 2007-03-29 17:09:49 +01:00
1 parent 90bc7dea0e
commit 5e7badb941
1 file changed
+14 -4
+14 -4
View File
@@ -560,11 +560,21 @@ def err(msg):
def get_single_vm(dom):
if serverType == SERVER_XEN_API:
uuids = server.xenapi.VM.get_by_name_label(dom)
n = len(uuids)
if n > 0:
if len(uuids) > 0:
return uuids[0]
else:
raise OptionError("Domain '%s' not found." % dom)
try:
domid = int(dom)
uuids = [server.xenapi.VM.get_domid(vm_ref)
for vm_ref in server.xenapi.VM.get_all()
if int(server.xenapi.VM.get_domid(vm_ref)) == domid]
except:
pass
if len(uuids) > 0:
return uuids[0]
raise OptionError("Domain '%s' not found." % dom)
else:
dominfo = server.xend.domain(dom, False)
return dominfo['uuid']
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.