You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by ustcweizhou <gi...@git.apache.org> on 2016/11/01 08:17:38 UTC

[GitHub] cloudstack issue #1706: CLOUDSTACK-9500: remove the IP from the databag if i...

Github user ustcweizhou commented on the issue:

    https://github.com/apache/cloudstack/pull/1706
  
    this is our change for similar issue
    ```
    diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
    index 9f9513d..fc2b639 100755
    --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
    +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
    @@ -118,6 +118,16 @@ class CsAddress(CsDataBag):
                         if CsDevice(dev, self.config).waitfordevice():
                             ip.configure(address)
    
    +    def delete(self, addr):
    +        for dev in self.dbag:
    +            if dev == "id":
    +                continue
    +            for address in self.dbag[dev]:
    +                if address['public_ip'] == addr:
    +                    self.dbag[dev].remove(address)
    +                    self.save()
    +                    break
    +
    
     class CsInterface:
    
    @@ -537,6 +547,8 @@ class CsIP:
                     route.copy_routes_from_main(devs, [self.dev])
    
             elif method == "delete":
    +            logging.info("delete %s from /etc/cloudstack/ips.json" % self.address['public_ip'])
    +            self.config.address().delete(self.address['public_ip'])
                 logging.warn("delete route not implemented")
    
             self.fw_router()
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---