當前位置: 首頁>>代碼示例>>Python>>正文


Python NailgunClient.list_cluster_nodes方法代碼示例

本文整理匯總了Python中fuelweb_test.models.nailgun_client.NailgunClient.list_cluster_nodes方法的典型用法代碼示例。如果您正苦於以下問題:Python NailgunClient.list_cluster_nodes方法的具體用法?Python NailgunClient.list_cluster_nodes怎麽用?Python NailgunClient.list_cluster_nodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fuelweb_test.models.nailgun_client.NailgunClient的用法示例。


在下文中一共展示了NailgunClient.list_cluster_nodes方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: provision_cluster_separately

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]
def provision_cluster_separately(admin_node_ip, env_name):
  client = NailgunClient(admin_node_ip)
  cluster_id = client.get_cluster_id(env_name)
  env = load_env(env_name)

  # separate provisioning, useful on virtual envs since provisioning runs much faster this way
  cluster_nodes = client.list_cluster_nodes(cluster_id)
  for cur_node in cluster_nodes:
    task = client.provision_node(cluster_id, cur_node['id'])
    result = task_wait(client, task, 3600, 60)
    if result['status'] != 'ready':
      return result['message']

  return "OK"
開發者ID:adidenko,項目名稱:fuel_bm_tests,代碼行數:16,代碼來源:manage_env.py

示例2: remove_env

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]
def remove_env(admin_node_ip, env_name, dont_wait_for_nodes=True):

    LOG.info('Removing cluster with name:{0}'.format(env_name))
    client = NailgunClient(admin_node_ip)
    cluster_id = client.get_cluster_id(env_name)
    all_nodes = []

    if cluster_id:
        cluster_nodes = client.list_cluster_nodes(cluster_id)
        if len(cluster_nodes) > 0:
            all_nodes = client.list_nodes()
        client.delete_cluster(cluster_id)
    else:
        LOG.info('Looks like cluster has not been created before.Okay')
        return "OK"

    # wait for cluster to disappear
    rerty_c = 120
    for i in range(rerty_c):
        cluster_id = client.get_cluster_id(env_name)
        LOG.info('Wait for cluster to disappear...try %s /%s' % (i, rerty_c))
        if cluster_id:
            time.sleep(10)
        else:
            break

    # fail if cluster is still around
    if cluster_id:
        return "Can't delete cluster"

    # wait for removed nodes to come back online
    if not dont_wait_for_nodes:
        for i in range(90):
            cur_nodes = client.list_nodes()
            if len(cur_nodes) < len(all_nodes):
                LOG.info('Wait for nodes to came back. Should be:{0} '
                         'Currently:{1} ...try {2}'.format(
                            len(all_nodes), len(cur_nodes), i))
                time.sleep(10)

    if len(client.list_nodes()) < len(all_nodes) and not dont_wait_for_nodes:
        return "Timeout while waiting for removed nodes ({}) to come back up".format(
            len(cluster_nodes))

    return "OK"
開發者ID:alexz-kh,項目名稱:fuel_manage_env,代碼行數:47,代碼來源:manage_env.py

示例3: provision_cluster

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]
def provision_cluster(admin_node_ip, env_name):
  client = NailgunClient(admin_node_ip)
  cluster_id = client.get_cluster_id(env_name)
  env = load_env(env_name)
  all_nodes_ids = ""

  # separate provisioning, useful on virtual envs since provisioning runs much faster this way
  cluster_nodes = client.list_cluster_nodes(cluster_id)
  for cur_node in cluster_nodes:
    if all_nodes_ids == "":
      all_nodes_ids = str(cur_node['id'])
    else:
      all_nodes_ids = all_nodes_ids + "," + str(cur_node['id'])

  # provision all nodes
  task = client.provision_node(cluster_id, all_nodes_ids)
  result = task_wait(client, task, env.deploy_timeout, 30)
  if result['status'] == 'ready':
    return "OK"
  else:
    return result['message']
開發者ID:adidenko,項目名稱:fuel_bm_tests,代碼行數:23,代碼來源:manage_env.py

