summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2/server.py
diff options
context:
space:
mode:
authorCedric Brandily <zzelle@gmail.com>2017-03-31 16:53:20 +0200
committerDean Troyer <dtroyer@gmail.com>2017-04-04 11:15:29 -0500
commit7f9814860ad739e25b82898176d26c7b788e8e33 (patch)
tree7514d02c549f3762c91cc5efeedbab7487a66de0 /openstackclient/compute/v2/server.py
parentc7e7f2b7303ad55befb9b42cada2bbe336a4cf0e (diff)
downloadpython-openstackclient-7f9814860ad739e25b82898176d26c7b788e8e33.tar.gz
Enable to specify which fixed-ip to add to a vm.
This change enables to specify which fixed-ip will be added to a vm using: openstack server add fixed ip <vm> <network> --fixed-ip-address <ip> This change uses interface_attach instead of add_fixed_ip[1] which is less flexible and uses a deprecated API. [1] https://review.openstack.org/384261 Closes-Bug: #1678140 Change-Id: I7fe4621439ef0d8dca080551ffaeb614c5a91174
Diffstat (limited to 'openstackclient/compute/v2/server.py')
-rw-r--r--openstackclient/compute/v2/server.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index edb06603..ae839677 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -206,6 +206,11 @@ class AddFixedIP(command.Command):
"Network to allocate the fixed IP address from (name or ID)"
),
)
+ parser.add_argument(
+ "--fixed-ip-address",
+ metavar="<ip-address>",
+ help=_("Requested fixed IP address"),
+ )
return parser
def take_action(self, parsed_args):
@@ -217,7 +222,8 @@ class AddFixedIP(command.Command):
network = utils.find_resource(
compute_client.networks, parsed_args.network)
- server.add_fixed_ip(network.id)
+ server.interface_attach(port_id=None, net_id=network.id,
+ fixed_ip=parsed_args.fixed_ip_address)
class AddFloatingIP(command.Command):