ia64/xen-unstable

changeset 19212:5ae8ed54e2cd

xenapi: Correct some syntax errors in xen/xend/XendAPI.py

- usage of undefined variables in error cases (invalid handle
specified) in methods VBD_create, VTPM_destroy, event_unregister
- not imported module 'uuid' in method debug_create results in an
exception

Signed-off-by: Lutz Dube <Lutz.Dube@fujitsu-siemens.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Feb 13 09:38:16 2009 +0000 (2009-02-13)
parents 9ac547ed9455
children d9480422034b
files tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Fri Feb 13 09:36:58 2009 +0000
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Fri Feb 13 09:38:16 2009 +0000
     1.3 @@ -29,6 +29,7 @@ import xmlrpclib
     1.4  import XendDomain, XendDomainInfo, XendNode, XendDmesg
     1.5  import XendLogging, XendTaskManager, XendAPIStore
     1.6  
     1.7 +from xen.xend import uuid as genuuid
     1.8  from XendAPIVersion import *
     1.9  from XendAuthSessions import instance as auth_manager
    1.10  from XendError import *
    1.11 @@ -1867,7 +1868,7 @@ class XendAPI(object):
    1.12          dom = xendom.get_vm_by_uuid(vbd_struct['VM'])
    1.13          vdi = xennode.get_vdi_by_uuid(vbd_struct['VDI'])
    1.14          if not vdi:
    1.15 -            return xen_api_error(['HANDLE_INVALID', 'VDI', vdi_ref])
    1.16 +            return xen_api_error(['HANDLE_INVALID', 'VDI', vbd_struct['VDI']])
    1.17  
    1.18          # new VBD via VDI/SR
    1.19          vdi_image = vdi.get_location()
    1.20 @@ -2392,7 +2393,7 @@ class XendAPI(object):
    1.21              tpmif.destroy_vtpmstate(dom.getName())
    1.22              return xen_api_success_void()
    1.23          else:
    1.24 -            return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
    1.25 +            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
    1.26  
    1.27      # class methods
    1.28      def VTPM_create(self, session, vtpm_struct):
    1.29 @@ -2614,7 +2615,7 @@ class XendAPI(object):
    1.30          return xen_api_success_void()
    1.31  
    1.32      def event_unregister(self, session, unreg_classes):
    1.33 -        event_unregister(session, reg_classes)
    1.34 +        event_unregister(session, unreg_classes)
    1.35          return xen_api_success_void()
    1.36  
    1.37      def event_next(self, session):
    1.38 @@ -2641,7 +2642,7 @@ class XendAPI(object):
    1.39          return xen_api_error(['DEBUG_FAIL', session])
    1.40  
    1.41      def debug_create(self, session):
    1.42 -        debug_uuid = uuid.createString()
    1.43 +        debug_uuid = genuuid.createString()
    1.44          self._debug[debug_uuid] = None
    1.45          return xen_api_success(debug_uuid)
    1.46