示例4: remove_env

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]
def remove_env(admin_node_ip, env_name, dont_wait_for_nodes):

  client = NailgunClient(admin_node_ip)
  cluster_id = client.get_cluster_id(env_name)
  need_to_wait_for_nodes = False
  all_nodes = []

  if cluster_id:
    cluster_nodes = client.list_cluster_nodes(cluster_id)
    if len(cluster_nodes) > 0:
      need_to_wait_for_nodes = True
      all_nodes = client.list_nodes()
    client.delete_cluster(cluster_id)
  else:
    return "OK"

  # wait for cluster to disappear
  for i in range(60):
    cluster_id = client.get_cluster_id(env_name)
    if cluster_id:
      time.sleep(10)

  # fail if cluster is still around
  if cluster_id:
    return "Can't delete cluster"

  # wait for removed nodes to come back online
  if not dont_wait_for_nodes:
    for i in range(90):
      cur_nodes = client.list_nodes()
      if len(cur_nodes) < len(all_nodes):
        time.sleep(10)

  if len(cur_nodes) < len(all_nodes) and not dont_wait_for_nodes:
    return "Timeout while waiting for removed nodes ({}) to come back up".format(len(cluster_nodes))

  return "OK"
開發者ID:adidenko,項目名稱:fuel_bm_tests,代碼行數:39,代碼來源:manage_env.py

示例5: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]

#.........這裏部分代碼省略.........
            raise TimeoutError(
                'Waiting task "{task}" timeout {timeout} sec '
                "was exceeded: ".format(task=task["name"], timeout=timeout)
            )

        return self.client.get_task(task["id"])

    @logwrap
    def update_nodes(self, cluster_id, nodes_dict, pending_addition=True, pending_deletion=False):
        # update nodes in cluster
        nodes_data = []
        for node_name in nodes_dict:
            devops_node = self.environment.get_virtual_environment().node_by_name(node_name)

            wait(lambda: self.get_nailgun_node_by_devops_node(devops_node)["online"], timeout=60 * 2)
            node = self.get_nailgun_node_by_devops_node(devops_node)
            assert_true(node["online"], "Node {} is online".format(node["mac"]))

            node_data = {
                "cluster_id": cluster_id,
                "id": node["id"],
                "pending_addition": pending_addition,
                "pending_deletion": pending_deletion,
                "pending_roles": nodes_dict[node_name],
                "name": "{}_{}".format(node_name, "_".join(nodes_dict[node_name])),
            }
            nodes_data.append(node_data)

        # assume nodes are going to be updated for one cluster only
        cluster_id = nodes_data[-1]["cluster_id"]
        node_ids = [str(node_info["id"]) for node_info in nodes_data]
        self.client.update_nodes(nodes_data)

        nailgun_nodes = self.client.list_cluster_nodes(cluster_id)
        cluster_node_ids = map(lambda _node: str(_node["id"]), nailgun_nodes)
        assert_true(all([node_id in cluster_node_ids for node_id in node_ids]))

        self.update_nodes_interfaces(cluster_id)

        return nailgun_nodes

    @logwrap
    def update_node_networks(self, node_id, interfaces_dict):
        # fuelweb_admin is always on eth0
        interfaces_dict["eth0"] = interfaces_dict.get("eth0", [])
        if "fuelweb_admin" not in interfaces_dict["eth0"]:
            interfaces_dict["eth0"].append("fuelweb_admin")

        interfaces = self.client.get_node_interfaces(node_id)
        all_networks = dict()
        for interface in interfaces:
            all_networks.update({net["name"]: net for net in interface["assigned_networks"]})

        for interface in interfaces:
            name = interface["name"]
            interface["assigned_networks"] = [all_networks[i] for i in interfaces_dict.get(name, [])]

        self.client.put_node_interfaces([{"id": node_id, "interfaces": interfaces}])

    @logwrap
    def update_node_disk(self, node_id, disks_dict):
        disks = self.client.get_node_disks(node_id)
        for disk in disks:
            dname = disk["name"]
            if dname not in disks_dict:
                continue
