def do_mgmt_flavor_create(cs, args):
    """Create a new flavor"""
    ext = cs.management_flavor_python_troveclient_ext
    flavor = ext.create(args.name, args.ram, args.disk, args.vcpus,
                        args.flavorid, args.ephemeral, args.swap,
                        args.rxtx_factor, args.service_type)
    utils.print_dict(flavor)
 def take_action(self, parsed_args):
     database_limits = self.app.client_manager.database.limits
     limits = database_limits.list()
     # Pop the first one, its absolute limits
     utils.print_dict(limits.pop(0)._info)
     limits = [osc_utils.get_item_properties(i, self.columns)
               for i in limits]
     return self.columns, limits
Ejemplo n.º 3
0
 def take_action(self, parsed_args):
     database_limits = self.app.client_manager.database.limits
     limits = database_limits.list()
     # Pop the first one, its absolute limits
     utils.print_dict(limits.pop(0)._info)
     limits = [
         osc_utils.get_item_properties(i, self.columns) for i in limits
     ]
     return self.columns, limits
Ejemplo n.º 4
0
def _print_object(obj):
    # Get rid of those ugly links
    if obj._info.get('links'):
        del (obj._info['links'])

    # Fallback to str_id for flavors, where necessary
    if hasattr(obj, 'str_id'):
        obj._info['id'] = obj.id
        del (obj._info['str_id'])

    utils.print_dict(obj._info)
Ejemplo n.º 5
0
def _print_object(obj):
    # Get rid of those ugly links
    if obj._info.get('links'):
        del(obj._info['links'])

    # Fallback to str_id for flavors, where necessary
    if hasattr(obj, 'str_id'):
        obj._info['id'] = obj.id
        del(obj._info['str_id'])

    utils.print_dict(obj._info)
Ejemplo n.º 6
0
def _print_object(obj):
    # Get rid of those ugly links
    if obj._info.get("links"):
        del (obj._info["links"])

    # Fallback to str_id for flavors, where necessary
    if hasattr(obj, "str_id"):
        if hasattr(obj, "id") and not obj.id:
            obj._info["id"] = obj.str_id
        del (obj._info["str_id"])

    utils.print_dict(obj._info)
Ejemplo n.º 7
0
    def _update(instance, conf, client, status, **kwargs):
        c_manager = client.configurations
        i_manager = client.instances
        instance = i_manager.get(instance)

        c_manager.update(conf, **kwargs)
        if status == "ACTIVE":
            check_ready(instance)
        elif status == "RESTART_REQUIRED":
            utils.wait_for_status(instance,
                                  update_resource=i_manager.get,
                                  ready_statuse=[status])
            i_manager.restart(instance)
            check_ready(instance)

        print_dict(c_manager.get(conf).to_dict())
Ejemplo n.º 8
0
def _print_instance(instance):
    info = instance._info.copy()
    info['flavor'] = instance.flavor['id']
    if hasattr(instance, 'volume'):
        info['volume'] = instance.volume['size']
        if 'used' in instance.volume:
            info['volume_used'] = instance.volume['used']
    if hasattr(instance, 'ip'):
        info['ip'] = ', '.join(instance.ip)
    if hasattr(instance, 'datastore'):
        info['datastore'] = instance.datastore['type']
        info['datastore_version'] = instance.datastore['version']
    if hasattr(instance, 'configuration'):
        info['configuration'] = instance.configuration['id']
    if hasattr(instance, 'replica_of'):
        info['replica_of'] = instance.replica_of['id']
    if hasattr(instance, 'replicas'):
        replicas = [replica['id'] for replica in instance.replicas]
        info['replicas'] = ', '.join(replicas)
    info.pop('links', None)
    utils.print_dict(info)
Ejemplo n.º 9
0
def _print_instance(instance):
    info = instance._info.copy()
    info["flavor"] = instance.flavor["id"]
    if hasattr(instance, "volume"):
        info["volume"] = instance.volume["size"]
        if "used" in instance.volume:
            info["volume_used"] = instance.volume["used"]
    if hasattr(instance, "ip"):
        info["ip"] = ", ".join(instance.ip)
    if hasattr(instance, "datastore"):
        info["datastore"] = instance.datastore["type"]
        info["datastore_version"] = instance.datastore["version"]
    if hasattr(instance, "configuration"):
        info["configuration"] = instance.configuration["id"]
    if hasattr(instance, "replica_of"):
        info["replica_of"] = instance.replica_of["id"]
    if hasattr(instance, "replicas"):
        replicas = [replica["id"] for replica in instance.replicas]
        info["replicas"] = ", ".join(replicas)
    info.pop("links", None)
    utils.print_dict(info)
Ejemplo n.º 10
0
def _print_instance(instance):
    info = instance._info.copy()
    info['flavor'] = instance.flavor['id']
    if hasattr(instance, 'volume'):
        info['volume'] = instance.volume['size']
        if 'used' in instance.volume:
            info['volume_used'] = instance.volume['used']
    if hasattr(instance, 'ip'):
        info['ip'] = ', '.join(instance.ip)
    if hasattr(instance, 'datastore'):
        info['datastore'] = instance.datastore['type']
        info['datastore_version'] = instance.datastore['version']
    if hasattr(instance, 'configuration'):
        info['configuration'] = instance.configuration['id']
    if hasattr(instance, 'replica_of'):
        info['replica_of'] = instance.replica_of['id']
    if hasattr(instance, 'replicas'):
        replicas = [replica['id'] for replica in instance.replicas]
        info['replicas'] = ', '.join(replicas)
    info.pop('links', None)
    utils.print_dict(info)
Ejemplo n.º 11
0
def do_root_enable(cs, args):
    """Enables root for an instance."""
    root = cs.root.create(args.instance)
    utils.print_dict({'name': root[0], 'password': root[1]})
Ejemplo n.º 12
0
def do_root_show(cs, args):
    """Gets root enabled status for an instance."""
    root = cs.root.is_root_enabled(args.instance)
    utils.print_dict({'is_root_enabled': root.rootEnabled})
def _print_instance(instance):
    if instance._info.get('links'):
        del(instance._info['links'])
    utils.print_dict(instance._info)
def do_mgmt_host_show(cs, args):
    """Show details of a host"""
    host = cs.hosts_python_troveclient_ext.get(args.host)
    utils.print_dict(host)
def do_mgmt_diagnostics_show(cs, args):
    """Get the diagnostics of the guest on an instance"""
    hosts = cs.diagnostics_python_troveclient_ext.get(args.instance)
    utils.print_dict(hosts)
Ejemplo n.º 16
0
def do_configuration_default(cs, args):
    """Shows the default configuration of an instance."""
    configs = cs.instances.configuration(args.instance)
    utils.print_dict(configs._info['configuration'])
Ejemplo n.º 17
0
def do_root_show(cs, args):
    """Gets status if root was ever enabled for an instance."""
    instance = _find_instance(cs, args.instance)
    root = cs.root.is_root_enabled(instance)
    utils.print_dict({"is_root_enabled": root.rootEnabled})
Ejemplo n.º 18
0
def do_root_enable(cs, args):
    """Enables root for an instance and resets if already exists."""
    instance = _find_instance(cs, args.instance)
    root = cs.root.create(instance)
    utils.print_dict({"name": root[0], "password": root[1]})
def _print_cluster(cluster):
    if cluster._info.get('links'):
        del(cluster._info['links'])
    utils.print_dict(cluster._info)
Ejemplo n.º 20
0
def do_root_enable(cs, args):
    """Enables root for an instance and resets if already exists."""
    instance = _find_instance(cs, args.instance)
    root = cs.root.create(instance)
    utils.print_dict({'name': root[0], 'password': root[1]})
Ejemplo n.º 21
0
def do_root_show(cs, args):
    """Shows 'root enabled' status of an instance."""
    root = cs.root.is_root_enabled(args.instance)
    utils.print_dict({'is_root_enabled': root.rootEnabled})
Ejemplo n.º 22
0
 def _list_default_conf_as_admin(self):
     instance = self.context['admin_instance']
     conf = self.admin_clients("trove").instances.configuration(instance)
     print_dict(conf.to_dict())
Ejemplo n.º 23
0
def _print_instance(instance):
    # Get rid of those ugly links
    if instance._info.get('links'):
        del(instance._info['links'])
    utils.print_dict(instance._info)
Ejemplo n.º 24
0
 def _show_conf_as_admin(self):
     manager = self.admin_clients("trove").configurations
     conf = manager.get(self.context['admin_configuration'])
     print_dict(conf.to_dict())
def do_mgmt_hwinfo_show(cs, args):
    """Get the hardware information of an instance"""
    hosts = cs.hwinfo_python_troveclient_ext.get(args.instance)
    utils.print_dict(hosts)
def _print_cluster(cluster):
    if cluster._info.get("links"):
        del (cluster._info["links"])
    utils.print_dict(cluster._info)
Ejemplo n.º 27
0
 def _show_as_admin(self, datastore, version, key):
     param = self.client("trove").config_parameters.get_parameter(
         datastore, version, key)
     print_dict(param)
Ejemplo n.º 28
0
def do_root_show(cs, args):
    """Gets status if root was ever enabled for an instance."""
    instance = _find_instance(cs, args.instance)
    root = cs.root.is_root_enabled(instance)
    utils.print_dict({'is_root_enabled': root.rootEnabled})
Ejemplo n.º 29
0
 def _list_defaut_conf(self):
     instance = self.context['user_instance']
     conf = self.clients("trove").instances.configuration(instance)
     print_dict(conf.to_dict())
Ejemplo n.º 30
0
def do_configuration_default(cs, args):
    """Shows the default configuration of an instance."""
    instance = _find_instance(cs, args.instance)
    configs = cs.instances.configuration(instance)
    utils.print_dict(configs._info["configuration"])
Ejemplo n.º 31
0
 def _show_conf(self):
     manager = self.clients("trove").configurations
     conf = manager.get(self.context['user_configuration'])
     print_dict(conf.to_dict())
def do_mgmt_quota_show(cs, args):
    """Get a list of quota limits for a tenant"""
    hosts = cs.quota_python_troveclient_ext.show(args.tenant)
    utils.print_dict(hosts)
Ejemplo n.º 33
0
    def _list_instances_with_conf(self):

        manager = self.clients("trove").configurations
        instance = manager.instances(self.context['user_configuration'])
        print_dict(instance.to_dict())
def do_mgmt_quota_update(cs, args):
    """Update quota limits for a tenant"""
    quotas = cs.quota_python_troveclient_ext.update(args.tenant, args.quotas)
    utils.print_dict(quotas)
def do_mgmt_account_show(cs, args):
    """Get a list of instances associated with an account"""
    account = cs.accounts_python_troveclient_ext.show(args.account)
    utils.print_dict(account)
Ejemplo n.º 36
0
def do_root_show(cs, args):
    """Gets root enabled status for an instance."""
    root = cs.root.is_root_enabled(args.instance)
    utils.print_dict({'is_root_enabled': root.rootEnabled})
def do_mgmt_root_history(cs, args):
    """Get the root enabled history of an instance"""
    ext = cs.management_python_troveclient_ext
    history = ext.root_enabled_history(args.instance)
    utils.print_dict(history)
Ejemplo n.º 38
0
def _print_instance(instance):
    utils.print_dict(instance._info)