当前位置: 首页>>代码示例>>Python>>正文


Python AgentUtils类代码示例

本文整理汇总了Python中AgentUtils的典型用法代码示例。如果您正苦于以下问题:Python AgentUtils类的具体用法?Python AgentUtils怎么用?Python AgentUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AgentUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CheckInstallErrorCode

def CheckInstallErrorCode(Framework):
    if AgentUtils.isUpgradeProcess(Framework):
        if AgentUtils.isUpgradeByUDAgent(Framework):
            client = Framework.getConnectedClient()
            agentVersion = client.getVersion()
            logger.debug("The current agent version is:", agentVersion)

            connectedUDACredentialId = client.getCredentialId()
            logger.debug('Credential id on remote:', connectedUDACredentialId)

            installCredentialId = Framework.getParameter(AgentUtils.UDAGENT_CONNECT_CREDENTIAL_ID_PARAM)
            logger.debug('Credential id for upgrade:', installCredentialId)

            if not AgentUtils.versionsEqual(Framework, agentVersion) or (installCredentialId
                                                                         and installCredentialId != connectedUDACredentialId):
                logger.debug("Notice: The connected client is still old UDA.")
        errorCode = AgentUtils.getUpgradeErrorCode(Framework)
    else:
        errorCode = AgentUtils.getInstallErrorCode(Framework)
    if errorCode:
        if errorCode.isSuccess():
            Framework.setProperty(CheckAgentInstalled.FIRST_TRY_INSTALL_AGENT,
                                  CheckAgentInstalled.FIRST_TRY_INSTALL_AGENT)
            Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
        elif errorCode.isInProgress():
            logger.debug('UDA install command is in progress, will check after parking')
            Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
        else:
            logger.debug('Failed to install UDA according to install error code.')
            Framework.reportError("Install/Upgrade UDA failed. Reason is:%s" % errorCode.getMessage())
            Framework.setStepExecutionStatus(WorkflowStepStatus.FATAL_FAILURE)
    else:
        logger.debug('Can not get error code now, will check after parking')
        Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:34,代码来源:CheckInstallErrorCode.py

示例2: unInstallAgent

def unInstallAgent(Framework):
    protocolName = Framework.getProperty(InventoryUtils.STATE_PROPERTY_CONNECTED_SHELL_PROTOCOL_NAME)
    logger.debug('Protocal name: ', protocolName)

    client = Framework.getConnectedClient()
    uduid = InventoryUtils.getUduid(client)
    logger.debug('UD_UNIQUE_ID: ', uduid)
    Framework.setProperty(InventoryUtils.ATTR_UD_UNIQUE_ID, uduid)

    if protocolName == ClientsConsts.DDM_AGENT_PROTOCOL_NAME:
        # Should release lock first if there will be no connected credential after agent uninstallation.
        logger.debug('The connected credential is UDA. Try to release lock first.')
        LockUtils.releaseScannerLock(Framework)

    if AgentUtils.isAgentInstalled(Framework):
        logger.debug('There is an agent in remote machine.')
        # Run uninstall command.
        shouldStop = AgentUtils.agentUnInstallRoutine(Framework)
        if shouldStop != 0:
            Framework.setStepExecutionStatus(WorkflowStepStatus.FATAL_FAILURE)
            logger.debug('Failed to uninstall agent.')
    else:
        logger.debug('There is no agent in remote machine. The job will be done.')
        reason = 'There is no agent in remote machine'
        Framework.setProperty(InventoryUtils.generateSkipStep('Check Agent UnInstalled'), reason)
    Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:26,代码来源:UnInstallAgent.py

示例3: tearDown

    def tearDown(self):

        try:
            if self.container:
                self.container.close()

            # wait a few seconds and then destroy
            time.sleep(5)
            if self.container:
                self.container.destroy()

            # cleanup the pool
            if self.pool:
                self.pool.disconnect()
                self.pool.destroy(1)

            if self.hostfile is not None:
                os.remove(self.hostfile)

        except DaosApiError as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("Test failed during teardown.\n")

        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:28,代码来源:punch_test.py