開發者ID:piousbox,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例6: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]

#.........這裏部分代碼省略.........
    @logwrap
    def update_nodes(self, cluster_id, nodes_dict,
                     pending_addition=True, pending_deletion=False):
        # update nodes in cluster
        nodes_data = []
        for node_name in nodes_dict:
            devops_node = self.environment.get_virtual_environment().\
                node_by_name(node_name)

            wait(lambda:
                 self.get_nailgun_node_by_devops_node(devops_node)['online'],
                 timeout=60 * 2)
            node = self.get_nailgun_node_by_devops_node(devops_node)
            assert_true(node['online'], 'Node {} is online'.format(node['mac']))

            node_data = {
                'cluster_id': cluster_id,
                'id': node['id'],
                'pending_addition': pending_addition,
                'pending_deletion': pending_deletion,
                'pending_roles': nodes_dict[node_name],
                'name': '{}_{}'.format(
                    node_name,
                    "_".join(nodes_dict[node_name])
                )
            }
            nodes_data.append(node_data)

        # assume nodes are going to be updated for one cluster only
        cluster_id = nodes_data[-1]['cluster_id']
        node_ids = [str(node_info['id']) for node_info in nodes_data]
        self.client.update_nodes(nodes_data)

        nailgun_nodes = self.client.list_cluster_nodes(cluster_id)
        cluster_node_ids = map(lambda _node: str(_node['id']), nailgun_nodes)
        assert_true(
            all([node_id in cluster_node_ids for node_id in node_ids]))

        self.update_nodes_interfaces(cluster_id)

        return nailgun_nodes

    @logwrap
    def update_node_networks(self, node_id, interfaces_dict):
        interfaces = self.client.get_node_interfaces(node_id)
        for interface in interfaces:
            interface_name = interface['name']
            interface['assigned_networks'] = []
            for allowed_network in interface['allowed_networks']:
                key_exists = interface_name in interfaces_dict
                if key_exists and \
                        allowed_network['name'] \
                        in interfaces_dict[interface_name]:
                    interface['assigned_networks'].append(allowed_network)

        self.client.put_node_interfaces(
            [{'id': node_id, 'interfaces': interfaces}])

    @logwrap
    def update_node_disk(self, node_id, disks_dict):
        disks = self.client.get_node_disks(node_id)
        for disk in disks:
            dname = disk['name']
            if dname not in disks_dict:
                continue
            for volume in disk['volumes']:
開發者ID:korshenin,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例7: len

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]
    # add nodes into cluster and set roles

    # simple check for enough nodes count
    # FIXME
    if assign_method == 'hw_pin':
        should_be_nodes = len(lab_config['nodes'].keys())
    else:
        should_be_nodes = lab_config['roller']['controller']['count'] + \
                          lab_config['roller']['compute']['count']
    wait_free_nodes(lab_config, should_be_nodes)

    # add nodes to cluster
    LOG.info("StageX:START Assign nodes to cluster")
    if assign_method == 'hw_pin':
        while len(client.list_cluster_nodes(cluster_id)) < should_be_nodes:
            for node in client.list_nodes():
                node_new = strict_pin_node_to_cluster(node, lab_config)
                if node_new:
                    client.update_node(node['id'], node_new)
            # FIXME add at least timeout
            time.sleep(5)
    else:
        client.update_nodes(simple_pin_nodes_to_cluster(client.list_nodes(),
                                                        lab_config['roller']))
    LOG.info("StageX: END Assign nodes to cluster")

    # assign\create network role to nic per node
    LOG.info("StageX: Assign network role to nic per node")
    if assign_method == 'hw_pin':
        for node in client.list_cluster_nodes(cluster_id):
開發者ID:alexz-kh,項目名稱:fuel_manage_env,代碼行數:32,代碼來源:manage_env.py

示例8: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]

