예제 #1
0
    def copy_settings(self):
        settings_p = "/etc/openstack-dashboard/"
        src = "local_settings.rpmnew"
        shutil.copy(src, "local_settings")

        for host in self.hosts:
            dest = "root@{}:{}".format(host, settings_p)
            res = scp(src, dest)
            if res != 0:
                glob_logger.error("Could not copy local_settings to remote")
예제 #2
0
파일: upgrade.py 프로젝트: arif29march/smog
    def copy_settings(self):
        settings_p = "/etc/openstack-dashboard/"
        src = "local_settings.rpmnew"
        shutil.copy(src, "local_settings")

        for host in self.hosts:
            dest = "root@{}:{}".format(host, settings_p)
            res = scp(src, dest)
            if res != 0:
                glob_logger.error("Could not copy local_settings to remote")
예제 #3
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)
예제 #4
0
파일: upgrade.py 프로젝트: arif29march/smog
    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)
예제 #5
0
        virt.pinger(host, timeout=600)

    # This is really only needed for SRIOV or PCI Passthrough with an ethernet
    # device (PCI passthrough and SRIOV only works on VF's not PF's)
    is_vfs_here = pci.get_lspci_info(host)     # Check if we have VF's
    if not is_vfs_here:
        # So there's a bug with using /etc/modprobe.d and setting max_Vfs
        # in a conf file.  So we have to do this ugly hack.
        # scp the change_modprobe.py to remote machine and run it.
        # poll until system is back up
        glob_logger.info("Setting up {} driver to use max_vfs={}".format(args.driver, args.vfs))
        with open("change_modprobe.py", "w") as script:
            script.write(change_modprobe)
        src = "./change_modprobe.py"
        dest = "root@{}:/root".format(host)
        cp_res = scp(src, dest)
        os.unlink("change_modprobe.py")

        # Now, run the script and wait for networking to come back up
        c = "python /root/change_modprobe.py {} {}".format(args.driver, args.vfs)
        cmd = Command(c, host=host)

        # Ughh, we need to throw this in a separate thread because the Command object
        # is using ssh.  Since the script cuts the network, ssh is left hanging
        mp_thr = threading.Thread(target=cmd, kwargs={"throws": False},
                                  daemon=True)
        mp_thr.start()
        virt.pinger(host, timeout=600)
        time.sleep(5)  # give a bit of time for system services to come up

    # Determine what the vendor and product ID are.  intel is always 8086,