mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.12'
This commit is contained in:
commit
4d9206aef5
@ -895,6 +895,7 @@ NetworkMigrationResponder, AggregatedCommandExecutor, RedundantResource, DnsServ
|
||||
@Override
|
||||
public boolean release(final Network network, final NicProfile nic, final VirtualMachineProfile vm, final ReservationContext context) throws ConcurrentOperationException,
|
||||
ResourceUnavailableException {
|
||||
removeDhcpEntry(network, nic, vm);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -922,11 +922,11 @@ class CsForwardingRules(CsDataBag):
|
||||
if device is None:
|
||||
raise Exception("Ip address %s has no device in the ips databag" % rule["public_ip"])
|
||||
|
||||
self.fw.append(["mangle", "",
|
||||
"-I PREROUTING -s %s/32 -m state --state NEW -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff" %
|
||||
self.fw.append(["mangle", "front",
|
||||
"-A PREROUTING -s %s/32 -m state --state NEW -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff" %
|
||||
rule["internal_ip"]])
|
||||
self.fw.append(["mangle", "",
|
||||
"-I PREROUTING -s %s/32 -m state --state NEW -j MARK --set-xmark %s/0xffffffff" %
|
||||
self.fw.append(["mangle", "front",
|
||||
"-A PREROUTING -s %s/32 -m state --state NEW -j MARK --set-xmark %s/0xffffffff" %
|
||||
(rule["internal_ip"], hex(100 + int(device[len("eth"):])))])
|
||||
self.fw.append(["nat", "front",
|
||||
"-A PREROUTING -d %s/32 -j DNAT --to-destination %s" % (rule["public_ip"], rule["internal_ip"])])
|
||||
|
||||
@ -118,7 +118,6 @@ class CsDhcp(CsDataBag):
|
||||
|
||||
def delete_leases(self):
|
||||
macs_dhcphosts = []
|
||||
interfaces = filter(lambda x: x.startswith('eth'), os.listdir('/sys/class/net'))
|
||||
try:
|
||||
logging.info("Attempting to delete entries from dnsmasq.leases file for VMs which are not on dhcphosts file")
|
||||
for host in open(DHCP_HOSTS):
|
||||
@ -130,10 +129,9 @@ class CsDhcp(CsDataBag):
|
||||
mac = lease[1]
|
||||
ip = lease[2]
|
||||
if mac not in macs_dhcphosts:
|
||||
for interface in interfaces:
|
||||
cmd = "dhcp_release %s %s %s" % (interface, ip, mac)
|
||||
logging.info(cmd)
|
||||
CsHelper.execute(cmd)
|
||||
cmd = "dhcp_release $(ip route get %s | grep eth | head -1 | awk '{print $3}') %s %s" % (ip, ip, mac)
|
||||
logging.info(cmd)
|
||||
CsHelper.execute(cmd)
|
||||
removed = removed + 1
|
||||
self.del_host(ip)
|
||||
logging.info("Deleted %s entries from dnsmasq.leases file" % str(removed))
|
||||
|
||||
@ -27,11 +27,6 @@ def merge(dbag, data):
|
||||
del(dbag[data['ipv4_address']])
|
||||
else:
|
||||
remove_keys = set()
|
||||
for key, entry in dbag.iteritems():
|
||||
if key != 'id' and entry['host_name'] == data['host_name']:
|
||||
remove_keys.add(key)
|
||||
break
|
||||
|
||||
for key, entry in dbag.iteritems():
|
||||
if key != 'id' and entry['mac_address'] == data['mac_address']:
|
||||
remove_keys.add(key)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user