#.........這裏部分代碼省略.........
    def update_nodes(self, cluster_id, nodes_dict,
                     pending_addition=True, pending_deletion=False):
        # update nodes in cluster
        nodes_data = []
        for node_name in nodes_dict:
            devops_node = self.environment.get_virtual_environment().\
                node_by_name(node_name)

            wait(lambda:
                 self.get_nailgun_node_by_devops_node(devops_node)['online'],
                 timeout=60 * 2)
            node = self.get_nailgun_node_by_devops_node(devops_node)
            assert_true(node['online'],
                        'Node {} is online'.format(node['mac']))

            node_data = {
                'cluster_id': cluster_id,
                'id': node['id'],
                'pending_addition': pending_addition,
                'pending_deletion': pending_deletion,
                'pending_roles': nodes_dict[node_name],
                'name': '{}_{}'.format(
                    node_name,
                    "_".join(nodes_dict[node_name])
                )
            }
            nodes_data.append(node_data)

        # assume nodes are going to be updated for one cluster only
        cluster_id = nodes_data[-1]['cluster_id']
        node_ids = [str(node_info['id']) for node_info in nodes_data]
        self.client.update_nodes(nodes_data)

        nailgun_nodes = self.client.list_cluster_nodes(cluster_id)
        cluster_node_ids = map(lambda _node: str(_node['id']), nailgun_nodes)
        assert_true(
            all([node_id in cluster_node_ids for node_id in node_ids]))

        self.update_nodes_interfaces(cluster_id)

        return nailgun_nodes

    @logwrap
    def update_node_networks(self, node_id, interfaces_dict, raw_data=None):
        # fuelweb_admin is always on eth0
        interfaces_dict['eth0'] = interfaces_dict.get('eth0', [])
        if 'fuelweb_admin' not in interfaces_dict['eth0']:
            interfaces_dict['eth0'].append('fuelweb_admin')

        interfaces = self.client.get_node_interfaces(node_id)

        if raw_data:
            interfaces.append(raw_data)

        all_networks = dict()
        for interface in interfaces:
            all_networks.update(
                {net['name']: net for net in interface['assigned_networks']})

        for interface in interfaces:
            name = interface["name"]
            interface['assigned_networks'] = \
                [all_networks[i] for i in interfaces_dict.get(name, [])]

        self.client.put_node_interfaces(
            [{'id': node_id, 'interfaces': interfaces}])
開發者ID:shaikapsar,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例9: setup_env

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]

