[Openstack] [Swift] Bug: swift-ring-builder <builder file> set_weight doesn't work

Matthew Oliver matt at oliver.net.au
Sun Jan 29 22:48:30 UTC 2017


Hey Alexandr,

Thanks for the email. I can help you in this instance, and I'll push up a
patch to correct the usage documentation for the long version of the
set_weight command.


On Sun, Jan 29, 2017 at 8:33 AM, Alexandr Porunov <
alexandr.porunov at gmail.com> wrote:

> Hello,
>
> I can't change a weight of the device.
> Here is a list of my devices:
>
> Devices:    id  region  zone      ip address  port  replication ip
>  replication port      name weight partitions balance meta
>              0       1     1           host1  6000           host1
>      6000        d1 1000.00       1024    0.00 bla bla1 bla2
>              1       1     1           host1  6000           host1
>      6000        d2 1000.00       1024    0.00 bla bla1 bla2
>              2       1     1           host1  6000           host1
>      6000        d3 1000.00       1024    0.00 bla bla1 bla2
>
> Here is what I tried to change a weight:
> swift-ring-builder object.builder set_weight --region 1 --zone 1 --ip
> host1 --port 6000 --replication-ip host1 --replication-port 6000 --device
> d1 --meta "bla bla1 bla2" --weight 1000
>

There is a problem with the command as you've sent it. But I agree it isn't
obvious from the usage error. Using the long form (--region, --device, etc)
is just defining search criteria for what you want to change. Not
specifying what you want to change.

So in your case above your looking for a device that already has a weight
of 1000, and your not specifying what the change it to. To fix your
command, you'd need to:

  swift-ring-builder object.builder set_weight --region 1 --zone 1 --ip
host1 --port 6000 --replication-ip host1 --replication-port 6000 --device
d1 --meta "bla bla1 bla2" --weight 1024 1000

NOTE: I am sending in the 1000 as the last option. Obviously as these are
search terms you don't actually have to send them all in, only the ones
that identify the devices or device you want to change.


> swift-ring-builder object.builder set_weight r1z1-host1:6000Rhost1:6000
> d1_"bla bla1 bla2" 2000
>

The short version above is failing, as you forgot to add the '/' seperator
between the port and the device, given your example it should have been:

    swift-ring-builder object.builder set_weight
r1z1-host1:6000Rhost1:6000/d1_"bla bla1 bla2" 2000

NOTE: the '/' before the d1.

What your putting in there is just a search for devices to change. You
don't have to put the full string in. I guess if you have a tool that will
use the full definition then fine. I find when wanting to update just 1
host it's easier to do so via the device id:

  swift-ring-builder set_weight d1 2000

In both cases it doesn't work and shows the next information:
>
> swift-ring-builder <builder_file> set_weight <search-value> <weight>
>
>     [<search-value> <weight] ...
>
>     [--yes]
>
>
>
> or
>
>
>
> swift-ring-builder <builder_file> set_weight
>
>     --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]
>
>

This usage isn't been very useful here, as it's missing the actual adding
the weight. I'll raise a bug and patch to address this.


>
>
>     Where <r_ip>, <r_hostname> and <r_port> are replication ip, hostname
>
>     and port.
>
>     Any of the options are optional in both cases.
>
>
>
>     Resets the devices' weights. No partitions will be reassigned to or
> from
>     the device 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.
>
>
> Please, correct me if it is my fault.
>
> Best regards,
> Alexandr
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/
> openstack
> Post to     : openstack at lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/
> openstack
>
>
regards,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20170130/ac8a60f3/attachment.html>


More information about the Openstack mailing list