Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
VR merge.py ipalias fix & dhcpconfig stub notification
  • Loading branch information
Ronald van Zantvoort authored and wido committed Jun 7, 2016
commit ed820bebe57eb6315f162562503856a7141c6193
31 changes: 31 additions & 0 deletions systemvm/patches/debian/config/opt/cloud/bin/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ def process(self):
dbag = self.process_vpnusers(self.db.getDataBag())
elif self.qFile.type == 'staticroutes':
dbag = self.process_staticroutes(self.db.getDataBag())
elif self.qFile.type == 'ipaliases':
self.db.setKey('ips')
self.db.load()
dbag = self.process_ipaliases(self.db.getDataBag())
elif self.qFile.type == 'dhcpconfig':
logging.error("I don't think I need %s anymore", self.qFile.type)
return
else:
logging.error("Error I do not know what to do with file of type %s", self.qFile.type)
return
Expand Down Expand Up @@ -231,6 +238,30 @@ def processVmData(self, dbag):
cs_vmdata.merge(dbag, self.qFile.data)
return dbag

def process_ipaliases(self, dbag):
nic_dev = None
# Should be a way to deal with this better
for intf, data in dbag.items():
if intf == 'id':
continue
elif any([net['nw_type'] == 'guest' for net in data]):
nic_dev = intf
break

assert nic_dev is not None, 'Unable to determine Guest interface'

nic_dev_id = nic_dev[3:]

for alias in self.qFile.data['aliases']:
ip = {
'add': not alias['revoke'],
'nw_type': 'guest',
'public_ip': alias['ip_address'],
'netmask': alias['netmask'],
'nic_dev_id': nic_dev_id
}
dbag = cs_ip.merge(dbag, ip)
return dbag

class QueueFile:

Expand Down