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


Python base.Node类代码示例

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


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

示例1: test_reboot_node

    def test_reboot_node(self):
        VoxelMockHttp.type = 'REBOOT_NODE'
        node = Node(
            id=72258, name=None, state=None, public_ips=None, private_ips=None,
            driver=self.driver)

        self.assertTrue(node.reboot())
开发者ID:kevin-zhangsen,项目名称:badam,代码行数:7,代码来源:test_voxel.py

示例2: test_destroy_node

    def test_destroy_node(self):
        VoxelMockHttp.type = 'DESTROY_NODE'
        node = Node(
            id=72258, name=None, state=None, public_ips=None, private_ips=None,
            driver=self.driver)

        self.assertTrue(node.destroy())
开发者ID:kevin-zhangsen,项目名称:badam,代码行数:7,代码来源:test_voxel.py

示例3: destroy_machine

def destroy_machine(request):
    """Destroys a machine on a certain backend.

    After destroying a machine it also deletes all key associations. However,
    it doesn't undeploy the keypair. There is no need to do it because the
    machine will be destroyed.

    """
    try:
        conn = connect(request)
    except:
        return Response("Backend not found", 404)

    machine_id = request.matchdict["machine"]
    machine = Node(machine_id, name=machine_id, state=0, public_ips=[], private_ips=[], driver=conn)

    machine.destroy()

    backend_id = request.matchdict["backend"]
    pair = [backend_id, machine_id]

    try:
        keypairs = request.environ["beaker.session"]["keypairs"]
    except:
        keypairs = request.registry.settings.get("keypairs", {})

    for key in keypairs:
        machines = keypairs[key].get("machines", None)
        if pair in machines:
            disassociate_key(request, key, backend_id, machine_id, undeploy=False)

    return Response("Success", 200)
开发者ID:andreioprisan,项目名称:mist.io,代码行数:32,代码来源:views.py

示例4: test_destroy_node_response_INPROGRESS

 def test_destroy_node_response_INPROGRESS(self):
     OpsourceMockHttp.type = "INPROGRESS"
     node = Node(id="11", name=None, state=None, public_ips=None, private_ips=None, driver=self.driver)
     try:
         node.destroy()
         self.assertTrue(False)  # above command should have thrown OpsourceAPIException
     except OpsourceAPIException:
         self.assertTrue(True)
开发者ID:Keisuke69,项目名称:libcloud,代码行数:8,代码来源:test_opsource.py

示例5: test_destroy_node

    def test_destroy_node(self):
        node = Node(id=1, name=None, state=None, public_ips=None, private_ips=None,
                    driver=self.driver)

        ret = node.destroy()
        self.assertTrue(ret is True)

        ret = self.driver.destroy_node(node)
        self.assertTrue(ret is True)
开发者ID:IsCoolEntertainment,项目名称:debpkg_libcloud,代码行数:9,代码来源:test_slicehost.py

示例6: test_destroy_node_response_INPROGRESS

 def test_destroy_node_response_INPROGRESS(self):
     DimensionDataMockHttp.type = 'INPROGRESS'
     node = Node(id='11', name=None, state=None,
                 public_ips=None, private_ips=None, driver=self.driver)
     try:
         node.destroy()
         self.assertTrue(
             False)  # above command should have thrown DimensionDataAPIException
     except DimensionDataAPIException:
         pass
开发者ID:kevin-zhangsen,项目名称:badam,代码行数:10,代码来源:test_dimensiondata.py

示例7: test_reboot_node_response_INPROGRESS

 def test_reboot_node_response_INPROGRESS(self):
     OpsourceMockHttp.type = 'INPROGRESS'
     node = Node(id='11', name=None, state=None,
                 public_ips=None, private_ips=None, driver=self.driver)
     try:
         node.reboot()
         self.assertTrue(
             False)  # above command should have thrown OpsourceAPIException
     except OpsourceAPIException:
         pass
