def main(argv): cli_utils.setup_logging() parser = argparse.ArgumentParser() parser.add_argument( "--target_release", default='auto', help="Openstack release name to upgrade to or 'auto' " "to have script upgrade based on the lowest value" "across all services") options = parser.parse_args() target_release = cli_utils.parse_arg(options, 'target_release') principle_services = mojo_utils.get_principle_applications() current_versions = openstack_utils.get_current_os_versions( principle_services) if target_release == 'auto': # If in auto mode find the lowest value openstack release across all # services and make sure all servcies are upgraded to one release # higher than the lowest lowest_release = mojo_os_utils.get_lowest_os_version(current_versions) target_release = mojo_os_utils.next_release(lowest_release)[1] # Get a list of services that need upgrading needs_upgrade = get_upgrade_targets(target_release, current_versions) for application in openstack_utils.UPGRADE_SERVICES: if application['name'] not in principle_services: continue if application['name'] not in needs_upgrade: logging.info('Not upgrading {} it is at {} or higher'.format( application['name'], target_release) ) continue logging.info('Upgrading {} to {}'.format(application['name'], target_release)) # Update required relations update_relations(application['name'], target_release) ubuntu_version = mojo_utils.get_ubuntu_version(application['name']) config = {application['type']['origin_setting']: "cloud:{}-{}/proposed" .format(ubuntu_version, target_release)} model.set_application_config(application['name'], config) # NOTE: For liberty->mitaka upgrade ceilometer-agent gets stuck at # 'Services not running that should be: memcached' after nova-compute # upgrade, and test would wait forever. Therefore we upgrade # ceilometer-agent immediately after nova-compute. if application['name'] == 'nova-compute': model.set_application_config('ceilometer-agent', config) mojo_utils.juju_wait_finished()
def main(argv): cli_utils.setup_logging() parser = argparse.ArgumentParser() parser.add_argument("term_method", default='juju', nargs='?') options = parser.parse_args() term_method = cli_utils.parse_arg(options, 'term_method') services = mojo_utils.get_principle_applications() for svc in services: doomed_service = services.pop(0) if mojo_utils.is_crm_clustered(doomed_service): mojo_os_utils.delete_crm_leader(doomed_service, method=term_method) else: mojo_utils.delete_oldest(doomed_service, method=term_method) mojo_utils.juju_check_hooks_complete() mojo_utils.juju_wait_finished() mojo_utils.add_unit(svc, unit_num=1) mojo_utils.juju_check_hooks_complete() mojo_utils.juju_wait_finished()
def main(argv): parser = argparse.ArgumentParser() parser.add_argument("--service") parser.add_argument("--kv") parser.add_argument("--wait") options = parser.parse_args() application = cli_utils.parse_arg(options, 'service') key, value = cli_utils.parse_arg(options, 'kv').split("=") wait = cli_utils.parse_arg(options, 'wait') print("Wait: {}".format(wait)) if wait is not None: wait = wait == 'True' print("Applicatoin: {}".format(application)) print("Option: {}={}".format(key, value)) print("Wait: {}".format(wait)) model.set_application_config(application, {key: value}) if wait: mojo_utils.juju_wait_finished()
def main(argv): cli_utils.setup_logging() parser = argparse.ArgumentParser() parser.add_argument("term_method", default='juju', nargs='?') skip_applications = ['neutron-gateway', 'mongodb', 'heat', 'rabbitmq-server'] princ_applications = mojo_utils.get_principle_applications() applications = [item for item in princ_applications if item not in skip_applications] for svc in applications: doomed_application = applications.pop(0) mojo_utils.delete_juju_leader(doomed_application) mojo_utils.juju_check_hooks_complete() mojo_utils.juju_wait_finished() check_cluster_status(doomed_application) mojo_utils.add_unit(doomed_application, unit_num=1) mojo_utils.juju_wait_finished() mojo_utils.juju_check_hooks_complete() check_crm_status(doomed_application)
def main(argv): cli_utils.setup_logging() parser = argparse.ArgumentParser() parser.add_argument( "--target_release", default='auto', help="Openstack release name to upgrade to or 'auto' " "to have script upgrade based on the lowest value" "across all services") options = parser.parse_args() target_release = cli_utils.parse_arg(options, 'target_release') principle_services = mojo_utils.get_principle_applications() current_versions = openstack_utils.get_current_os_versions( principle_services) if target_release == 'auto': # If in auto mode find the lowest value openstack release across all # services and make sure all servcies are upgraded to one release # higher than the lowest lowest_release = mojo_os_utils.get_lowest_os_version(current_versions) target_release = mojo_os_utils.next_release(lowest_release)[1] # Get a list of services that need upgrading needs_upgrade = get_upgrade_targets(target_release, current_versions) add_new_charms(target_release) mojo_utils.juju_wait_finished() for application in openstack_utils.UPGRADE_SERVICES: if application['name'] not in principle_services: continue if application['name'] not in needs_upgrade: logging.info('Not upgrading {} it is at {} or higher'.format( application['name'], target_release) ) continue logging.info('Upgrading {} to {}'.format(application['name'], target_release)) # Update required relations update_relations(application['name'], target_release) ubuntu_version = mojo_utils.get_ubuntu_version(application['name']) config = {application['type']['origin_setting']: "cloud:{}-{}/proposed" .format(ubuntu_version, target_release)} model.set_application_config(application['name'], config) mojo_utils.juju_wait_finished()
#!/usr/bin/env python import sys from utils.mojo_utils import juju_wait_finished if __name__ == '__main__': sys.exit(juju_wait_finished())
allocation_pools = subnet['allocation_pools'] self.cidr = subnet['cidr'] self.highest_assigned = netaddr.IPAddress(allocation_pools[0]['end']) # XXX look away now, nothing to see here, move along. # If there is less than 30 free ips in the network after the top # dhcp ip then eat into the top of the dhcp range available_ips = [] for element in list(netaddr.IPNetwork(self.cidr)): if element == netaddr.IPAddress(self.highest_assigned) or \ available_ips: available_ips.append(element) if len(available_ips) < 30: self.highest_assigned = self.highest_assigned - 30 def get_next(self): next_ip = self.highest_assigned + 1 if next_ip in list(netaddr.IPNetwork(self.cidr)): self.highest_assigned = self.highest_assigned + 1 return next_ip else: raise Exception("vip pool exhausted") cli_utils.setup_logging() vp = VipPool() juju_status = juju_utils.get_full_juju_status() for application in juju_status.applications.keys(): if 'vip' in model.get_application_config(application).keys(): model.set_application_config(application, {'vip': vp.get_next()}) mojo_utils.juju_wait_finished()
def main(argv): return mojo_utils.juju_wait_finished()