示例4: tearDown

 def tearDown(self):
     try:
         os.remove(self.hostfile)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:7,代码来源:multiple_creates_test.py

示例5: connectToRemoteNode

def connectToRemoteNode(Framework):
    if AgentUtils.isMigrateNeeded(Framework):
        #setting connected client identifier
        #using host name since uduid is stored in agent options and on old and new ddmi agent their location is different
        logger.debug('Connected using uda.')
        client = Framework.getConnectedClient()
        sysInfo = client.getSysInfo()
        hostName = sysInfo.getProperty('computerName')
        Framework.setProperty(InventoryUtils.UD_HOSTNAME, hostName)
        AgentUtils.setUdAgentProtocolForMigration(Framework, client.getCredentialId())
        logger.debug('Migrate is going to be performed')
        if client.hasShell():
            logger.debug('The connected Agent already supports shell, assume it is a non-native agent.')
            reason = 'The connected Agent already supports shell,it may be a non-native agent.'
            Framework.setProperty(InventoryUtils.generateSkipStep('Install Non-Native UD Agent'), reason)
            #Framework.setProperty(InventoryUtils.generateSkipStep('Check Non-Native Agent Installed'), reason)

            platform = Framework.getProperty(InventoryUtils.STATE_PROPERTY_PLATFORM)
            if platform == 'windows':
                # In windows, it is native already if it has shell.
                logger.debug('This is windows, it must be native agent.')
                Framework.setProperty(AgentUtils.DOWNLOAD_MIGRATE_LOG_FILE, '')
                reason = 'Native installation is used for Windows platform.'
                Framework.setProperty(InventoryUtils.generateSkipStep('Init Update from Non-Native to Native'), reason)
                Framework.setProperty(InventoryUtils.generateSkipStep('Install Native UD Agent'), reason)
        else:
            logger.debug('The connected client does NOT support the shell capability. This is DDMi agent!')


        Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:30,代码来源:DDMiConnect.py

示例6: test_simple_delete

    def test_simple_delete(self):
        """
        Test destroying a pool created on a single server, nobody is using
        the pool, force is not needed.

        :avocado: tags=pool,pooldestroy,quick
        """
        self.hostlist = self.params.get("test_machines1", '/run/hosts/')
        hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

        self.agent_sessions = AgentUtils.run_agent(self.basepath, self.hostlist)
        server_utils.run_server(hostfile, self.server_group, self.basepath)

        setid = self.params.get("setname",
                                '/run/setnames/validsetname/')

        try:
            # use the uid/gid of the user running the test, these should
            # be perfectly valid
            uid = os.geteuid()
            gid = os.getegid()

            # TODO make these params in the yaml
            daosctl = self.basepath + '/install/bin/daosctl'

            create_cmd = ('{0} create-pool -m {1} -u {2} -g {3} -s {4}'
                          .format(daosctl, 0x731, uid, gid, setid))

            uuid_str = """{0}""".format(process.system_output(create_cmd))
            print ("uuid is {0}\n".format(uuid_str))

            host = self.hostlist[0]
            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists != 0:
                self.fail("Pool {0} not found on host {1}.\n"
                          .format(uuid_str, host))

            delete_cmd = ('{0} destroy-pool -i {1} -s {2}'
                          .format(daosctl, uuid_str, setid))
            process.system(delete_cmd)

            exists = check_for_pool.check_for_pool(host, uuid_str)
            if exists == 0:
                self.fail("Pool {0} found on host {1} when not expected.\n"
                          .format(uuid_str, host))

        except Exception as excep:
            print(excep)
            print(traceback.format_exc())
            self.fail("Expecting to pass but test has failed.\n")

        # no matter what happens shutdown the server
        finally:
            try:
                os.remove(hostfile)
            finally:
                if self.agent_sessions:
                    AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
                server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:59,代码来源:destroy_tests.py

示例7: tearDown

 def tearDown(self):
     try:
         if self.container:
             self.container.close()
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:8,代码来源:attribute.py

