This is an automated email from the ASF dual-hosted git repository.

gabriel pushed a commit to branch python3-vr
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 12b2a2f4f35afdf60def6b4418975d96685ab464
Author: Daan Hoogland <d...@onecht.net>
AuthorDate: Wed Mar 10 17:01:35 2021 +0100

    ip to net address conversions
---
 systemvm/debian/opt/cloud/bin/cs/CsAddress.py | 4 +++-
 systemvm/debian/opt/cloud/bin/cs/CsHelper.py  | 2 +-
 systemvm/debian/opt/cloud/bin/cs_ip.py        | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py 
b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py
index 8f688d7..512734c 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsAddress.py
@@ -149,7 +149,9 @@ class CsInterface:
 
     def ip_in_subnet(self, ip):
         ipo = ip_address(ip)
-        net = ip_network("%s/%s" % (self.get_ip(), self.get_size()))
+        # we are using an ip as netaddress so strict must be False
+        net = ip_network("%s/%s" % (self.get_ip(), self.get_size()),
+                         strict=False)
         return ipo in net
 
     def get_gateway_cidr(self):
diff --git a/systemvm/debian/opt/cloud/bin/cs/CsHelper.py 
b/systemvm/debian/opt/cloud/bin/cs/CsHelper.py
index c818c39..1809170 100755
--- a/systemvm/debian/opt/cloud/bin/cs/CsHelper.py
+++ b/systemvm/debian/opt/cloud/bin/cs/CsHelper.py
@@ -119,7 +119,7 @@ def get_device_info():
             to = {}
             to['ip'] = vals[1]
             to['dev'] = vals[-1]
-            to['network'] = ip_network(to['ip'])
+            to['network'] = ip_network(to['ip'], strict=False)
             to['dnsmasq'] = False
             list.append(to)
     return list
diff --git a/systemvm/debian/opt/cloud/bin/cs_ip.py 
b/systemvm/debian/opt/cloud/bin/cs_ip.py
index 5a9f275..cb6541b 100755
--- a/systemvm/debian/opt/cloud/bin/cs_ip.py
+++ b/systemvm/debian/opt/cloud/bin/cs_ip.py
@@ -42,7 +42,9 @@ def merge(dbag, ip):
                     nic_dev_id = address['nic_dev_id']
                 dbag[dev].remove(address)
 
-    ipo = ip_network(ip['public_ip'] + '/' + ip['netmask'])
+    # we are passing and must allow for host bits so strict is False
+    ipo = ip_network(ip['public_ip'] + '/' + ip['netmask'],
+                     strict=False)
     if 'nic_dev_id' in ip:
         nic_dev_id = ip['nic_dev_id']
     if 'vif_mac_address' in ip:

Reply via email to