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


Python NailgunClient.update_network方法代碼示例

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


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

示例1: FuelWebClient

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

#.........這裏部分代碼省略.........
        if not cluster_id:
            logging.info('I have no id')
            data = {
                "name": name,
                "release": str(release_id),
                "mode": mode
            }

            if "net_provider" in settings:
                data.update(
                    {
                        'net_provider': settings["net_provider"],
                        'net_segment_type': settings["net_segment_type"]
                    }
                )

            self.client.create_cluster(data=data)
            cluster_id = self.client.get_cluster_id(name)

            attributes = self.client.get_cluster_attributes(cluster_id)

            for option in settings:
                section = False
                if option in ('savanna', 'murano'):
                    section = 'additional_components'
                if option in ('volumes_ceph', 'images_ceph'):
                    section = 'storage'
                if section:
                    attributes['editable'][section][option]['value'] =\
                        settings[option]

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

        if not cluster_id:
            raise Exception("Could not get cluster '%s'" % name)

        self.client.add_syslog_server(
            cluster_id, self.environment.get_host_node_ip(), port)

        return cluster_id

    def deploy_cluster_wait(self, cluster_id):
        task = self.deploy_cluster(cluster_id)
        self.assert_task_success(task, interval=30)

    @logwrap
    def deploy_cluster(self, cluster_id):
        """Return hash with task description."""
        return self.client.deploy_cluster_changes(cluster_id)

    @logwrap
    def get_cluster_floating_list(self, node_name):
        remote = self.get_ssh_for_node(node_name)
        ret = remote.check_call('/usr/bin/nova-manage floating list')
        ret_str = ''.join(ret['stdout'])
        return re.findall('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', ret_str)

    @logwrap
    def get_cluster_block_devices(self, node_name):
        remote = self.get_ssh_for_node(node_name)
        ret = remote.check_call('/bin/lsblk')
        return ''.join(ret['stdout'])

    @logwrap
開發者ID:korshenin,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例2: FuelWebClient

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

#.........這裏部分代碼省略.........
                    {"net_provider": settings["net_provider"], "net_segment_type": settings["net_segment_type"]}
                )

            self.client.create_cluster(data=data)
            cluster_id = self.client.get_cluster_id(name)

            attributes = self.client.get_cluster_attributes(cluster_id)

            for option in settings:
                section = False
                if option in ("savanna", "murano", "ceilometer"):
                    section = "additional_components"
                if option in (
                    "volumes_ceph",
                    "images_ceph",
                    "ephemeral_ceph",
                    "objects_ceph",
                    "osd_pool_size",
                    "volumes_lvm",
                ):
                    section = "storage"
                if section:
                    attributes["editable"][section][option]["value"] = settings[option]

            attributes["editable"]["common"]["debug"]["value"] = help_data.DEBUG_MODE

            hpv_data = attributes["editable"]["common"]["libvirt_type"]

            if KVM_USE:
                logger.debug("KVM is used to clusters")
                hpv_data["value"] = "kvm"

            self.client.update_cluster_attributes(cluster_id, attributes)
            self.update_network_configuration(cluster_id)

        if not cluster_id:
            raise Exception("Could not get cluster '%s'" % name)

        self.client.add_syslog_server(cluster_id, self.environment.get_host_node_ip(), port)

        return cluster_id

    def deploy_cluster_wait(self, cluster_id, is_feature=False, timeout=50 * 60, interval=30):
        if not is_feature:
            task = self.deploy_cluster(cluster_id)
            self.assert_task_success(task, interval=interval)
        else:
            task = self.client.provision_nodes(cluster_id)
            self.assert_task_success(task, timeout=timeout, interval=interval)
            task = self.client.deploy_nodes(cluster_id)
            self.assert_task_success(task, timeout=timeout, interval=interval)

    @logwrap
    def deploy_cluster(self, cluster_id):
        """Return hash with task description."""
        return self.client.deploy_cluster_changes(cluster_id)

    @logwrap
    def get_cluster_floating_list(self, node_name):
        remote = self.get_ssh_for_node(node_name)
        ret = remote.check_call("/usr/bin/nova-manage floating list")
        ret_str = "".join(ret["stdout"])
        return re.findall("(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ret_str)

    @logwrap
    def get_cluster_block_devices(self, node_name):
開發者ID:piousbox,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例3: float

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import update_network [as 別名]
    try:
        cluster_attributes['editable']['repo_setup']['repos']['value'] = \
            lab_config['repos']['value']
        LOG.info('Section: repos was successfully replaced with \n%s\n ' % \
                 pprinter.pformat(lab_config['repos']['value']))
    except KeyError as e:
        LOG.warn('Section: %s not found in %s ' % (e.message, CLUSTER_CONFIG))

    client.update_cluster_attributes(cluster_id, cluster_attributes)

    if float(f_release[:3]) < 8:
        update_netw_old()
    else:
        LOG.info('Update cluster networks..its can take some time...')
        # FIXME
        client.update_network(cluster_id, networking_parameters=cluster_net[
            "networking_parameters"], networks=cluster_net["networks"])

    # 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':
開發者ID:alexz-kh,項目名稱:fuel_manage_env,代碼行數:34,代碼來源:manage_env.py

示例4: FuelWebClient

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

#.........這裏部分代碼省略.........
                        'net_segment_type': settings[
                            "net_segment_type"]
                    }
                )

            self.client.create_cluster(data=data)
            cluster_id = self.client.get_cluster_id(name)
            logger.info('The cluster id is %s', cluster_id)

            logger.info('Set cluster settings to %s', settings)
            attributes = self.client.get_cluster_attributes(cluster_id)

            for option in settings:
                section = False
                if option in ('sahara', 'murano', 'ceilometer'):
                    section = 'additional_components'
                if option in ('volumes_ceph', 'images_ceph', 'ephemeral_ceph',
                              'objects_ceph', 'osd_pool_size', 'volumes_lvm'):
                    section = 'storage'
                if section:
                    attributes['editable'][section][option]['value'] =\
                        settings[option]

            logger.info('Set DEBUG MODE to %s', help_data.DEBUG_MODE)
            attributes['editable']['common']['debug']['value'] = \
                help_data.DEBUG_MODE

            if KVM_USE:
                logger.info('Set Hypervisor type to KVM')
                hpv_data = attributes['editable']['common']['libvirt_type']
                hpv_data['value'] = "kvm"

            self.client.update_cluster_attributes(cluster_id, attributes)
            self.update_network_configuration(cluster_id)

        if not cluster_id:
            raise Exception("Could not get cluster '%s'" % name)

        self.client.add_syslog_server(
            cluster_id, self.environment.get_host_node_ip(), port)

        return cluster_id

    def deploy_cluster_wait(self, cluster_id, is_feature=False,
                            timeout=50 * 60, interval=30):
        if not is_feature:
            logger.info('Deploy cluster %s', cluster_id)
            task = self.deploy_cluster(cluster_id)
            self.assert_task_success(task, interval=interval)
        else:
            logger.info('Provision nodes of a cluster %s', cluster_id)
            task = self.client.provision_nodes(cluster_id)
            self.assert_task_success(task, timeout=timeout, interval=interval)
            logger.info('Deploy nodes of a cluster %s', cluster_id)
            task = self.client.deploy_nodes(cluster_id)
            self.assert_task_success(task, timeout=timeout, interval=interval)

    def deploy_cluster_wait_progress(self, cluster_id, progress):
        task = self.deploy_cluster(cluster_id)
        self.assert_task_success(task, interval=30, progress=progress)

    @logwrap
    def deploy_cluster(self, cluster_id):
        """Return hash with task description."""
        logger.info('Launch deployment of a cluster #%s', cluster_id)
        return self.client.deploy_cluster_changes(cluster_id)
