'swift-ring-builder <builder_file> remove <search-value> [search-value ...]
[--yes]
or
swift-ring-builder <builder_file> remove
--region <region> --zone <zone> --ip <ip or hostname> --port <port>
--replication-ip <r_ip or r_hostname> --replication-port <r_port>
--device <device_name> --meta <meta> --weight <weight>
[--yes]
Where <r_ip>, <r_hostname> and <r_port> are replication ip, hostname
and port.
Any of the options are optional in both cases.
Removes the device(s) from the ring. This should normally just be used for
a device that has failed. For a device you wish to decommission, it\'s best
to set its weight to 0, wait for it to drain all its data, then use this
remove command. This will not take effect until after running \'rebalance\'.
This is so you can make multiple device changes and rebalance them all just
once.
Option --yes assume a yes response to all questions.'

@staticmethod
def remove():

    if (len(argv) < 4):
        print(Commands.remove.__doc__.strip())
        print()
        print(parse_search_value.__doc__.strip())
        exit(EXIT_ERROR)
    if builder.next_part_power:
        print('Partition    power    increase    in    progress.    You    need    ')
        print('to    finish    the    increase    first    before    removing    devices.')
        exit(EXIT_WARNING)
    (devs, opts) = _parse_remove_values(argv[3:])
    input_question = ('Are    you    sure    you    want    to    remove    these    %s    devices?    (y/N)    ' % len(devs))
    abort_msg = 'Aborting    device    removals'
    check_devs(devs, input_question, opts, abort_msg)
    for dev in devs:
        try:
            builder.remove_dev(dev['id'])
        except exceptions.RingBuilderError as e:
            print(('-' * 79))
            print(('An    error    occurred    while    removing    device    with    id    %d\nThis    usually    means    that    you    attempted    to    remove\nthe    last    device    in    a    ring.    If    this    is    the    case,\nconsider    creating    a    new    ring    instead.\nThe    on-disk    ring    builder    is    unchanged.\nOriginal    exception    message:    %s' % (dev['id'], e)))
            print(('-' * 79))
            exit(EXIT_ERROR)
        print(('%s    marked    for    removal    and    will    be    removed    next    rebalance.' % format_device(dev)))
    builder.save(builder_file)
    exit(EXIT_SUCCESS)
