示例#1
0
    def backup_settings(self):
        settings_p = "/etc/openstack-dashboard/"
        settings_f = "local_settings"
        settings_full = os.path.join(settings_p, settings_f)

        for host in self.hosts:
            src = "root@{}:{}".format(host, settings_full)
            scp(src, ".")
            shutil.move(settings_f, settings_f + ".old")
            shutil.copy(settings_f, settings_f + ".rpmnew")

            # Check that we have ALLOWED_HOSTS
            found = get_cfg("ALLOWED_HOSTS", "local_settings.rpmnew")
            found = filter(lambda x: x.comment is None, found)
            if found and found[0].val:
                pass
            else:
                glob_logger.error("Need to correct ALLOWED_HOSTS")
                sys.exit(1)
示例#2
0
    def backup_settings(self):
        settings_p = "/etc/openstack-dashboard/"
        settings_f = "local_settings"
        settings_full = os.path.join(settings_p, settings_f)

        for host in self.hosts:
            src = "root@{}:{}".format(host, settings_full)
            scp(src, ".")
            shutil.move(settings_f, settings_f + ".old")
            shutil.copy(settings_f, settings_f + ".rpmnew")

            # Check that we have ALLOWED_HOSTS
            found = get_cfg("ALLOWED_HOSTS", "local_settings.rpmnew")
            found = filter(lambda x: x.comment is None, found)
            if found and found[0].val:
                pass
            else:
                glob_logger.error("Need to correct ALLOWED_HOSTS")
                sys.exit(1)
示例#3
0
        # res.output
        while watcher.poll() is None:
            time.sleep(1)
        watcher.close()  # close all our threads (TODO: close automatically)

    cmpt = host
    alias_res = pci.set_pci_alias(cmpt, alias_name, v_id, p_id)
    white_res = pci.set_pci_whitelist(cmpt, v_id, p_id, "./nova.conf")
    filter_res = pci.set_pci_filter(cmpt, "./nova.conf")
    src = "./nova.conf"
    dest = "root@{}:/etc/nova/nova.conf".format(cmpt)
    res = scp(src, dest)

    # TODO: Add the NUMATopologyFilter to the default_scheduler_filter list
    nova_conf = get_nova_conf(host)
    lines = get_cfg("scheduler_default_filters", nova_conf)
    lines_ = list(filter(lambda l: l.comment is None, lines))
    if not lines_:
        glob_logger.error("Unable to get")

    # restart nova
    pci.openstack_service(cmpt, "restart", "nova")


# Setup example
creds = read_rc_file(args.server, "/root/keystonerc_admin")

# Now, we create a PCI flavor and attempt to boot
numa = NUMA(**creds)
flv = numa.create_flavor("pci_small", ram=512, vcpus=1)
pci_pass_flv = numa.create_pci_flavor(alias_name, flv=flv)