← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1551085] Re: When attache more than one interface, Only one interface was attached

 

So it turns out this is the default behavior by argparse.

Specifying an option more than once with the default action='store' just
stores the last occurrence, see:

http://stackoverflow.com/questions/12461087/detecting-if-any-command-
line-options-were-specified-more-than-once-with-optpars

If we wanted a list, we'd use action='append' but that's not what we
want.

I think the default of action='store' to allow multiples but ignore all
but the last seems weird, but maybe argparse has never fixed that since
it'd break a default behavior, and thus probably a lot of scripts.

If you wanted to enforce this in novaclient, it sounds like you have to
write your own Action class which enforces that only one option is
specified.

** Changed in: nova
       Status: New => Invalid

** Changed in: python-novaclient
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1551085

Title:
  When attache more than one interface, Only one interface was attached

Status in OpenStack Compute (nova):
  Invalid
Status in python-novaclient:
  Invalid

Bug description:
  1. Create a VM
  2. attache many interface once,
  3. look at the result, only one interface was attached.

  for example
  1. nova interface-list vmtest 
  +------------+--------------------------------------+--------------------------------------+--------------+-------------------+
  | Port State | Port ID                              | Net ID                               | IP addresses | MAC Addr          |
  +------------+--------------------------------------+--------------------------------------+--------------+-------------------+
  | ACTIVE     | 1b149cce-0730-4d30-8c65-aab0fbf67bc1 | 90e6bf83-f424-4b0e-9045-74d9ce39edf0 | 162.1.1.3    | fa:16:3e:e6:54:43 |
  +------------+--------------------------------------+--------------------------------------+--------------+-------------------+
  2. nova interface-attach --net-id 6b4f473c-8cc4-4c33-9803-632235945ae4 --net-id 21cc9584-29be-455d-991e-f58bfa1dbb1f  vmtest
  nova interface-list vmtest
  +------------+--------------------------------------+--------------------------------------+--------------+-------------------+
  | Port State | Port ID                              | Net ID                               | IP addresses | MAC Addr          |
  +------------+--------------------------------------+--------------------------------------+--------------+-------------------+
  | ACTIVE     | 1b149cce-0730-4d30-8c65-aab0fbf67bc1 | 90e6bf83-f424-4b0e-9045-74d9ce39edf0 | 162.1.1.3    | fa:16:3e:e6:54:43 |
  | ACTIVE     | 8b225be4-f81d-4f6c-a667-492cc68a384b | 21cc9584-29be-455d-991e-f58bfa1dbb1f | 192.168.5.10 | fa:16:3e:97:78:01 |
  +------------+--------------------------------------+--------------------------------------+--------------+-------------------+

  # the argument " --net-id 6b4f473c-8cc4-4c33-9803-632235945ae4" was
  not executed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1551085/+subscriptions


References