Skip to content

New feature: Acquire specific public IP for network#3775

Merged
DaanHoogland merged 1 commit into
apache:masterfrom
ravening:acquire_ip
Dec 24, 2019
Merged

New feature: Acquire specific public IP for network#3775
DaanHoogland merged 1 commit into
apache:masterfrom
ravening:acquire_ip

Conversation

@ravening

Copy link
Copy Markdown
Member

Description

Currently in cloudstack, when we click on "Acquire New Ip", it will
randomly acquire IP from the pool. With this enhancement, it is
possible to select the IP from the drop down IP list of that network.
Same thing applies for a VPC as well.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

Screenshot 2019-12-18 at 16 48 43

Screenshot 2019-12-18 at 16 49 13

Screenshot 2019-12-18 at 16 45 24

How Has This Been Tested?

1 . Navigate to "Networks" section in the main UI
2 . Select any network from the list.
3 . Click on "View IP address" button.
4 . Now click on "Acquire New IP" button on the top right. This will open up a new pop up window with drop down list of all IP address belonging to that network
5 . Select any of the IP address.

Currently in cloudstack, when we click on "Acquire New Ip", it will
randomly acquire IP from the pool. With this enhancement, it is
possible to select the IP from the drop down IP list of that network.
Same thing applies for a VPC as well.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good, marvin test included. wonder if unit test would make sense.

@div8cn

div8cn commented Dec 20, 2019

Copy link
Copy Markdown
Contributor

Can I specify a public IP when creating an isolated network or VPC?

@anuragaw anuragaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Haven't tested though.