#.........這裏部分代碼省略.........
      network['network_size'] = len(list(IPNetwork((network['cidr']))))

  network_conf['networks'] = network_list

  # update neutron settings
  if "net_provider" in env.settings:
    if env.settings["net_provider"] == 'neutron':
      # check if we need to set vlan tags
      if env.settings["net_segment_type"] == 'vlan' and 'neutron_vlan_range' in env.settings:
        network_conf['neutron_parameters']['L2']['phys_nets']['physnet2']['vlan_range'] = env.settings['neutron_vlan_range']
      # check and update networks CIDR/netmask/size/etc
      if 'net04' in env.net_cidr:
        network_conf['neutron_parameters']['predefined_networks']['net04']['L3']['cidr'] = env.net_cidr['net04']
        network_conf['neutron_parameters']['predefined_networks']['net04']['L3']['gateway'] = str(list(IPNetwork(env.net_cidr['net04']))[1])
      if 'public' in env.net_cidr:
        network_conf['neutron_parameters']['predefined_networks']['net04_ext']['L3']['cidr'] = env.net_cidr['public']
        if env.gateway:
          network_conf['neutron_parameters']['predefined_networks']['net04_ext']['L3']['gateway'] = env.gateway
        else:
          network_conf['neutron_parameters']['predefined_networks']['net04_ext']['L3']['gateway'] = str(list(IPNetwork(env.net_cidr['public']))[1])
        if 'net04_ext' in env.net_ip_ranges:
          network_conf['neutron_parameters']['predefined_networks']['net04_ext']['L3']['floating'] = env.net_ip_ranges["net04_ext"]
        else:
          network_conf['neutron_parameters']['predefined_networks']['net04_ext']['L3']['floating'] = get_range(env.net_cidr['public'], 2)

  # push updated network to Fuel API
  client.update_network(cluster_id, networks=network_conf, all_set=True)

  # configure cluster attributes
  attributes = client.get_cluster_attributes(cluster_id)

  for option in env.settings:
    section = False
    if option in ('savanna', 'murano', 'ceilometer'):
      section = 'additional_components'
    if option in ('volumes_ceph', 'images_ceph', 'volumes_lvm'):
      section = 'storage'
    if option in ('libvirt_type', 'vlan_splinters'):
      section = 'common'
    if section:
      attributes['editable'][section][option]['value'] = env.settings[option]

  attributes['editable']['common']['debug']['value'] = True
  client.update_cluster_attributes(cluster_id, attributes)

  # get all nodes
  for i in range(18):
    all_nodes = client.list_nodes()
    if len(all_nodes) < len(env.node_roles) + len(env.special_roles):
      time.sleep(10)

  # check if we have enough nodes for our test case
  if len(all_nodes) < len(env.node_roles) + len(env.special_roles):
    return "Not enough nodes"

  nodes_data = []
  node_local_id = 0

  # go through unassigned nodes and update their pending_roles according to environment settings
  for node in all_nodes:
    if node['cluster'] == None and (node_local_id < len(env.node_roles) or node['mac'] in env.special_roles):
      if node['mac'] in env.special_roles:
        node_role = env.special_roles[node['mac']]
      else:
        node_role = env.node_roles[node_local_id]
        node_local_id += 1
      node_data = {
        'cluster_id': cluster_id,
        'id': node['id'],
        'pending_addition': "true",
        'pending_roles': node_role
      }
      nodes_data.append(node_data)

  # add nodes to cluster
  client.update_nodes(nodes_data)

  # check if we assigned all nodes we wanted to
  cluster_nodes = client.list_cluster_nodes(cluster_id)
  if len(cluster_nodes) != len(env.node_roles) + len(env.special_roles):
    return "Not enough nodes"

  # move networks to appropriate nodes interfaces (according to environment settings)
  for node in cluster_nodes:
    node_id = node['id']
    interfaces_dict = env.interfaces
    interfaces = client.get_node_interfaces(node_id)
    for interface in interfaces:
      interface_name = interface['name']
      interface['assigned_networks'] = []
      for allowed_network in interface['allowed_networks']:
        key_exists = interface_name in interfaces_dict
        if key_exists and \
        allowed_network['name'] \
        in interfaces_dict[interface_name]:
          interface['assigned_networks'].append(allowed_network)

    client.put_node_interfaces(
      [{'id': node_id, 'interfaces': interfaces}])
  return "OK"
開發者ID:teran,項目名稱:fuel_bm_tests,代碼行數:104,代碼來源:manage_env.py

示例10: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]

#.........這裏部分代碼省略.........
    def update_nodes(self, cluster_id, nodes_dict,
                     pending_addition=True, pending_deletion=False):
        # update nodes in cluster
        nodes_data = []
        for node_name in nodes_dict:
            devops_node = self.environment.get_virtual_environment().\
                node_by_name(node_name)

            wait(lambda:
                 self.get_nailgun_node_by_devops_node(devops_node)['online'],
                 timeout=60 * 2)
            node = self.get_nailgun_node_by_devops_node(devops_node)
            assert_true(node['online'],
                        'Node {} is online'.format(node['mac']))

            node_data = {
                'cluster_id': cluster_id,
                'id': node['id'],
                'pending_addition': pending_addition,
                'pending_deletion': pending_deletion,
                'pending_roles': nodes_dict[node_name],
                'name': '{}_{}'.format(
                    node_name,
                    "_".join(nodes_dict[node_name])
                )
            }
            nodes_data.append(node_data)

        # assume nodes are going to be updated for one cluster only
        cluster_id = nodes_data[-1]['cluster_id']
        node_ids = [str(node_info['id']) for node_info in nodes_data]
        self.client.update_nodes(nodes_data)

        nailgun_nodes = self.client.list_cluster_nodes(cluster_id)
        cluster_node_ids = map(lambda _node: str(_node['id']), nailgun_nodes)
        assert_true(
            all([node_id in cluster_node_ids for node_id in node_ids]))

        self.update_nodes_interfaces(cluster_id)

        return nailgun_nodes

    @logwrap
    def update_node_networks(self, node_id, interfaces_dict, raw_data=None):
        # fuelweb_admin is always on eth0
        interfaces_dict['eth0'] = interfaces_dict.get('eth0', [])
        if 'fuelweb_admin' not in interfaces_dict['eth0']:
            interfaces_dict['eth0'].append('fuelweb_admin')

        interfaces = self.client.get_node_interfaces(node_id)

        if raw_data:
            interfaces.append(raw_data)

        all_networks = dict()
        for interface in interfaces:
            all_networks.update(
                {net['name']: net for net in interface['assigned_networks']})

        for interface in interfaces:
            name = interface["name"]
            interface['assigned_networks'] = \
                [all_networks[i] for i in interfaces_dict.get(name, [])]

        self.client.put_node_interfaces(
            [{'id': node_id, 'interfaces': interfaces}])
