Esempio n. 1
0
    def check(verbose_level=1, hostnames=[], servicenames=[]):
        # type: (int, List[str], List[str]) -> Job
        """Do post-deployment smoke tests.

        :param hostnames: host names
        :type hostnames: list
        :param verbose_level: the higher the number, the more verbose
        :type verbose_level: integer
        :param servicenames: services to check. If empty, then check all.
        :type servicenames: list of strings
        :return: Job object
        :rtype: Job
        """
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)
        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.check(hostnames, servicenames)
        return Job(ansible_job)
Esempio n. 2
0
    def stop(verbose_level=1, hostnames=[], servicenames=[]):
        # type: (int, List[str], List[str]) -> Job
        """Stop Hosts.

        Stops all kolla related docker containers on the specified hosts.

        :param hostnames: host names
        :type hostnames: list
        :param verbose_level: the higher the number, the more verbose
        :type verbose_level: integer
        :param servicenames: services to stop. If empty, then stop all.
        :type servicenames: list of strings
        :return: Job object
        :rtype: Job
        """
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(hostnames=hostnames, servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)
        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.stop(hostnames, servicenames)
        return Job(ansible_job)
Esempio n. 3
0
    def pull(verbose_level=1, hostnames=[], servicenames=[]):
        """Pull.

        Pull all images for containers (only pulls, no running container).

        :param verbose_level: the higher the number, the more verbose
        :param hostnames: hosts to pull to. If empty, then pull to all.
        :type hostnames: list of strings
        :type verbose_level: integer
        :param servicenames: services to pull. If empty, then pull all.
        :return: Job object
        :rtype: Job
        """
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(hostnames=hostnames, servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)
        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.pull(hostnames, servicenames)
        return Job(ansible_job)
Esempio n. 4
0
    def deploy(hostnames=[],
               serial_flag=False,
               verbose_level=1,
               servicenames=[]):
        # type: (List[str], bool, int, List[str]) -> Job
        """Deploy.

        Deploy and start all kolla containers.

        :param hostnames: hosts to deploy to. If empty, then deploy to all.
        :type hostnames: list of strings
        :param serial_flag: if true, deploy will be done one host at a time
        :type serial_flag: boolean
        :param verbose_level: the higher the number, the more verbose
        :type verbose_level: integer
        :param servicenames: services to deploy. If empty, then deploy all.
        :type servicenames: list of strings
        :return: Job object
        :rtype: Job
        """
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(serial_flag, u._('Serial flag'), bool)
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(hostnames=hostnames, servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)
        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.deploy(hostnames, serial_flag, servicenames)
        return Job(ansible_job)
Esempio n. 5
0
    def reconfigure(verbose_level=1, hostnames=[], servicenames=[]):
        # type: (int, List[str], List[str]) -> Job
        """Reconfigure.

        Reconfigure OpenStack service.

        :param hostnames: host names
        :type hostnames: list
        :param verbose_level: the higher the number, the more verbose
        :type verbose_level: integer
        :param servicenames: services to prechecks.
        :type servicenames: list of strings
        :return: Job object
        :rtype: Job
        """
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(hostnames=hostnames, servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)

        check_kolla_args(hostnames=hostnames, servicenames=servicenames)

        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.reconfigure(hostnames, servicenames)
        return Job(ansible_job)
Esempio n. 6
0
    def upgrade(verbose_level=1, hostnames=[], servicenames=[]):
        # type: (int, List[str], List[str]) -> Job
        """Upgrade.

        Upgrades existing OpenStack Environment.

        :param verbose_level: the higher the number, the more verbose
        :type verbose_level: integer
        :param hostnames: hostnames to upgrade.
        :type hostnames: list of strings.
        :param servicenames: services to upgrade. If empty, then upgrade all.
        :type servicenames: list of strings
        :return: Job object
        :rtype: Job

        Upgrade containers to new version specified by the property
        "openstack_release."
        """
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)
        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.upgrade(hostnames, servicenames)
        return Job(ansible_job)
Esempio n. 7
0
    def prechecks(verbose_level=1, hostnames=[], servicenames=[]):
        # type: (int, List[str], List[str]) -> Job
        """Check pre-deployment configuration of hosts.

        Check if host is ready for a new deployment. This will fail if
        any of the hosts are not configured correctly or if they have
        already been deployed to.
        :param hostnames: host names
        :type hostnames: list
        :param verbose_level: the higher the number, the more verbose
        :type verbose_level: integer
        :param servicenames: services to prechecks.
        :type servicenames: list of strings
        :return: Job object
        :rtype: Job
        """
        check_arg(hostnames,
                  u._('Host names'),
                  list,
                  empty_ok=True,
                  none_ok=True)
        check_arg(verbose_level, u._('Verbose level'), int)
        check_arg(servicenames,
                  u._('Service names'),
                  list,
                  empty_ok=True,
                  none_ok=True)

        check_kolla_args(hostnames=hostnames, servicenames=servicenames)

        hostnames = safe_decode(hostnames)
        servicenames = safe_decode(servicenames)
        action = KollaAction(verbose_level=verbose_level,
                             playbook_name='site.yml')
        ansible_job = action.precheck(hostnames, servicenames)
        return Job(ansible_job)