One question - When the IP Address requested is invalid or unavailable in user_ip_address do we add that reason in exception or log it? (could'nt see it).

@ravening

Copy link
Copy Markdown
Member Author

Can I specify a public IP when creating an isolated network or VPC?

If you comment out the first diff in network.js then you can specify any free IP in that network or VPC

@ravening

Copy link
Copy Markdown
Member Author

Code looks good. Haven't tested though.

One question - When the IP Address requested is invalid or unavailable in user_ip_address do we add that reason in exception or log it? (could'nt see it).

The dropdown displays only the "Free" IP's available in that particular network or VPC. If there are not free IP in that network/VPC then it wont display the drop down list

@anuragaw

Copy link
Copy Markdown
Contributor

Code looks good. Haven't tested though.
One question - When the IP Address requested is invalid or unavailable in user_ip_address do we add that reason in exception or log it? (could'nt see it).

The dropdown displays only the "Free" IP's available in that particular network or VPC. If there are not free IP in that network/VPC then it wont display the drop down list

But that doesn't cover API usage outside UI @rakgenius , which is how a large number of users access CS.

@ravening

Copy link
Copy Markdown
Member Author

Code looks good. Haven't tested though.
One question - When the IP Address requested is invalid or unavailable in user_ip_address do we add that reason in exception or log it? (could'nt see it).

The dropdown displays only the "Free" IP's available in that particular network or VPC. If there are not free IP in that network/VPC then it wont display the drop down list

But that doesn't cover API usage outside UI @rakgenius , which is how a large number of users access CS.

@anuragaw Just tested it and if the IP is already allocated, it will throw Insufficient address capacity exception

(local) 🐵 > associate ipaddress networkid=6efa8597-d5e8-4bf6-8686-3db26d568ed1 ipaddress=10.11.113.150

{
  "accountid": "9c185c1d-00b2-11ea-a7cf-069f80000fac",
  "cmd": "org.apache.cloudstack.api.command.admin.address.AssociateIPAddrCmdByAdmin",
  "completed": "2019-12-20T15:38:35+0000",
  "created": "2019-12-20T15:38:35+0000",
  "jobid": "ca7f3410-a1be-43ec-880e-448facff96c7",
  "jobinstanceid": "f7a584ca-8a3c-4f72-b647-c92ed31397aa",
  "jobinstancetype": "IpAddress",
  "jobprocstatus": 0,
  "jobresult": {
    "ipaddress": {
      "account": "test",
      "allocated": "2019-12-20T15:38:35+0000",
      "associatednetworkname": "test",
      "domain": "test",
      "fordisplay": true,
      "forvirtualnetwork": true,
      "id": "f7a584ca-8a3c-4f72-b647-c92ed31397aa",
      "ipaddress": "10.11.113.150",
      "isportable": false,
      "issourcenat": false,
      "isstaticnat": false,
      "issystem": false,
      "state": "Allocating",
      "tags": [],
      "vlanname": "vlan://untagged",
      "zonename": "zone113-2"
    }
  },
  "jobresultcode": 0,
  "jobresulttype": "object",
  "jobstatus": 1
}
(local) 🐵 > associate ipaddress networkid=6efa8597-d5e8-4bf6-8686-3db26d568ed1 ipaddress=10.11.113.150
Error 533: Insufficient address capacity
2019-12-20 15:42:35,163 WARN  [c.c.n.IpAddressManagerImpl] (qtp858242339-18:ctx-9d0b2eb1 ctx-a86c335b) (logid:5b743076) Unable to get ip address in  zone id=1, vlanId id=[1]: requested ip 10.11.113.150 is not available
2019-12-20 15:42:35,264 TRACE [o.a.c.a.c.u.a.AssociateIPAddrCmd] (qtp858242339-18:ctx-9d0b2eb1 ctx-a86c335b) (logid:5b743076) com.cloud.exception.InsufficientAddressCapacityException: Insufficient address capacityScope=interface com.cloud.dc.DataCenter; id=1
2019-12-20 15:42:35,264 INFO  [c.c.a.ApiServer] (qtp858242339-18:ctx-9d0b2eb1 ctx-a86c335b) (logid:5b743076) Insufficient address capacity

@anuragaw anuragaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, that's what I was looking for. Some mention of IP not available along with the exception. Even though it's a warning- 2019-12-20 15:42:35,163 WARN [c.c.n.IpAddressManagerImpl] (qtp858242339-18:ctx-9d0b2eb1 ctx-a86c335b) (logid:5b743076) Unable to get ip address in zone id=1, vlanId id=[1]: requested ip 10.11.113.150 is not available

@anuragaw

Copy link
Copy Markdown
Contributor

Running Marvin Tests on the PR.

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✖centos6 ✔centos7 ✔debian. JID-497

@anuragaw

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@anuragaw a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@anuragaw

Copy link
Copy Markdown
Contributor

We can merge after tests job above succeeds.

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-660)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 36796 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3775-t660-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Smoke tests completed. 76 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_05_rvpc_multi_tiers Failure 415.34 test_vpc_redundant.py
test_05_rvpc_multi_tiers Error 442.73 test_vpc_redundant.py

@anuragaw anuragaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM based on code and marvin tests

@ravening

Copy link
Copy Markdown
Member Author

@anuragaw @DaanHoogland can this be merged?

@anuragaw

anuragaw commented Dec 23, 2019

Copy link
Copy Markdown
Contributor

LGTM to be merged @rakgenius , just need to wait for some commitor's attention to have it in. (I am NOT yet a committor in ACS)

@DaanHoogland

Copy link
Copy Markdown
Contributor

@rakgenius I think you have a seat near to Wei's? ;)

@DaanHoogland
DaanHoogland merged commit 482e7eb into apache:master Dec 24, 2019
@ravening

ravening commented Dec 24, 2019

Copy link
Copy Markdown
Member Author

@rakgenius I think you have a seat near to Wei's? ;)

@DaanHoogland :P I sit next to him :) thanks for merging

@andrijapanicsb

Copy link
Copy Markdown
Contributor

@DaanHoogland @anuragaw this was merged without an "outsider" testing this (i.e. person different to the author) which I believe we discussed to make sure is happening when possible.

image
image

This breaks backward compatibility (in GUI at least) since ipaddress=-1 is sent to the API, instead of omitting this parameter when IP is not selected (which works fine, as before).

@rakgenius can you please fix this in a new PR - or revert this PR and make a new one with the fix included?
FYI I stumbled upon this issues while testing something completely different (i.e. not yet hunting any offending PRs)

@ravening

Copy link
Copy Markdown
Member Author

@andrijapanicsb I will make a new PR to fix this issue.

@ravening

Copy link
Copy Markdown
Member Author

@andrijapanicsb I have created a new PR in #3790

@andrijapanicsb

Copy link
Copy Markdown
Contributor

cool - thx!

ustcweizhou pushed a commit to ustcweizhou/cloudstack that referenced this pull request Feb 28, 2020
Currently in cloudstack, when we click on "Acquire New Ip", it will
randomly acquire IP from the pool. With this enhancement, it is
possible to select the IP from the drop down IP list of that network.
Same thing applies for a VPC as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants