Пример #1
0
def do_node_list(cc, args):
    """List the nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params['associated'] = utils.bool_argument_value("--associated",
                                                         args.associated)
    if args.maintenance is not None:
        params['maintenance'] = utils.bool_argument_value("--maintenance",
                                                          args.maintenance)
    params['detail'] = args.detail

    if args.detail:
        fields = res_fields.NODE_DETAILED_RESOURCE.fields
        field_labels = res_fields.NODE_DETAILED_RESOURCE.labels
        sort_fields = res_fields.NODE_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.NODE_DETAILED_RESOURCE.sort_labels
    else:
        fields = res_fields.NODE_RESOURCE.fields
        field_labels = res_fields.NODE_RESOURCE.labels
        sort_fields = fields
        sort_field_labels = field_labels

    params.update(utils.common_params_for_list(args,
                                               sort_fields,
                                               sort_field_labels))
    nodes = cc.node.list(**params)
    cliutils.print_list(nodes, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #2
0
def do_node_list(cc, args):
    """List the nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params['associated'] = args.associated
    if args.maintenance is not None:
        params['maintenance'] = args.maintenance
    params['detail'] = args.detail

    # The server cannot sort on "chassis_uuid" because it isn't a
    # column in the "nodes" database table. "chassis_id" is stored,
    # but it is internal to ironic. See bug #1443003 for more details.
    if args.detail:
        fields = res_fields.NODE_FIELDS
        field_labels = res_fields.NODE_FIELD_LABELS
        sort_fields = copy.deepcopy(fields)
        sort_field_labels = copy.deepcopy(field_labels)
        sort_fields.remove('chassis_uuid')
        sort_field_labels.remove('Chassis UUID')
    else:
        fields = res_fields.NODE_LIST_FIELDS
        field_labels = res_fields.NODE_LIST_FIELD_LABELS
        sort_fields = fields
        sort_field_labels = field_labels

    params.update(utils.common_params_for_list(args,
                                               sort_fields,
                                               sort_field_labels))
    nodes = cc.node.list(**params)
    cliutils.print_list(nodes, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #3
0
def do_chassis_list(cc, args):
    """List the chassis."""
    if args.detail:
        fields = res_fields.CHASSIS_DETAILED_RESOURCE.fields
        field_labels = res_fields.CHASSIS_DETAILED_RESOURCE.labels
        sort_fields = res_fields.CHASSIS_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.CHASSIS_DETAILED_RESOURCE.sort_labels
    elif args.fields:
        utils.check_for_invalid_fields(
            args.fields[0], res_fields.CHASSIS_DETAILED_RESOURCE.fields)
        resource = res_fields.Resource(args.fields[0])
        fields = resource.fields
        field_labels = resource.labels
        sort_fields = res_fields.CHASSIS_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.CHASSIS_DETAILED_RESOURCE.sort_labels
    else:
        fields = res_fields.CHASSIS_RESOURCE.fields
        field_labels = res_fields.CHASSIS_RESOURCE.labels
        sort_fields = fields
        sort_field_labels = field_labels

    params = utils.common_params_for_list(args, sort_fields,
                                          sort_field_labels)

    chassis = cc.chassis.list(**params)
    cliutils.print_list(chassis, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #4
0
def do_node_list(cc, args):
    """List the nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params["associated"] = utils.bool_argument_value("--associated", args.associated)
    if args.maintenance is not None:
        params["maintenance"] = utils.bool_argument_value("--maintenance", args.maintenance)
    if args.provision_state is not None:
        params["provision_state"] = args.provision_state
    params["detail"] = args.detail

    if args.detail:
        fields = res_fields.NODE_DETAILED_RESOURCE.fields
        field_labels = res_fields.NODE_DETAILED_RESOURCE.labels
        sort_fields = res_fields.NODE_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.NODE_DETAILED_RESOURCE.sort_labels
    elif args.fields:
        utils.check_for_invalid_fields(args.fields[0], res_fields.NODE_DETAILED_RESOURCE.fields)
        resource = res_fields.Resource(args.fields[0])
        fields = resource.fields
        field_labels = resource.labels
        sort_fields = res_fields.NODE_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.NODE_DETAILED_RESOURCE.sort_labels
    else:
        fields = res_fields.NODE_RESOURCE.fields
        field_labels = res_fields.NODE_RESOURCE.labels
        sort_fields = fields
        sort_field_labels = field_labels

    params.update(utils.common_params_for_list(args, sort_fields, sort_field_labels))
    nodes = cc.node.list(**params)
    cliutils.print_list(nodes, fields, field_labels=field_labels, sortby_index=None)
Пример #5
0
def do_chassis_node_list(cc, args):
    """List the nodes contained in the chassis."""
    nodes = cc.chassis.list_nodes(args.chassis)
    field_labels = ['UUID', 'Instance UUID',
                    'Power State', 'Provisioning State']
    fields = ['uuid', 'instance_uuid', 'power_state', 'provision_state']
    cliutils.print_list(nodes, fields, field_labels, sortby_index=1)
Пример #6
0
def do_port_list(cc, args):
    """List the ports."""
    params = {}

    if args.address is not None:
        params['address'] = args.address

    if args.detail:
        fields = res_fields.PORT_DETAILED_RESOURCE.fields
        field_labels = res_fields.PORT_DETAILED_RESOURCE.labels
        sort_fields = res_fields.PORT_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.PORT_DETAILED_RESOURCE.sort_labels
    else:
        fields = res_fields.PORT_RESOURCE.fields
        field_labels = res_fields.PORT_RESOURCE.labels
        sort_fields = fields
        sort_field_labels = field_labels

    params.update(utils.common_params_for_list(args,
                                               sort_fields,
                                               sort_field_labels))

    port = cc.port.list(**params)
    cliutils.print_list(port, fields,
                        field_labels=field_labels,
                        sortby_index=None)
def do_flavor_create(oneviewclient, novaclient, args):
    """
    Show a list with suggested flavors to be created based on OneView's Server
    Profile Templates. The user can then select a flavor to create based on
    it's ID.
    """
    create_another_flavor_flag = True
    flavor_list = oneviewclient.flavor_list()
    flavor_list = list(flavor_list)

    for j in range(1, len(flavor_list)):
        chave = flavor_list[j]
        i = j - 1
        while i >= 0 and int(flavor_list[i].cpus) > int(chave.cpus):
            flavor_list[i + 1] = flavor_list[i]
            i -= 1
        flavor_list[i + 1] = chave

    for i in range(0, len(flavor_list)):
        flavor_list[i].__setitem__(i + 1)

    flavor_list = set(flavor_list)

    while create_another_flavor_flag:
        create_another_flavor_flag = False
        cliutils.print_list(
            flavor_list,
            ['id', 'cpus', 'disk', 'ram_mb', 'server_profile_template_name',
             'server_hardware_type_name', 'enclosure_group_name'],
            sortby_index=1)
        id = raw_input(
            "Insert flavor Id to add in OneView (press 'q' to quit)> ")

        if id == "q":
            break

        flavor = _get_element_by_id(flavor_list, int(id))
        cliutils.print_list(
            [flavor],
            ['cpus', 'disk', 'ram_mb', 'server_profile_template_name',
             'server_hardware_type_name', 'enclosure_group_name'],
            sortby_index=2)
        flavor_name_default = _get_flavor_name(flavor)
        flavor_name = raw_input(
            "Insert the name of the flavor. Leave blank for [" + flavor_name_default +
            "] (press 'q' to quit)> ")

        if flavor_name == "q":
            break

        if len(flavor_name) == 0:
            flavor_name = flavor_name_default
        nova_flavor = novaclient.flavors.create(
            flavor_name, flavor.ram_mb, flavor.cpus, flavor.disk)
        nova_flavor.set_keys(flavor.extra_specs())
        print('Flavor Created!\n')
        response = raw_input('Create a new flavor? (y/n)> ')
        if response in 'Yy':
            create_another_flavor_flag = True
Пример #8
0
def do_driver_properties(cc, args):
    """Get properties of a driver."""
    properties = cc.driver.properties(args.driver_name)
    obj_list = []
    for key, value in properties.iteritems():
        data = {'Property': key, 'Description': value}
        obj_list.append(type('iface', (object,), data))
    fields = ['Property', 'Description']
    cliutils.print_list(obj_list, fields, mixed_case_fields=fields)
Пример #9
0
def do_driver_properties(cc, args):
    """Get properties of the driver."""
    properties = cc.driver.properties(args.driver_name)
    obj_list = []
    for key, value in properties.iteritems():
        data = {'Property': key, 'Description': value}
        obj_list.append(type('iface', (object, ), data))
    fields = ['Property', 'Description']
    cliutils.print_list(obj_list, fields, mixed_case_fields=fields)
Пример #10
0
def do_driver_list(cc, args):
    """List the enabled drivers."""
    drivers = cc.driver.list()
    # NOTE(lucasagomes): Separate each host by a comma.
    # It's easier to read.
    for d in drivers:
        d.hosts = ', '.join(d.hosts)
    field_labels = ['Supported driver(s)', 'Active host(s)']
    fields = ['name', 'hosts']
    cliutils.print_list(drivers, fields, field_labels=field_labels)
Пример #11
0
def do_driver_list(cc, args):
    """List drivers."""
    drivers = cc.driver.list()
    # NOTE(lucasagomes): Separate each host by a comma.
    # It's easier to read.
    for d in drivers:
        d.hosts = ', '.join(d.hosts)
    field_labels = ['Supported driver(s)', 'Active host(s)']
    fields = ['name', 'hosts']
    cliutils.print_list(drivers, fields, field_labels)
Пример #12
0
def do_node_validate(cc, args):
    """Validate a node's driver interfaces."""
    ifaces = cc.node.validate(args.node)
    obj_list = []
    for key, value in six.iteritems(ifaces.to_dict()):
        data = {'interface': key}
        data.update(value)
        obj_list.append(type('iface', (object,), data))
    field_labels = ['Interface', 'Result', 'Reason']
    fields = ['interface', 'result', 'reason']
    cliutils.print_list(obj_list, fields, field_labels=field_labels)
Пример #13
0
def do_node_validate(cc, args):
    """Validate a node's driver interfaces."""
    ifaces = cc.node.validate(args.node)
    obj_list = []
    for key, value in six.iteritems(ifaces.to_dict()):
        data = {'interface': key}
        data.update(value)
        obj_list.append(type('iface', (object, ), data))
    field_labels = ['Interface', 'Result', 'Reason']
    fields = ['interface', 'result', 'reason']
    cliutils.print_list(obj_list, fields, field_labels=field_labels)
Пример #14
0
def do_port_list(cc, args):
    """List ports."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    port = cc.port.list(**params)
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    cliutils.print_list(port, fields, field_labels, sortby_index=None)
Пример #15
0
def do_node_port_list(cc, args):
    """List the ports associated with the node."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    ports = cc.node.list_ports(args.node, **params)
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    cliutils.print_list(ports, fields, field_labels, sortby_index=None)
def do_chassis_list(cc, args):
    """List chassis."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    chassis = cc.chassis.list(**params)
    field_labels = ['UUID', 'Description']
    fields = ['uuid', 'description']
    cliutils.print_list(chassis, fields, field_labels, sortby_index=None)
Пример #17
0
def do_node_port_list(cc, args):
    """List the ports associated with the node."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    ports = cc.node.list_ports(args.node, **params)
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    cliutils.print_list(ports, fields, field_labels, sortby_index=None)
Пример #18
0
def do_port_list(cc, args):
    """List ports."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    port = cc.port.list(**params)
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    cliutils.print_list(port, fields, field_labels, sortby_index=None)
def do_chassis_list(cc, args):
    """List chassis."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    chassis = cc.chassis.list(**params)
    field_labels = ['UUID', 'Description']
    fields = ['uuid', 'description']
    cliutils.print_list(chassis, fields, field_labels, sortby_index=None)
def do_chassis_node_list(cc, args):
    """List the nodes contained in the chassis."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    nodes = cc.chassis.list_nodes(args.chassis, **params)
    field_labels = ['UUID', 'Instance UUID',
                    'Power State', 'Provisioning State']
    fields = ['uuid', 'instance_uuid', 'power_state', 'provision_state']
    cliutils.print_list(nodes, fields, field_labels, sortby_index=None)
Пример #21
0
def do_node_port_list(cc, args):
    """List the ports associated with a node."""
    if args.detail:
        fields = res_fields.PORT_FIELDS
        field_labels = res_fields.PORT_FIELD_LABELS
    else:
        fields = res_fields.PORT_LIST_FIELDS
        field_labels = res_fields.PORT_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    ports = cc.node.list_ports(args.node, **params)
    cliutils.print_list(
        ports, fields, field_labels=field_labels, sortby_index=None)
Пример #22
0
def do_node_list(cc, args):
    """List nodes."""
    params = {}
    if args.associated is not None:
        params['associated'] = args.associated
    if args.maintenance is not None:
        params['maintenance'] = args.maintenance

    nodes = cc.node.list(**params)
    field_labels = ['UUID', 'Instance UUID', 'Power State',
                    'Provisioning State', 'Maintenance']
    fields = ['uuid', 'instance_uuid', 'power_state',
              'provision_state', 'maintenance']
    cliutils.print_list(nodes, fields, field_labels, sortby_index=1)
def do_chassis_node_list(cc, args):
    """List the nodes contained in the chassis."""
    params = {}
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    nodes = cc.chassis.list_nodes(args.chassis, **params)
    field_labels = [
        'UUID', 'Instance UUID', 'Power State', 'Provisioning State'
    ]
    fields = ['uuid', 'instance_uuid', 'power_state', 'provision_state']
    cliutils.print_list(nodes, fields, field_labels, sortby_index=None)
Пример #24
0
def do_node_port_list(cc, args):
    """List the ports associated with a node."""
    if args.detail:
        fields = res_fields.PORTS_DETAILED_RESOURCE.fields
        field_labels = res_fields.PORTS_DETAILED_RESOURCE.labels
    else:
        fields = res_fields.PORT_RESOURCE.fields
        field_labels = res_fields.PORT_RESOURCE.labels

    params = utils.common_params_for_list(args, fields, field_labels)

    ports = cc.node.list_ports(args.node, **params)
    cliutils.print_list(ports, fields,
                        field_labels=field_labels,
                        sortby_index=None)
def do_chassis_node_list(cc, args):
    """List the nodes contained in a chassis."""
    if args.detail:
        fields = res_fields.NODE_DETAILED_RESOURCE.fields
        field_labels = res_fields.NODE_DETAILED_RESOURCE.labels
    else:
        fields = res_fields.NODE_RESOURCE.fields
        field_labels = res_fields.NODE_RESOURCE.labels

    params = utils.common_params_for_list(args, fields, field_labels)

    nodes = cc.chassis.list_nodes(args.chassis, **params)
    cliutils.print_list(nodes, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #26
0
def do_chassis_list(cc, args):
    """List the chassis."""
    if args.detail:
        fields = res_fields.CHASSIS_FIELDS
        field_labels = res_fields.CHASSIS_FIELD_LABELS
    else:
        fields = res_fields.CHASSIS_LIST_FIELDS
        field_labels = res_fields.CHASSIS_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    chassis = cc.chassis.list(**params)
    cliutils.print_list(chassis, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #27
0
def do_chassis_node_list(cc, args):
    """List the nodes contained in a chassis."""
    if args.detail:
        fields = res_fields.NODE_FIELDS
        field_labels = res_fields.NODE_FIELD_LABELS
    else:
        fields = res_fields.NODE_LIST_FIELDS
        field_labels = res_fields.NODE_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    nodes = cc.chassis.list_nodes(args.chassis, **params)
    cliutils.print_list(nodes, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #28
0
def do_node_port_list(cc, args):
    """List the ports associated with a node."""
    if args.detail:
        fields = res_fields.PORT_FIELDS
        field_labels = res_fields.PORT_FIELD_LABELS
    else:
        fields = res_fields.PORT_LIST_FIELDS
        field_labels = res_fields.PORT_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    ports = cc.node.list_ports(args.node, **params)
    cliutils.print_list(ports, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #29
0
def do_port_list(cc, args):
    """List ports."""
    if args.detail:
        fields = res_fields.PORT_FIELDS
        field_labels = res_fields.PORT_FIELD_LABELS
    else:
        fields = res_fields.PORT_LIST_FIELDS
        field_labels = res_fields.PORT_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    port = cc.port.list(**params)
    cliutils.print_list(port, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #30
0
def do_chassis_list(cc, args):
    """List the chassis."""
    if args.detail:
        fields = res_fields.CHASSIS_FIELDS
        field_labels = res_fields.CHASSIS_FIELD_LABELS
    else:
        fields = res_fields.CHASSIS_LIST_FIELDS
        field_labels = res_fields.CHASSIS_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    chassis = cc.chassis.list(**params)
    cliutils.print_list(chassis,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #31
0
def do_port_list(cc, args):
    """List ports."""
    if args.detail:
        fields = res_fields.PORT_FIELDS
        field_labels = res_fields.PORT_FIELD_LABELS
    else:
        fields = res_fields.PORT_LIST_FIELDS
        field_labels = res_fields.PORT_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    port = cc.port.list(**params)
    cliutils.print_list(port,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #32
0
def do_node_port_list(cc, args):
    """List the ports associated with a node."""
    if args.detail:
        fields = res_fields.PORTS_DETAILED_RESOURCE.fields
        field_labels = res_fields.PORTS_DETAILED_RESOURCE.labels
    else:
        fields = res_fields.PORT_RESOURCE.fields
        field_labels = res_fields.PORT_RESOURCE.labels

    params = utils.common_params_for_list(args, fields, field_labels)

    ports = cc.node.list_ports(args.node, **params)
    cliutils.print_list(ports,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #33
0
def do_chassis_node_list(cc, args):
    """List the nodes contained in a chassis."""
    if args.detail:
        fields = res_fields.NODE_DETAILED_RESOURCE.fields
        field_labels = res_fields.NODE_DETAILED_RESOURCE.labels
    else:
        fields = res_fields.NODE_RESOURCE.fields
        field_labels = res_fields.NODE_RESOURCE.labels

    params = utils.common_params_for_list(args, fields, field_labels)

    nodes = cc.chassis.list_nodes(args.chassis, **params)
    cliutils.print_list(nodes,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #34
0
def do_chassis_node_list(cc, args):
    """List the nodes contained in a chassis."""
    if args.detail:
        fields = res_fields.NODE_FIELDS
        field_labels = res_fields.NODE_FIELD_LABELS
    else:
        fields = res_fields.NODE_LIST_FIELDS
        field_labels = res_fields.NODE_LIST_FIELD_LABELS

    params = utils.common_params_for_list(args, fields, field_labels)

    nodes = cc.chassis.list_nodes(args.chassis, **params)
    cliutils.print_list(nodes,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #35
0
def do_node_list(cc, args):
    """List nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params['associated'] = args.associated
    if args.maintenance is not None:
        params['maintenance'] = args.maintenance
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit

    nodes = cc.node.list(**params)
    field_labels = ['UUID', 'Instance UUID', 'Power State',
                    'Provisioning State', 'Maintenance']
    fields = ['uuid', 'instance_uuid', 'power_state',
              'provision_state', 'maintenance']
    cliutils.print_list(nodes, fields, field_labels, sortby_index=None)
Пример #36
0
def do_chassis_list(cc, args):
    """List the chassis."""
    if args.detail:
        fields = res_fields.CHASSIS_DETAILED_RESOURCE.fields
        field_labels = res_fields.CHASSIS_DETAILED_RESOURCE.labels
        sort_fields = res_fields.CHASSIS_DETAILED_RESOURCE.sort_fields
        sort_field_labels = res_fields.CHASSIS_DETAILED_RESOURCE.sort_labels
    else:
        fields = res_fields.CHASSIS_RESOURCE.fields
        field_labels = res_fields.CHASSIS_RESOURCE.labels
        sort_fields = fields
        sort_field_labels = field_labels

    params = utils.common_params_for_list(args, sort_fields, sort_field_labels)

    chassis = cc.chassis.list(**params)
    cliutils.print_list(chassis,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #37
0
def do_node_list(cc, args):
    """List the nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params['associated'] = args.associated
    if args.maintenance is not None:
        params['maintenance'] = args.maintenance
    params['detail'] = args.detail

    if args.detail:
        fields = res_fields.NODE_FIELDS
        field_labels = res_fields.NODE_FIELD_LABELS
    else:
        fields = res_fields.NODE_LIST_FIELDS
        field_labels = res_fields.NODE_LIST_FIELD_LABELS

    params.update(utils.common_params_for_list(args, fields, field_labels))
    nodes = cc.node.list(**params)
    cliutils.print_list(
        nodes, fields, field_labels=field_labels, sortby_index=None)
Пример #38
0
def do_port_list(cc, args):
    """List the ports."""
    params = {}

    if args.address is not None:
        params['address'] = args.address
    if args.detail:
        fields = res_fields.PORT_FIELDS
        field_labels = res_fields.PORT_FIELD_LABELS
    else:
        fields = res_fields.PORT_LIST_FIELDS
        field_labels = res_fields.PORT_LIST_FIELD_LABELS

    params.update(utils.common_params_for_list(args,
                                               fields,
                                               field_labels))

    port = cc.port.list(**params)
    cliutils.print_list(port, fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #39
0
def do_node_list(cc, args):
    """List nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params['associated'] = args.associated
    if args.maintenance is not None:
        params['maintenance'] = args.maintenance
    if args.marker is not None:
        params['marker'] = args.marker
    if args.limit is not None:
        params['limit'] = args.limit
    params['detail'] = args.detail

    nodes = cc.node.list(**params)
    if args.detail:
        cliutils.print_list(nodes, FIELDS, FIELD_LABELS, sortby_index=None)
    else:
        cliutils.print_list(nodes,
                            LIST_FIELDS,
                            LIST_FIELD_LABELS,
                            sortby_index=None)
Пример #40
0
def do_node_list(cc, args):
    """List nodes which are registered with the Ironic service."""
    params = {}
    if args.associated is not None:
        params['associated'] = args.associated
    if args.maintenance is not None:
        params['maintenance'] = args.maintenance
    params['detail'] = args.detail

    if args.detail:
        fields = res_fields.NODE_FIELDS
        field_labels = res_fields.NODE_FIELD_LABELS
    else:
        fields = res_fields.NODE_LIST_FIELDS
        field_labels = res_fields.NODE_LIST_FIELD_LABELS

    params.update(utils.common_params_for_list(args, fields, field_labels))
    nodes = cc.node.list(**params)
    cliutils.print_list(nodes,
                        fields,
                        field_labels=field_labels,
                        sortby_index=None)
Пример #41
0
def do_chassis_list(cc, args):
    """List chassis."""
    chassis = cc.chassis.list()
    field_labels = ['UUID', 'Description']
    fields = ['uuid', 'description']
    cliutils.print_list(chassis, fields, field_labels, sortby_index=1)
Пример #42
0
def do_node_port_list(cc, args):
    """List the ports contained in the node."""
    ports = cc.node.list_ports(args.node)
    field_labels = ['UUID', 'Address']
    fields = ['uuid', 'address']
    cliutils.print_list(ports, fields, field_labels, sortby_index=1)