开发者ID:TamerB,项目名称:simple-paas,代码行数:10,代码来源:test_opsource.py

示例8: reboot_machine

def reboot_machine(request):
    """Reboots a machine on a certain backend."""
    try:
        conn = connect(request)
    except:
        return Response("Backend not found", 404)

    machine_id = request.matchdict["machine"]
    machine = Node(machine_id, name=machine_id, state=0, public_ips=[], private_ips=[], driver=conn)

    machine.reboot()

    return Response("Success", 200)
开发者ID:andreioprisan,项目名称:mist.io,代码行数:13,代码来源:views.py

示例9: test_reboot_node

    def test_reboot_node(self):
        node = Node(id=1, name=None, state=None, public_ip=None, private_ip=None,
                    driver=self.driver)

        ret = node.reboot()
        self.assertTrue(ret is True)

        ret = self.driver.reboot_node(node)
        self.assertTrue(ret is True)

        SlicehostMockHttp.type = 'FORBIDDEN'
        try:
            ret = self.driver.reboot_node(node)
        except Exception, e:
            self.assertEqual(e.args[0], 'Permission denied')
开发者ID:chicagobuss,项目名称:libcloud,代码行数:15,代码来源:test_slicehost.py

示例10: test_reboot_node

    def test_reboot_node(self):
        node = Node(id=1, name=None, state=None, public_ips=None, private_ips=None,
                    driver=self.driver)

        ret = node.reboot()
        self.assertTrue(ret is True)

        ret = self.driver.reboot_node(node)
        self.assertTrue(ret is True)

        SlicehostMockHttp.type = 'FORBIDDEN'
        try:
            ret = self.driver.reboot_node(node)
        except Exception:
            e = sys.exc_info()[1]
            self.assertEqual(e.args[0], 'Permission denied')
        else:
            self.fail('test should have thrown')
开发者ID:IsCoolEntertainment,项目名称:debpkg_libcloud,代码行数:18,代码来源:test_slicehost.py

示例11: destroy_machine

def destroy_machine(request):
    """Destroys a machine on a certain backend."""
    try:
        conn = connect(request)
    except:
        return Response('Backend not found', 404)

    machine_id = request.matchdict['machine']
    machine = Node(machine_id,
                   name=machine_id,
                   state=0,
                   public_ips=[],
                   private_ips=[],
                   driver=conn)

    machine.destroy()

    return Response('Success', 200)
开发者ID:BantouTelecom,项目名称:mist.io,代码行数:18,代码来源:views.py

示例12: _to_node

    def _to_node(self, domain):
        state, max_mem, memory, vcpu_count, used_cpu_time = domain.info()
        state = self.NODE_STATE_MAP.get(state, NodeState.UNKNOWN)

        public_ips, private_ips = [], []

        ip_addresses = self._get_ip_addresses_for_domain(domain)

        for ip_address in ip_addresses:
            if is_public_subnet(ip_address):
                public_ips.append(ip_address)
            else:
                private_ips.append(ip_address)

        extra = {'uuid': domain.UUIDString(), 'os_type': domain.OSType(),
                 'types': self.connection.getType(),
                 'used_memory': memory / 1024, 'vcpu_count': vcpu_count,
                 'used_cpu_time': used_cpu_time}

        node = Node(id=domain.ID(), name=domain.name(), state=state,
                    public_ips=public_ips, private_ips=private_ips,
                    driver=self, extra=extra)
        node._uuid = domain.UUIDString()  # we want to use a custom UUID
        return node
开发者ID:ClusterHQ,项目名称:libcloud,代码行数:24,代码来源:libvirt_driver.py

示例13: test_reboot_node

 def test_reboot_node(self):
     node = Node(id=72258, name=None, state=None, public_ips=None,
                 private_ips=None, driver=self.driver)
     ret = node.reboot()
     self.assertTrue(ret is True)
开发者ID:racker,项目名称:rackspace_cloudmonitoring_migration_tool,代码行数:5,代码来源:test_openstack.py


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