Re: [PATCH] crushtool: fix args parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sage,

In fact, I got two problems with the crushtool after upgrading from
0.34 to 0.35.

1. crushtool failed to parse args.

I have a template crushmap (as attached) which only consists of the
root. For each disk, I will use the crushtool to add it to the
crushmap. The command series look like:

$ crushtool -i /etc/ceph/crush.template --add-item 0 1.0 device0 --loc
host host0 --loc cluster cluster0 -o /tmp/crush0
$ crushtool -i /tmp/crush0 --add-item 1 1.0 device1 --loc host host0
--loc cluster cluster0 -o /tmp/crush1


2. crushtool rejected the command due to the commit 58f98e7.

I inverted the commit when upgrading to v0.35.

Henry

2011/9/23 Sage Weil <sage@xxxxxxxxxxxx>:
> Hey Henry-
>
> Do you have a list of commands that were failing handy?  I'd like to
> extend the cli unit tests at the same time (src/test/cli/crushtool).
>
> Thanks-
> sage
>
>
> On Fri, 23 Sep 2011, Henry C Chang wrote:
>
>> Fix --add-item and --loc args parsing.
>>
>> Signed-off-by: Henry C Chang <henry.cy.chang@xxxxxxxxx>
>> ---
>>  src/crushtool.cc |   13 +------------
>>  1 files changed, 1 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/crushtool.cc b/src/crushtool.cc
>> index 51531aa..f0ccb9b 100644
>> --- a/src/crushtool.cc
>> +++ b/src/crushtool.cc
>> @@ -872,9 +872,6 @@ int main(int argc, const char **argv)
>>        }
>>        if (i == args.end())
>>       usage();
>> -      i = args.erase(i);
>> -      if (i == args.end())
>> -     usage();
>>        add_weight = atof(*i);
>>        i = args.erase(i);
>>        if (i == args.end())
>> @@ -885,9 +882,6 @@ int main(int argc, const char **argv)
>>        std::string type(val);
>>        if (i == args.end())
>>       usage();
>> -      i = args.erase(i);
>> -      if (i == args.end())
>> -     usage();
>>        std::string name(*i);
>>        i = args.erase(i);
>>        add_loc[type] = name;
>> @@ -897,9 +891,6 @@ int main(int argc, const char **argv)
>>        reweight_name = val;
>>        if (i == args.end())
>>       usage();
>> -      i = args.erase(i);
>> -      if (i == args.end())
>> -     usage();
>>        reweight_weight = atof(*i);
>>        i = args.erase(i);
>>      } else if (ceph_argparse_flag(args, i, "--build", (char*)NULL)) {
>> @@ -954,10 +945,8 @@ int main(int argc, const char **argv)
>>        int dev = tmp;
>>        if (i == args.end())
>>       usage();
>> -      i = args.erase(i);
>> -      if (i == args.end())
>> -     usage();
>>        float f = atof(*i);
>> +      i = args.erase(i);
>>        int w = (int)(f * 0x10000);
>>        if (w < 0)
>>       w = 0;
>> --
>> 1.7.4.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>

Attachment: crush.template
Description: Binary data


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux