Exemplo n.º 1
0
def run(driver, driver_info):
    """Convenience method to run command on the given driver"""
    cmd = SRCommand(driver_info)
    try:
        cmd.parse()
        cmd.run_statics()
        sr = driver(cmd, cmd.sr_uuid)
        sr.direct = True
        ret = cmd.run(sr)

        if ret == None:
            print util.return_nil ()
        else:
            print ret

    except (Exception, SR.SRException) as e:
        try:
            util.logException(driver_info['name'])
        except KeyError:
            util.SMlog('driver_info does not contain a \'name\' key.')
        except:
            pass

        # If exception is of type SR.SRException,
        # pass to xapi, else re-raise.
        if isinstance(e, SR.SRException):
            print e.toxml()
        else:
            raise

    sys.exit(0)
Exemplo n.º 2
0
def run(driver, driver_info):
    """Convenience method to run command on the given driver"""
    cmd = SRCommand(driver_info)
    try:
        cmd.parse()
        cmd.run_statics()
        sr = driver(cmd, cmd.sr_uuid)
        sr.direct = True
        ret = cmd.run(sr)

        if ret == None:
            print util.return_nil()
        else:
            print ret

    except (Exception, SR.SRException) as e:
        try:
            util.logException(driver_info['name'])
        except KeyError:
            util.SMlog('driver_info does not contain a \'name\' key.')
        except:
            pass

        # If exception is of type SR.SRException, pass to Xapi.
        # If generic python Exception, print a generic xmlrpclib
        # dump and pass to XAPI.
        if isinstance(e, SR.SRException):
            print e.toxml()
        else:
            print xmlrpclib.dumps(xmlrpclib.Fault(1200, str(e)), "", True)

    sys.exit(0)
Exemplo n.º 3
0
def run(driver, driver_info):
    """Convenience method to run command on the given driver"""
    cmd = SRCommand(driver_info)
    try:
        cmd.parse()
        cmd.run_statics()
        sr = driver(cmd, cmd.sr_uuid)
        sr.direct = True
        ret = cmd.run(sr)

        if ret == None:
            print util.return_nil ()
        else:
            print ret

    except (Exception, SR.SRException) as e:
        try:
            util.logException(driver_info['name'])
        except KeyError:
            util.SMlog('driver_info does not contain a \'name\' key.')
        except:
            pass

        # If exception is of type SR.SRException, pass to Xapi.
        # If generic python Exception, print a generic xmlrpclib
        # dump and pass to XAPI.
        if isinstance(e, SR.SRException):
            print e.toxml()
        else:
            print xmlrpclib.dumps(xmlrpclib.Fault(1200, str(e)), "", True) 

    sys.exit(0)
Exemplo n.º 4
0
def run(driver, driver_info):
    """Convenience method to run command on the given driver"""
    cmd = SRCommand(driver_info)
    try:
        cmd.parse()
        cmd.run_statics()
        sr = driver(cmd, cmd.sr_uuid)
        sr.direct = True
        ret = cmd.run(sr)

        if ret == None:
            print util.return_nil()
        else:
            print ret

    except Exception, e:
        try:
            util.logException(driver_info['name'])
        except KeyError:
            util.SMlog('driver_info does not contain a \'name\' key.')
        except:
            pass

        # If exception is of type SR.SRException,
        # pass to xapi, else re-raise.
        if isinstance(e, SR.SRException):
            print e.toxml()
        else:
            raise
Exemplo n.º 5
0
def run(driver, driver_info):
    """Convenience method to run command on the given driver"""
    cmd = SRCommand(driver_info)
    try:
        cmd.parse()
        cmd.run_statics()
        sr = driver(cmd, cmd.sr_uuid)
        sr.direct = True
        ret = cmd.run(sr)

        if ret == None:
            print util.return_nil()
        else:
            print ret
        sys.exit(0)

    except SR.SRException, inst:
        print inst.toxml()
        sys.exit(0)
Exemplo n.º 6
0
Arquivo: SRCommand.py Projeto: ESDS/sm
def run(driver, driver_info):
    """Convenience method to run command on the given driver"""
    cmd = SRCommand(driver_info)
    try:
        cmd.parse()
        cmd.run_statics()
        sr = driver(cmd, cmd.sr_uuid)
        sr.direct = True
        ret = cmd.run(sr)

        if ret == None:
            print util.return_nil ()
        else:
            print ret
        sys.exit(0)
        
    except SR.SRException, inst:
        print inst.toxml()
        sys.exit(0)