示例8: InstallAgentBasicResources

def InstallAgentBasicResources(Framework):
    result = AgentUtils.installAgentBasicResources(Framework)
    if result:
        AgentUtils.executeAgentBasicResourcesProcessCommands(Framework)
        Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)
    else:
        logger.debug("Failed to install basic agent resources.")
        Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:8,代码来源:InstallAgentBasicResources.py

示例9: tearDown

 def tearDown(self):
     try:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
     finally:
         # really make sure everything is gone
         check_for_pool.cleanup_pools(self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:8,代码来源:rebuild_tests.py

示例10: tearDown

 def tearDown(self):
     try:
         if self.pool is not None and self.pool.attached:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:8,代码来源:simple_create_delete_test.py

示例11: test_destroy_connect

    def test_destroy_connect(self):
        """
        Test destroying a pool that has a connected client with force == false.
        Should fail.

        :avocado: tags=pool,pooldestroy,x
        """
        host = self.hostlist[0]
        try:

            # write out a hostfile and start the servers with it
            self.hostlist = self.params.get("test_machines1", '/run/hosts/')
            hostfile = write_host_file.write_host_file(self.hostlist, self.tmp)

            self.agent_sessions = AgentUtils.run_agent(self.basepath,
                                                       self.hostlist)
            server_utils.run_server(hostfile, self.server_group, self.basepath)

            # parameters used in pool create
            createmode = self.params.get("mode", '/run/poolparams/createmode/')
            createuid = self.params.get("uid", '/run/poolparams/createuid/')
            creategid = self.params.get("gid", '/run/poolparams/creategid/')
            createsetid = self.params.get("setname",
                                          '/run/poolparams/createset/')
            createsize = self.params.get("size", '/run/poolparams/createsize/')

            # initialize a python pool object then create the underlying
            # daos storage
            pool = DaosPool(self.context)
            pool.create(createmode, createuid, creategid,
                        createsize, createsetid, None)

            # need a connection to create container
            pool.connect(1 << 1)

            # destroy pool with connection open
            pool.destroy(0)

            # should throw an exception and not hit this
            self.fail("Shouldn't hit this line.\n")

        except DaosApiError as excep:
            print("got exception which is expected so long as it is BUSY")
            print(excep)
            print(traceback.format_exc())
            # pool should still be there
            exists = check_for_pool.check_for_pool(host, pool.get_uuid_str)
            if exists != 0:
                self.fail("Pool gone, but destroy should have failed.\n")

        # no matter what happens cleanup
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
            os.remove(hostfile)
开发者ID:daos-stack,项目名称:daos,代码行数:56,代码来源:destroy_tests.py

示例12: tearDown

 def tearDown(self):
     try:
         self.container.close()
         self.container.destroy()
         self.pool.disconnect()
         self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:10,代码来源:obj_open_bad_param.py

示例13: tearDown

 def tearDown(self):
     try:
         if self.hostfile is not None:
             os.remove(self.hostfile)
         if self.pool:
             self.pool.destroy(1)
     finally:
         if self.agent_sessions:
             AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
         server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:10,代码来源:create_many_dkeys.py

示例14: tearDown

    def tearDown(self):

        try:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist_servers,
                                      self.agent_sessions)
        finally:
            server_utils.stop_server(hosts=self.hostlist_servers)

        super(TestWithServers, self).tearDown()
开发者ID:daos-stack,项目名称:daos,代码行数:10,代码来源:test.py

示例15: tearDown

    def tearDown(self):
        """ cleanup after the test """

        try:
            os.remove(self.hostfile)
            if self.pool:
                self.pool.destroy(1)
        finally:
            if self.agent_sessions:
                AgentUtils.stop_agent(self.hostlist, self.agent_sessions)
            server_utils.stop_server(hosts=self.hostlist)
开发者ID:daos-stack,项目名称:daos,代码行数:11,代码来源:rebuild_no_cap.py


注:本文中的AgentUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。