From 287ebd350dde4791be552823ff8b7b82fbb76852 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Mon, 11 Jun 2012 15:58:26 -0700 Subject: [PATCH] More logging to plug nic code --- .../router/VirtualNetworkApplianceManagerImpl.java | 10 ++++++---- server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 2 ++ wscript | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 9f10bc23d6c..1b43c158e96 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1271,6 +1271,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian for (int i = 0; i < count; i++) { DomainRouterVO router = deployRouter(owner, dest, plan, params, isRedundant, vrProvider, offeringId, null, sourceNatIp); + //add router to router network map + if (!_routerDao.isRouterPartOfGuestNetwork(router.getId(), network.getId())) { + DomainRouterVO routerVO = _routerDao.findById(router.getId()); + _routerDao.addRouterToGuestNetwork(routerVO, network); + } routers.add(router); } } finally { @@ -3134,8 +3139,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian return addRouterToGuestNetwork(router, network, isRedundant, setupDns); } - - protected boolean addRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant, boolean setupDns) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { @@ -3147,9 +3150,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian //Add router to the Guest network boolean result = true; try { - if (_routerDao.isRouterPartOfGuestNetwork(router.getId(), network.getId())) { + if (!_routerDao.isRouterPartOfGuestNetwork(router.getId(), network.getId())) { DomainRouterVO routerVO = _routerDao.findById(router.getId()); - s_logger.debug("Plugging nic for virtual router " + router + " in network " + network); _routerDao.addRouterToGuestNetwork(routerVO, network); } diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index a30e112847d..50990e629ff 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -2484,6 +2484,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene //4) plug the nic to the vm VirtualMachineGuru vmGuru = getVmGuru(vmVO); + s_logger.debug("Plugging nic for vm " + vm + " in network " + network); if (vmGuru.plugNic(network, nicTO, vmTO, context, dest)) { s_logger.debug("Nic is plugged successfully for vm " + vm + " in network " + network + ". Vm is a part of network now"); return nic; @@ -2525,6 +2526,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene NicTO nicTO = toNicTO(nic, vmProfile.getVirtualMachine().getHypervisorType()); + s_logger.debug("Un-plugging nic for vm " + vm + " from network " + network); boolean result = vmGuru.unplugNic(network, nicTO, vmTO, context, dest); //4) Unplug the nic if (result) { diff --git a/wscript b/wscript index f42d95e8f24..98c6967b6ab 100644 --- a/wscript +++ b/wscript @@ -5,7 +5,7 @@ # if you change 'em here, you need to change it also in cloud.spec, add a %changelog entry there, and add an entry in debian/changelog -VERSION = '3.0.3.2012-06-11T21:51:13Z' +VERSION = '3.0.3.2012-06-11T22:43:41Z' APPNAME = 'cloud' import shutil,os