use of com.cloud.agent.dhcp.DhcpSnooperImpl in project CloudStack-archive by CloudStack-extras.
the class CloudZonesComputingResource method setupDhcpManager.
private void setupDhcpManager(Connect conn, String bridgeName) {
_dhcpSnooper = new DhcpSnooperImpl(bridgeName, _dhcpTimeout);
List<Pair<String, String>> macs = new ArrayList<Pair<String, String>>();
try {
int[] domainIds = conn.listDomains();
for (int i = 0; i < domainIds.length; i++) {
Domain vm = conn.domainLookupByID(domainIds[i]);
if (vm.getName().startsWith("i-")) {
List<InterfaceDef> nics = getInterfaces(conn, vm.getName());
InterfaceDef nic = nics.get(0);
macs.add(new Pair<String, String>(nic.getMacAddress(), vm.getName()));
}
}
} catch (LibvirtException e) {
s_logger.debug("Failed to get MACs: " + e.toString());
}
_dhcpSnooper.initializeMacTable(macs);
}
Aggregations