Esempio n. 1
0
 def test_and_set(k, v, cfg=conf, section=DEFAULT):
     host = self.hosts
     ans = openstack_config(cfg, section, k, opt="get", host=host)
     if v not in ans.output:
         openstack_config(cfg,
                          section,
                          k,
                          opt="set",
                          host=host,
                          value=v)
Esempio n. 2
0
    def upgrade(self):
        commands = [self.stop, self.update, self.sync_db]
        self._upgrade(commands)

        conf = "/etc/neutron/neutron.conf"
        DEFAULT = "DEFAULT"

        def test_and_set(k, v, cfg=conf, section=DEFAULT):
            host = self.hosts
            ans = openstack_config(cfg, section, k, opt="get", host=host)
            if v not in ans.output:
                openstack_config(cfg, section, k, opt="set", host=host, value=v)

        key = "notify_nova_on_port_status_changes"
        val = "true"
        test_and_set(key, val)

        key = "nova_url"
        val = "http://{}:8774/v2".format(self.hosts)
        test_and_set(key, val)

        def set_creds(key, value):
            r = openstack_config(conf, "DEFAULT", key, opt="set", value=value)
            return r

        # This appears to not have changed.  Also, we need the nova credentials
        # not the admin credentials
        if 0:
            for kv in [("nova_admin_username", self.admin),
                       ("nova_admin_password", self.pwd),
                       ("nova_admin_tenant_id", self.tenant_id),
                       ("nova_admin_auth_url", self.auth_url)]:
                set_creds(*kv)


        ans = input("Please check the /etc/neutron/neutron.conf.rpmnew file"
                    " and enter c to continue")
        while str(ans).lower != "c":
            ans = input("Please check the /etc/neutron/neutron.conf.rpmnew "
                        "file and enter c to continue")

        openstack_config(conf, DEFAULT, "agent_down_time", value="75",
                         opt="set", host=self.hosts)

        for neu in self.others:
            openstack_config(conf, "agent", "report_interval", value="30",
                             opt="set", host=neu)

        cmd = Command("killall dnsmasq", host=self.hosts)
        cmd()

        cmd = Command(self.start, host=self.hosts)
        cmd()
Esempio n. 3
0
    def set_upgrade_level(self, version, hosts=None, key="compute"):
        """
        On the juno nodes, edit the /etc/nova/nova.conf and set the
        [upgrade_levels]
        compute=version
        :return:
        """
        if hosts is None:
            hosts = self.juno

        section = "[upgrade_levels]"
        cfg = "/etc/nova/nova.conf"
        for host, _ in self.juno:
            ans = openstack_config(cfg, section, key, opt="get", host=host)
            if version not in ans.output:
                openstack_config(cfg, section, key, opt="set", host=host,
                                 value=version)
Esempio n. 4
0
    def set_upgrade_level(self, version, hosts=None, key="compute"):
        """
        On the juno nodes, edit the /etc/nova/nova.conf and set the
        [upgrade_levels]
        compute=version
        :return:
        """
        if hosts is None:
            hosts = self.juno

        section = "[upgrade_levels]"
        cfg = "/etc/nova/nova.conf"
        for host, _ in self.juno:
            ans = openstack_config(cfg, section, key, opt="get", host=host)
            if version not in ans.output:
                openstack_config(cfg,
                                 section,
                                 key,
                                 opt="set",
                                 host=host,
                                 value=version)
Esempio n. 5
0
 def set_creds(key, value):
     r = openstack_config(conf, "DEFAULT", key, opt="set", value=value)
     return r
Esempio n. 6
0
    def upgrade(self):
        commands = [self.stop, self.update, self.sync_db]
        self._upgrade(commands)

        conf = "/etc/neutron/neutron.conf"
        DEFAULT = "DEFAULT"

        def test_and_set(k, v, cfg=conf, section=DEFAULT):
            host = self.hosts
            ans = openstack_config(cfg, section, k, opt="get", host=host)
            if v not in ans.output:
                openstack_config(cfg,
                                 section,
                                 k,
                                 opt="set",
                                 host=host,
                                 value=v)

        key = "notify_nova_on_port_status_changes"
        val = "true"
        test_and_set(key, val)

        key = "nova_url"
        val = "http://{}:8774/v2".format(self.hosts)
        test_and_set(key, val)

        def set_creds(key, value):
            r = openstack_config(conf, "DEFAULT", key, opt="set", value=value)
            return r

        # This appears to not have changed.  Also, we need the nova credentials
        # not the admin credentials
        if 0:
            for kv in [("nova_admin_username", self.admin),
                       ("nova_admin_password", self.pwd),
                       ("nova_admin_tenant_id", self.tenant_id),
                       ("nova_admin_auth_url", self.auth_url)]:
                set_creds(*kv)

        ans = input("Please check the /etc/neutron/neutron.conf.rpmnew file"
                    " and enter c to continue")
        while str(ans).lower != "c":
            ans = input("Please check the /etc/neutron/neutron.conf.rpmnew "
                        "file and enter c to continue")

        openstack_config(conf,
                         DEFAULT,
                         "agent_down_time",
                         value="75",
                         opt="set",
                         host=self.hosts)

        for neu in self.others:
            openstack_config(conf,
                             "agent",
                             "report_interval",
                             value="30",
                             opt="set",
                             host=neu)

        cmd = Command("killall dnsmasq", host=self.hosts)
        cmd()

        cmd = Command(self.start, host=self.hosts)
        cmd()
Esempio n. 7
0
 def set_creds(key, value):
     r = openstack_config(conf, "DEFAULT", key, opt="set", value=value)
     return r
Esempio n. 8
0
 def test_and_set(k, v, cfg=conf, section=DEFAULT):
     host = self.hosts
     ans = openstack_config(cfg, section, k, opt="get", host=host)
     if v not in ans.output:
         openstack_config(cfg, section, k, opt="set", host=host, value=v)