vagrant-openstack-provider icon indicating copy to clipboard operation
vagrant-openstack-provider copied to clipboard

Request: show floatingip assigned to each instance

Open kelbyers opened this issue 10 years ago • 3 comments

Using the vagrant openstack floatingip-list command, I can see floating IPs used by my tenant. But it shows all floating IPs, and it shows the instances using each IP by ID. It would be great if I could get output that is specific to my current Vagrantfile environment, and also mapped to the defined VM names.

For example, instead of this (which includes more than just my current vagrant environment):

+--------------------------------------+----------------+-----------+--------------------------------------+
| Id                                   | IP             | Pool      | Instance id                          |
+--------------------------------------+----------------+-----------+--------------------------------------+
| 1044246d-1509-4fec-b57c-3bcbf2fba4c5 | 172.20.157.244 | net04_ext | a4027049-d8c6-4f29-9d69-8fbcb491a3d2 |
| 23d6fd36-2b93-451f-8bb3-ff1a27ce6c54 | 172.20.157.241 | net04_ext | 37ab1206-08af-4ed9-ba29-ada71810835f |
| 2fcb86d7-9a0b-4e7b-9af9-8c6787be0775 | 172.20.157.240 | net04_ext | 047a2a47-9483-43eb-9947-60552b2c7470 |
| 4b68f4e6-de59-447c-b29a-09b4929a755c | 172.20.157.245 | net04_ext | bfd0938c-f776-4b4a-bc5b-82c7f9a79c8b |
| 5046c5d9-5a06-4eda-8043-b7bbbc704da4 | 172.20.157.154 | net04_ext | aafdd602-9c4c-4bc4-9a67-a05fbd48e436 |
| 5a99239c-a35e-4900-807a-5adbfc139a1d | 172.20.157.243 | net04_ext | a15e58cd-e7a5-4465-bbef-a261453fce34 |
| 66915212-cda3-4b10-b3c3-3f7579f8e5fc | 172.20.157.230 | net04_ext | 3dfac4d7-c83d-4622-93b3-13667732d7e6 |
| 67d7072d-bec7-4137-be4c-da2339672b90 | 172.20.157.242 | net04_ext | 2cacb22a-6594-442b-825b-59f73637de45 |
| 6d558447-26d0-4f1a-a660-cb1a0ce8557b | 172.20.157.231 | net04_ext | 991fc09c-d9eb-4d62-ba07-ba588405de14 |
| 8714a653-2a2f-4173-967b-f6570d714856 | 172.20.157.234 | net04_ext | ebad4e5d-783d-4750-bae0-4f9f1cb61f7f |
| d6719fed-18f0-44cf-89fa-98425464a8cc | 172.20.157.239 | net04_ext | 8f337281-eb84-4a37-9042-27d4cb76a759 |
+--------------------------------------+----------------+-----------+--------------------------------------+

I could get something like this:

$ vagrant status
Current machine states:

stuxsh01.st9999           active (openstack)
stuxsh02.st9999           active (openstack)
stuxsh03.st9999           active (openstack)
stuxsh04.st9999           active (openstack)
stuxsh01.st8888           active (openstack)
stuxsh02.st8888           active (openstack)
stuxsh03.st8888           active (openstack)
stuxsh04.st8888           active (openstack)

$ vagrant openstack list
+-----------------+---------+-------------+----------------------------------------------+
| Name            | Status  | Power State | Networks                                     |
+-----------------+---------+-------------+----------------------------------------------+
| stuxsh01.st8888 | ACTIVE  | Running     | jxb2016_Network=192.168.0.41, 172.20.157.239 |
| stuxsh01.st9999 | ACTIVE  | Running     | jxb2016_Network=192.168.0.40, 172.20.157.231 |
| stuxsh02.st8888 | ACTIVE  | Running     | jxb2016_Network=192.168.0.43, 172.20.157.243 |
| stuxsh02.st9999 | ACTIVE  | Running     | jxb2016_Network=192.168.0.38, 172.20.157.241 |
| stuxsh03.st8888 | ACTIVE  | Running     | jxb2016_Network=192.168.0.44, 172.20.157.244 |
| stuxsh03.st9999 | ACTIVE  | Running     | jxb2016_Network=192.168.0.42, 172.20.157.242 |
| stuxsh04.st8888 | ACTIVE  | Running     | jxb2016_Network=192.168.0.45, 172.20.157.245 |
| stuxsh04.st9999 | ACTIVE  | Running     | jxb2016_Network=192.168.0.39, 172.20.157.240 |
+-----------------+---------+-------------+----------------------------------------------+

At any rate, without installing the openstack CLI or going to the openstack dashboard, I have no way to map the floating IPs to a vagrant instance, because I have no way to get what the instance ID of a vagrant VM is.

kelbyers avatar Jan 07 '15 21:01 kelbyers

I agree, we should be able to get every information we need using vagrant CLI and nothing more. We talked about something like that in issue #143 but it has never been well specified so far.

ggiamarchi avatar Jan 07 '15 21:01 ggiamarchi

BTW, a useful workaround is to use vagrant ssh-config which returns the ssh connection info for all vms in the current vagrant environment, eg:

sensu-pe-demo (internal) $ vagrant ssh-config
Host sensu-pe-master
  HostName 10.2.166.209
  User centos
  Port 22
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/foo/.ssh/foo.key
  IdentitiesOnly yes
  LogLevel ERROR

Host pe-201642-agent
  HostName 10.32.171.70
  User centos
  Port 22
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/foo/.ssh/foo.key
  IdentitiesOnly yes
  LogLevel ERROR

jessereynolds avatar May 12 '17 04:05 jessereynolds

@kelbyers For your concern, the workaround described by @jessereynolds looks to be good enough to me. By the way, if you or someone wish to contribute an implementation for the command vagrant OpenStack list it's fine for me. No problem to include this feature.

ggiamarchi avatar May 22 '17 15:05 ggiamarchi