開發者ID:igajsin,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例11: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import list_cluster_nodes [as 別名]

#.........這裏部分代碼省略.........
    def task_wait(self, task, timeout, interval=5):
        try:
            wait(lambda: self.client.get_task(task["id"])["status"] != "running", interval=interval, timeout=timeout)
        except TimeoutError:
            raise TimeoutError(
                'Waiting task "{task}" timeout {timeout} sec '
                "was exceeded: ".format(task=task["name"], timeout=timeout)
            )

        return self.client.get_task(task["id"])

    @logwrap
    def update_nodes(self, cluster_id, nodes_dict, pending_addition=True, pending_deletion=False):
        # update nodes in cluster
        nodes_data = []
        for node_name in nodes_dict:
            devops_node = self.environment.get_virtual_environment().node_by_name(node_name)
            node = self.get_nailgun_node_by_devops_node(devops_node)
            node_data = {
                "cluster_id": cluster_id,
                "id": node["id"],
                "pending_addition": pending_addition,
                "pending_deletion": pending_deletion,
                "pending_roles": nodes_dict[node_name],
                "name": "{}_{}".format(node_name, "_".join(nodes_dict[node_name])),
            }
            nodes_data.append(node_data)

        # assume nodes are going to be updated for one cluster only
        cluster_id = nodes_data[-1]["cluster_id"]
        node_ids = [str(node_info["id"]) for node_info in nodes_data]
        self.client.update_nodes(nodes_data)

        nailgun_nodes = self.client.list_cluster_nodes(cluster_id)
        cluster_node_ids = map(lambda _node: str(_node["id"]), nailgun_nodes)
        assert_true(all([node_id in cluster_node_ids for node_id in node_ids]))

        self.update_nodes_interfaces(cluster_id)

        return nailgun_nodes

    @logwrap
    def update_node_networks(self, node_id, interfaces_dict):
        interfaces = self.client.get_node_interfaces(node_id)
        for interface in interfaces:
            interface_name = interface["name"]
            interface["assigned_networks"] = []
            for allowed_network in interface["allowed_networks"]:
                key_exists = interface_name in interfaces_dict
                if key_exists and allowed_network["name"] in interfaces_dict[interface_name]:
                    interface["assigned_networks"].append(allowed_network)

        self.client.put_node_interfaces([{"id": node_id, "interfaces": interfaces}])

    @logwrap
    def update_redhat_credentials(
        self,
        license_type=help_data.REDHAT_LICENSE_TYPE,
        username=help_data.REDHAT_USERNAME,
        password=help_data.REDHAT_PASSWORD,
        satellite_host=help_data.REDHAT_SATELLITE_HOST,
        activation_key=help_data.REDHAT_ACTIVATION_KEY,
    ):

        # release name is in environment variable OPENSTACK_RELEASE
        release_id = self.client.get_release_id("RHOS")
開發者ID:justasabc,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py


注:本文中的fuelweb_test.models.nailgun_client.NailgunClient.list_cluster_nodes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。