← Back to team overview

maas-devel team mailing list archive

Re: Allow names instead of IDs ?

 

John,

   Thanks for the patch. To be honest, I was actually thinking of a more
aggressive fix this issue - though I am not sure I'll get to it for 1.9.

   As a part of the networking constraints work, I implemented a generic
querying mechanism that can be used to identify constraints. For example,
if (when specifying a subnet) I write "192.168.0.0/24", it will first be
parsed as an IP network, then search for that subnet by CIDR, then fall
back to finding a subnet by name (or ID, though I don't think I implemented
ID for subnets specifically). It also supports mechanisms to locate a
subnet by means of matching some other object related to it. For example,
if I said "fabric_class:10g,space:foo", it would find me a subnet attached
to a VLAN whose fabric class is "10g", which is also in a space named "foo".

   I think, in general, this is a much more user-friendly mechanism for
locating objects. For example, when I want to query for interfaces, I might
want to say something like "name:eth0,node:tasty-biscuits". I don't want to
first look up the node "tasty-biscuits" and then go through the list of
returned interfaces to find the one I want. So I think supporting
specifier-based queries as a general mechanism for looking up objects would
be an even better solution.

Regards,
Mike

On Wed, Nov 4, 2015 at 7:38 AM, Blake Rouse <blake.rouse@xxxxxxxxxxxxx>
wrote:

> John,
>
> We have implemented this logic for the storage API's. We have a bug filed
> to do the same for the networking API in 1.9.
>
> https://bugs.launchpad.net/maas/+bug/1510917
>
> Thanks,
> Blake
>
> On Wed, Nov 4, 2015 at 5:16 AM, John Meinel <john@xxxxxxxxxxxxxxxxx>
> wrote:
>
>> I was using the CLI some more to create spaces and subnets in them, and
>> kept running into the difficulty having to remember IDs rather than being
>> able to pass in names.
>>
>> So I investigated what it would take to actually use names, and I came up
>> with this patch:
>> https://code.launchpad.net/~jameinel/maas/space-from-name/+merge/276632
>>
>> It is by no means well tested or complete, but it did let me do "maas m1
>> subnet create name=foo space=bar" and have that work rather than "space=1"
>> and also lets me do "maas m1 subnet delete foo" instead of just the id.
>>
>> Is this a sane direction to be going? I'm concerned about compatibility
>> because while "to_field_name" lets me change *what* key is used, it doesn't
>> let me allow IDs *or* names.
>>
>> Thoughts appreciated,
>> John
>> =:->
>>
>>
>> --
>> Mailing list: https://launchpad.net/~maas-devel
>> Post to     : maas-devel@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~maas-devel
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
> --
> Mailing list: https://launchpad.net/~maas-devel
> Post to     : maas-devel@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maas-devel
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References