開發者ID:shaikapsar,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例5: setup_env

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

  client = NailgunClient(admin_node_ip)
  cluster_id = client.get_cluster_id(env_name)
  release_id = client.get_release_id()

  # delete previous cluster with the same name
  if cluster_id:
    client.delete_cluster(cluster_id)

  for i in range(6):
    cluster_id = client.get_cluster_id(env_name)
    if cluster_id:
      time.sleep(5)

  if cluster_id:
    return "Can't delete cluster"

  # old cluster is gone so we're ok to create a new cluster
  env = load_env(env_name)
  data = env.data

  if "net_provider" in env.settings:
    data.update(
      {  
        'net_provider': env.settings["net_provider"],
        'net_segment_type': env.settings["net_segment_type"]
      }
    )

  client.create_cluster(data=data)
  time.sleep(5)
  cluster_id = client.get_cluster_id(env_name)

  # configure networks
  network_conf = client.get_networks(cluster_id)
  network_list = network_conf['networks']

  for network in network_list:
    # set vlan tags
    if network["name"] in env.net_tag:
      network['vlan_start'] = env.net_tag[network["name"]]
    # set CIDR and related net stuff
    if network["name"] in env.net_cidr:
      network['cidr'] = env.net_cidr[network["name"]]
      if network["name"] == "public":
        if env.gateway:
          network["gateway"] = env.gateway
        else:
          network["gateway"] = str(list(IPNetwork(network['cidr']))[1])
      if network["name"] in env.net_ip_ranges:
        network['ip_ranges'] = env.net_ip_ranges[network["name"]]
      else:
        if network["name"] == "public":
          network['ip_ranges'] = get_range(network['cidr'], -1)
        elif network["name"] == "floating":
          network['ip_ranges'] = get_range(network['cidr'], 1)
        else:
          network['ip_ranges'] = get_range(network['cidr'], 0)
      network['netmask'] = str(IPNetwork(network['cidr']).netmask)
      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:
#.........這裏部分代碼省略.........
開發者ID:teran,項目名稱:fuel_bm_tests,代碼行數:103,代碼來源:manage_env.py

示例6: FuelWebClient

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

#.........這裏部分代碼省略.........
            cluster_id = self.client.get_cluster_id(name)
            logger.info('The cluster id is %s', cluster_id)

            logger.info('Set cluster settings to %s', settings)
            attributes = self.client.get_cluster_attributes(cluster_id)

            for option in settings:
                section = False
                if option in ('sahara', 'murano', 'ceilometer'):
                    section = 'additional_components'
                if option in ('volumes_ceph', 'images_ceph', 'ephemeral_ceph',
                              'objects_ceph', 'osd_pool_size', 'volumes_lvm'):
                    section = 'storage'
                if option in ('tenant', 'password', 'user'):
                    section = 'access'
                if section:
                    attributes['editable'][section][option]['value'] =\
                        settings[option]

            logger.info('Set DEBUG MODE to %s', help_data.DEBUG_MODE)
            attributes['editable']['common']['debug']['value'] = \
                help_data.DEBUG_MODE

            if KVM_USE:
                logger.info('Set Hypervisor type to KVM')
                hpv_data = attributes['editable']['common']['libvirt_type']
                hpv_data['value'] = "kvm"

            logger.debug("Try to update cluster "
                         "with next attributes {0}".format(attributes))
            self.client.update_cluster_attributes(cluster_id, attributes)
            logger.debug("Attributes of cluster were updated,"
                         " going to update networks ...")
            self.update_network_configuration(cluster_id)

        if not cluster_id:
            raise Exception("Could not get cluster '%s'" % name)
        #TODO: rw105719
        #self.client.add_syslog_server(
        #    cluster_id, self.environment.get_host_node_ip(), port)

        return cluster_id

    def deploy_cluster_wait(self, cluster_id, is_feature=False,
                            timeout=50 * 60, interval=30):
        if not is_feature:
            logger.info('Deploy cluster %s', cluster_id)
            task = self.deploy_cluster(cluster_id)
            self.assert_task_success(task, interval=interval)
        else:
            logger.info('Provision nodes of a cluster %s', cluster_id)
            task = self.client.provision_nodes(cluster_id)
            self.assert_task_success(task, timeout=timeout, interval=interval)
            logger.info('Deploy nodes of a cluster %s', cluster_id)
            task = self.client.deploy_nodes(cluster_id)
            self.assert_task_success(task, timeout=timeout, interval=interval)

    def deploy_cluster_wait_progress(self, cluster_id, progress):
        task = self.deploy_cluster(cluster_id)
        self.assert_task_success(task, interval=30, progress=progress)

    @logwrap
    def deploy_cluster(self, cluster_id):
        """Return hash with task description."""
        logger.info('Launch deployment of a cluster #%s', cluster_id)
        return self.client.deploy_cluster_changes(cluster_id)
開發者ID:igajsin,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py

示例7: FuelWebClient

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

#.........這裏部分代碼省略.........
        release_id = self.client.get_release_id(release_name=release_name)
        logging.info("Release_id is %s" % str(release_id))

        if settings is None:
            settings = {}

        logging.info("I pass if with settings")

        cluster_id = self.client.get_cluster_id(name)
        if not cluster_id:
            logging.info("I have no id")
            data = {"name": name, "release": str(release_id), "mode": mode}

            if "net_provider" in settings:
                data.update(
                    {"net_provider": settings["net_provider"], "net_segment_type": settings["net_segment_type"]}
                )

            self.client.create_cluster(data=data)
            cluster_id = self.client.get_cluster_id(name)

            attributes = self.client.get_cluster_attributes(cluster_id)

            for option in settings:
                section = False
                if option in ("savanna", "murano"):
                    section = "additional_components"
                if option in ("volumes_ceph", "images_ceph"):
                    section = "storage"
                if section:
                    attributes["editable"][section][option]["value"] = settings[option]

            self.client.update_cluster_attributes(cluster_id, attributes)
            self.update_network_configuration(cluster_id)

        if not cluster_id:
            raise Exception("Could not get cluster '%s'" % name)

        self.client.add_syslog_server(cluster_id, self.environment.get_host_node_ip(), port)

        return cluster_id

    def deploy_cluster_wait(self, cluster_id):
        task = self.deploy_cluster(cluster_id)
        self.assert_task_success(task, interval=30)

    @logwrap
    def deploy_cluster(self, cluster_id):
        """Return hash with task description."""
        return self.client.deploy_cluster_changes(cluster_id)

    @logwrap
    def get_cluster_floating_list(self, node_name):
        remote = self.get_ssh_for_node(node_name)
        ret = remote.check_call("/usr/bin/nova-manage floating list")
        ret_str = "".join(ret["stdout"])
        return re.findall("(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ret_str)

    @logwrap
    def get_cluster_block_devices(self, node_name):
        remote = self.get_ssh_for_node(node_name)
        ret = remote.check_call("/bin/lsblk")
        return "".join(ret["stdout"])

    @logwrap
    def get_last_created_cluster(self):
開發者ID:justasabc,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py


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