Skip to content

updatePod does not update start/end IPs #2797

Closed

Description

@resmo

I noticed an API break in 4.11 in which updatePod does not update the start and end IPs, introduced by #2048?

Also see #2735

ISSUE TYPE
  • Bug Report
COMPONENT NAME
API
CLOUDSTACK VERSION
4.11
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY
STEPS TO REPRODUCE
 $ cs listPods name=ansible-test-stxtc00039-64183073-pod                     
{
  "count": 1, 
  "pod": [
    {
      "allocationstate": "Enabled", 
      "endip": [
        "10.100.10.254"
      ], 
      "forsystemvms": [
        "0"
      ], 
      "gateway": "10.100.10.1", 
      "id": "b427733b-f0fd-408d-be31-7f2b4e3b2a95", 
      "name": "ansible-test-stxtc00039-64183073-pod", 
      "netmask": "255.255.255.0", 
      "startip": [
        "10.100.10.101"
      ], 
      "vlanid": [
        "vlan://untagged"
      ], 
      "zoneid": "ff7e77a4-103f-4c1c-9878-cea1573cd622", 
      "zonename": "ansible-test-stxtc00039-64183073-zone"
    }
  ]
}

update the startip

 $ cs updatePod id=b427733b-f0fd-408d-be31-7f2b4e3b2a95 startip=10.100.10.102
{
  "pod": {
    "allocationstate": "Enabled", 
    "endip": [
      "10.100.10.254"
    ], 
    "forsystemvms": [
      "0"
    ], 
    "gateway": "10.100.10.1", 
    "id": "b427733b-f0fd-408d-be31-7f2b4e3b2a95", 
    "name": "ansible-test-stxtc00039-64183073-pod", 
    "netmask": "255.255.255.0", 
    "startip": [
      "10.100.10.101"
    ], 
    "vlanid": [
      "vlan://untagged"
    ], 
    "zoneid": "ff7e77a4-103f-4c1c-9878-cea1573cd622", 
    "zonename": "ansible-test-stxtc00039-64183073-zone"
  }
}
EXPECTED RESULTS
startip gets updated to 10.100.10.102
ACTUAL RESULTS
startip is not updated

Activity

  1. kioie commented on Apr 23, 2019

    @kioie
    Contributor

    Is there a situation where a pod can have multiple IPs as shown below?

    // Check if start IP and end IP of all the ranges lie in the CIDR subnet.
            final String[] existingPodIpRanges = pod.getDescription().split(",");
    
            for(String podIpRange: existingPodIpRanges) {
                final String[] existingPodIpRange = podIpRange.split("-");
    
                if (existingPodIpRange.length > 1) {
                    if (!NetUtils.isValidIp4(existingPodIpRange[0]) || !NetUtils.isValidIp4(existingPodIpRange[1])) {
                        continue;
                    }
    
                    if (!NetUtils.getCidrSubNet(existingPodIpRange[0], cidrSize).equalsIgnoreCase(NetUtils.getCidrSubNet(cidrAddress, cidrSize))) {
                        throw new InvalidParameterValueException("The start address of the some IP range is not in the CIDR subnet.");
                    }
    
                    if (!NetUtils.getCidrSubNet(existingPodIpRange[1], cidrSize).equalsIgnoreCase(NetUtils.getCidrSubNet(cidrAddress, cidrSize))) {
                        throw new InvalidParameterValueException("The end address of the some IP range is not in the CIDR subnet.");
                    }
    
                    if (NetUtils.ipRangesOverlap(existingPodIpRange[0], existingPodIpRange[1], gateway, gateway)) {
                        throw new InvalidParameterValueException("The gateway shouldn't overlap some start/end ip addresses");
                    }
                }
            }
    

    Also, I'm curious as to why the pod start and end IP details are stored as a string in the description field? cc @DaanHoogland @rhtyd

    Screen Shot 2019-04-23 at 9 29 57 AM

  2. added 2 commits that reference this issue on Apr 23, 2019
  3. added this to the 4.13.0.0 milestone on May 27, 2019
  4. modified the milestones: 4.13.0.0, 4.13.1.0 on Jul 4, 2019
  5. modified the milestones: 4.13.1.0, 4.14.0.0 on Dec 7, 2019
  6. andrijapanicsb commented on Jan 3, 2020

    @andrijapanicsb
    Contributor

    Fixes for this issue are being done in PR #3292 - I'll close the issue here and let's continue the discussion in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions