You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2014/03/05 08:53:02 UTC

[17/20] git commit: updated refs/heads/4.3 to 3297fcc

CS-19377
[Baremetal] After deploy VM on Baremetal host, BM host fail to be PXE booted
(cherry picked from commit 793a6a7177e7b2737b01c328951c86da1ba1808b)

Signed-off-by: Animesh Chaturvedi <an...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9e1525c0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e1525c0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e1525c0

Branch: refs/heads/4.3
Commit: 9e1525c0321d61357fa2c51d45cf8ee78ded5dbf
Parents: e9a3d41
Author: frank <fr...@citrix.com>
Authored: Thu Feb 27 15:17:38 2014 -0800
Committer: Animesh Chaturvedi <an...@apache.org>
Committed: Tue Mar 4 23:42:37 2014 -0800

----------------------------------------------------------------------
 .../networkservice/BaremetalDhcpElement.java          | 14 +++++++++++---
 .../networkservice/BaremetalDhcpManagerImpl.java      |  7 +++----
 2 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e1525c0/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
index 8057cd4..b3fdab5 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
@@ -25,6 +25,8 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkVO;
 import org.apache.log4j.Logger;
 
 import com.cloud.baremetal.database.BaremetalDhcpVO;
@@ -64,12 +66,14 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     
     @Inject NicDao _nicDao;
     @Inject BaremetalDhcpManager _dhcpMgr;
+    @Inject
+    PhysicalNetworkDao phyNwDao;
     
     static {
         Capability cap = new Capability(BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_CAPABITLITY);
         Map<Capability, String> baremetalCaps = new HashMap<Capability, String>();
-        baremetalCaps.put(cap, null);
-        baremetalCaps.put(Capability.DhcpAccrossMultipleSubnets, Boolean.TRUE.toString());
+        baremetalCaps.put(cap, null);
+        baremetalCaps.put(Capability.DhcpAccrossMultipleSubnets, Boolean.TRUE.toString());
         capabilities = new HashMap<Service, Map<Capability, String>>();
         capabilities.put(Service.Dhcp, baremetalCaps);
     }
@@ -87,8 +91,12 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) {
         Pod pod = dest.getPod();
         if (pod != null && dest.getDataCenter().getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest) {
+            QueryBuilder<PhysicalNetworkVO> phyq = QueryBuilder.create(PhysicalNetworkVO.class);
+            phyq.and(phyq.entity().getDataCenterId(), Op.EQ, dest.getDataCenter().getId());
+            PhysicalNetworkVO phynw = phyq.find();
+
             QueryBuilder<BaremetalDhcpVO> sc = QueryBuilder.create(BaremetalDhcpVO.class);
-            sc.and(sc.entity().getPodId(), Op.EQ,pod.getId());
+            sc.and(sc.entity().getPhysicalNetworkId(), Op.EQ, phynw.getId());
             return sc.find() != null;
         }
         

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e1525c0/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
index 82397f5..e507b4d 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -133,14 +133,13 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
     public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile,
             DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
         Long zoneId = profile.getVirtualMachine().getDataCenterId();
-        Long podId = profile.getVirtualMachine().getPodIdToDeployIn();
-        List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Type.BaremetalDhcp, null, podId, zoneId);
+        List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Type.BaremetalDhcp, null, null, zoneId);
         if (hosts.size() == 0) {
-            throw new CloudRuntimeException("No external Dhcp found in zone " + zoneId + " pod " + podId);
+            throw new CloudRuntimeException("No external Dhcp found in zone " + zoneId);
         }
 
         if (hosts.size() > 1) {
-            throw new CloudRuntimeException("Something wrong, more than 1 external Dhcp found in zone " + zoneId + " pod " + podId);
+            throw new CloudRuntimeException("Something wrong, more than 1 external Dhcp found in zone " + zoneId);
         }
 
         HostVO h = hosts.get(0);