cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frankzh...@apache.org
Subject git commit: updated refs/heads/master to b37e6c1
Date Thu, 22 Aug 2013 23:25:31 GMT
Updated Branches:
  refs/heads/master 0fdaef8e3 -> b37e6c14c


CloudStack CLOUDSTACK-1365
UI support for baremetal PXE server

CloudStack CLOUDSTACK-1364
UI support for baremetal DHCP server

Conflicts:

	plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
	plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java


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

Branch: refs/heads/master
Commit: b37e6c14c11e1e515a6bc9a85a78247b720cd63a
Parents: 0fdaef8
Author: frank <frank.zhang@citrix.com>
Authored: Thu Aug 22 16:30:49 2013 -0700
Committer: root <root@localhost.localdomain>
Committed: Thu Aug 22 16:35:23 2013 -0700

----------------------------------------------------------------------
 client/tomcatconf/commands.properties.in        |  4 +-
 .../com/cloud/upgrade/dao/Upgrade410to420.java  |  2 -
 .../BareMetalPingServiceImpl.java               | 30 +-----
 .../BaremetalDhcpManagerImpl.java               | 43 ++++-----
 .../BaremetalDhcpResourceBase.java              | 13 ---
 .../networkservice/BaremetalDhcpResponse.java   | 11 +++
 .../BaremetalDnsmasqResource.java               |  4 +-
 .../BaremetalKickStartServiceImpl.java          | 39 ++++----
 .../networkservice/BaremetalPxeManager.java     |  4 +-
 .../networkservice/BaremetalPxeManagerImpl.java |  9 +-
 .../networkservice/BaremetalPxeResponse.java    | 18 ++--
 .../networkservice/BaremetalPxeService.java     |  4 +-
 .../cloudstack/api/AddBaremetalDhcpCmd.java     | 13 +--
 .../cloudstack/api/AddBaremetalPxeCmd.java      |  7 +-
 .../cloudstack/api/ListBaremetalDhcpCmd.java    | 14 +--
 .../api/ListBaremetalPxePingServersCmd.java     | 97 --------------------
 .../api/ListBaremetalPxeServersCmd.java         | 79 ++++++++++++++++
 17 files changed, 171 insertions(+), 220 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 66782e0..d4e55f7 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -609,7 +609,7 @@ addBaremetalPxeKickStartServer=1
 addBaremetalPxePingServer=1
 addBaremetalDhcp=1
 listBaremetalDhcp=1
-listBaremetalPxePingServer=1
+listBaremetalPxeServers=1
 
 #### UCS commands
 addUcsManager=1
@@ -617,7 +617,7 @@ listUcsManagers=1
 listUcsProfiles=1
 listUcsBlades=1
 associateUcsProfileToBlade=1
-deleteUcsManager=1
+removedeleteUcsManager=1
 
 #### New Load Balancer commands
 createLoadBalancer=15

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
old mode 100644
new mode 100755
index a4eaa4b..88a1769
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -283,8 +283,6 @@ public class Upgrade410to420 implements DbUpgrade {
             pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`baremetal_dhcp_devices` ADD
CONSTRAINT `fk_external_dhcp_devices_host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`)
ON DELETE CASCADE");
             pstmt.executeUpdate();
             pstmt.close();
-            pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`baremetal_dhcp_devices` ADD
CONSTRAINT `fk_external_dhcp_devices_pod_id` FOREIGN KEY (`pod_id`) REFERENCES `host_pod_ref`(`id`)
ON DELETE CASCADE");
-            pstmt.executeUpdate();
             pstmt.close();
             pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`baremetal_dhcp_devices` ADD
CONSTRAINT `fk_external_dhcp_devices_physical_network_id` FOREIGN KEY (`physical_network_id`)
REFERENCES `physical_network`(`id`) ON DELETE CASCADE");
             pstmt.executeUpdate();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
index 772898d..5cb5a14 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
@@ -35,7 +35,8 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
-import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
+import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@@ -271,34 +272,13 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase
implements
 
     @Override
     public BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo) {
-        BaremetalPxePingResponse response = new BaremetalPxePingResponse();
-        response.setId(String.valueOf(vo.getId()));
-        response.setPhysicalNetworkId(String.valueOf(vo.getPhysicalNetworkId()));
-        response.setPodId(String.valueOf(vo.getPodId()));
-        Map<String, String> details = _hostDetailsDao.findDetails(vo.getHostId());
-        response.setPingStorageServerIp(details.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_IP));
-        response.setPingDir(details.get(BaremetalPxeService.PXE_PARAM_PING_ROOT_DIR));
-        response.setTftpDir(details.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR));
-        return response;
+        return null;
     }
 
 
     @Override
-    public List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd
cmd) {
-        SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
-        sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.PING.toString());
-        if (cmd.getPodId() != null) {
-            sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cmd.getPodId());
-            if (cmd.getId() != null) {
-                sc.addAnd(sc.getEntity().getId(), Op.EQ, cmd.getId());
-            }
-        }
-        List<BaremetalPxeVO> vos = sc.list();
-        List<BaremetalPxeResponse> responses = new ArrayList<BaremetalPxeResponse>(vos.size());
-        for (BaremetalPxeVO vo : vos) {
-            responses.add(getApiResponse(vo));
-        }
-        return responses;
+    public List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxeServersCmd cmd)
{
+        return null;
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/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 1e2ad54..775673a 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -223,14 +223,9 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements
BaremetalDh
                     + " is in shutdown state in the physical network: " + cmd.getPhysicalNetworkId()
+ "to add this device");
         }
 
-        HostPodVO pod = _podDao.findById(cmd.getPodId());
-        if (pod == null) {
-            throw new IllegalArgumentException("Could not find pod with ID: " + cmd.getPodId());
-        }
-
-        List<HostVO> dhcps = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalDhcp,
null, cmd.getPodId(), zoneId);
+        List<HostVO> dhcps = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalDhcp,
null, null, zoneId);
         if (dhcps.size() != 0) {
-            throw new IllegalArgumentException("Already had a DHCP server in Pod: " + cmd.getPodId()
+ " zone: " + zoneId);
+            throw new IllegalArgumentException("Already had a DHCP server in zone: " + zoneId);
         }
 
         URI uri;
@@ -242,16 +237,17 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements
BaremetalDh
         }
 
         String ipAddress = uri.getHost();
-        String guid = getDhcpServerGuid(Long.toString(zoneId) + "-" + Long.toString(cmd.getPodId()),
"ExternalDhcp", ipAddress);
+        if (ipAddress == null) {
+            ipAddress = cmd.getUrl(); // the url is raw ip. For backforward compatibility,
we have to support http://ip format as well
+        }
+        String guid = getDhcpServerGuid(Long.toString(zoneId), "ExternalDhcp", ipAddress);
         Map params = new HashMap<String, String>();
         params.put("type", cmd.getDhcpType());
         params.put("zone", Long.toString(zoneId));
-        params.put("pod", cmd.getPodId().toString());
         params.put("ip", ipAddress);
         params.put("username", cmd.getUsername());
         params.put("password", cmd.getPassword());
         params.put("guid", guid);
-        params.put("gateway", pod.getGateway());
         String dns = zone.getDns1();
         if (dns == null) {
             dns = zone.getDns2();
@@ -284,7 +280,6 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
         vo.setHostId(dhcpServer.getId());
         vo.setNetworkServiceProviderId(ntwkSvcProvider.getId());
         vo.setPhysicalNetworkId(cmd.getPhysicalNetworkId());
-        vo.setPodId(cmd.getPodId());
         Transaction txn = Transaction.currentTxn();
         txn.start();
         _extDhcpDao.persist(vo);
@@ -296,26 +291,32 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements
BaremetalDh
     public BaremetalDhcpResponse generateApiResponse(BaremetalDhcpVO vo) {
         BaremetalDhcpResponse response = new BaremetalDhcpResponse();
         response.setDeviceType(vo.getDeviceType());
-        response.setId(String.valueOf(vo.getId()));
-        response.setPhysicalNetworkId(String.valueOf(vo.getPhysicalNetworkId()));
-        response.setProviderId(String.valueOf(vo.getNetworkServiceProviderId()));
+        response.setId(vo.getUuid());
+        HostVO host = _hostDao.findById(vo.getHostId());
+        response.setUrl(host.getPrivateIpAddress());
+        PhysicalNetworkVO nwVO = _physicalNetworkDao.findById(vo.getPhysicalNetworkId());
+        response.setPhysicalNetworkId(nwVO.getUuid());
+        PhysicalNetworkServiceProviderVO providerVO = _physicalNetworkServiceProviderDao.findById(vo.getNetworkServiceProviderId());
+        response.setProviderId(providerVO.getUuid());
+        response.setObjectName("baremetaldhcp");
         return response;
     }
 
     @Override
     public List<BaremetalDhcpResponse> listBaremetalDhcps(ListBaremetalDhcpCmd cmd)
{
+        List<BaremetalDhcpResponse> responses = new ArrayList<BaremetalDhcpResponse>();
+        if (cmd.getId() != null) {
+            BaremetalDhcpVO vo = _extDhcpDao.findById(cmd.getId());
+            responses.add(generateApiResponse(vo));
+            return responses;
+        }
+
         SearchCriteriaService<BaremetalDhcpVO, BaremetalDhcpVO> sc = SearchCriteria2.create(BaremetalDhcpVO.class);
         if (cmd.getDeviceType() != null) {
         	sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, cmd.getDeviceType());
         }
-        if (cmd.getPodId() != null) {
-            sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cmd.getPodId());
-            if (cmd.getId() != null) {
-                sc.addAnd(sc.getEntity().getId(), Op.EQ, cmd.getId());
-            }
-        }
+
         List<BaremetalDhcpVO> vos = sc.list();
-        List<BaremetalDhcpResponse> responses = new ArrayList<BaremetalDhcpResponse>(vos.size());
         for (BaremetalDhcpVO vo : vos) {
             responses.add(generateApiResponse(vo));
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
old mode 100644
new mode 100755
index 4496d5d..2a17a43
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
@@ -55,8 +55,6 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements ServerReso
 	String _password;
 	String _ip;
 	String _zoneId;
-	String _podId;
-	String _gateway;
 	String _dns;
 	
 	@Override
@@ -67,8 +65,6 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements ServerReso
 		_username = (String)params.get("username");
 		_password = (String)params.get("password");
 		_zoneId = (String)params.get("zone");
-		_podId = (String)params.get("pod");
-		_gateway = (String)params.get("gateway");
 		_dns = (String)params.get("dns");
 		
 		if (_guid == null) {
@@ -79,10 +75,6 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements ServerReso
 			throw new ConfigurationException("No Zone specified");
 		}
 		
-		if (_podId == null) {
-			throw new ConfigurationException("No Pod specified");
-		}
-		
 		if (_ip == null) {
 			throw new ConfigurationException("No IP specified");
 		}
@@ -95,10 +87,6 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements ServerReso
 			throw new ConfigurationException("No password specified");
 		}
 		
-		if (_gateway == null) {
-			throw new ConfigurationException("No gateway specified");
-		}
-		
 		if (_dns == null) {
 			throw new ConfigurationException("No dns specified");
 		}
@@ -131,7 +119,6 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements
ServerReso
 		StartupExternalDhcpCommand cmd = new StartupExternalDhcpCommand();
 		cmd.setName(_name);
 		cmd.setDataCenter(_zoneId);
-		cmd.setPod(_podId);
 		cmd.setPrivateIpAddress(_ip);
 		cmd.setStorageIpAddress("");
 		cmd.setVersion("");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java
index 1875d39..8250647 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java
@@ -41,6 +41,9 @@ public class BaremetalDhcpResponse extends BaseResponse {
     @SerializedName(ApiConstants.DHCP_SERVER_TYPE) @Param(description="name of the provider")
     private String deviceType;
 
+    @SerializedName(ApiConstants.URL) @Param(description="url")
+    private String url;
+
     public String getId() {
 		return id;
 	}
@@ -72,4 +75,12 @@ public class BaremetalDhcpResponse extends BaseResponse {
     public void setDeviceType(String deviceType) {
         this.deviceType = deviceType;
     }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
old mode 100644
new mode 100755
index 6841c525..d0fb2b4
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
@@ -73,11 +73,13 @@ public class BaremetalDnsmasqResource extends BaremetalDhcpResourceBase
{
 				throw new ConfigurationException("Can not find script prepare_dnsmasq.sh at " + prepareDnsmasq);
 			}
 			scp.put(prepareDnsmasqPath, "/usr/bin/", "0755");
-			
+
+            /*
 			String prepareCmd = String.format("sh /usr/bin/prepare_dnsmasq.sh %1$s %2$s %3$s", _gateway,
_dns, _ip);
 			if (!SSHCmdHelper.sshExecuteCmd(sshConnection, prepareCmd)) {
 				throw new ConfigurationException("prepare dnsmasq at " + _ip + " failed");
 			}
+			*/
 			
 			s_logger.debug("Dnsmasq resource configure successfully");
 			return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
index 9a6c1c6..80a72fb 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
@@ -31,7 +31,8 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
-import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
+import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@@ -199,6 +200,9 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase
imple
             throw new IllegalArgumentException(e.getMessage());
         }
         String ipAddress = uri.getHost();
+        if (ipAddress == null) {
+            ipAddress = cmd.getUrl();
+        }
 
         String guid = getPxeServerGuid(Long.toString(zoneId), BaremetalPxeType.KICK_START.toString(),
ipAddress);
 
@@ -236,27 +240,28 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase
imple
 
     @Override
     public BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo) {
-        BaremetalPxeKickStartResponse response = new BaremetalPxeKickStartResponse();
-        response.setId(String.valueOf(vo.getId()));
-        response.setPhysicalNetworkId(String.valueOf(vo.getPhysicalNetworkId()));
-        response.setPodId(String.valueOf(vo.getPodId()));
-        Map<String, String> details = _hostDetailsDao.findDetails(vo.getHostId());
-        response.setTftpDir(details.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR));
+        BaremetalPxeResponse response = new BaremetalPxeResponse();
+        response.setId(vo.getUuid());
+        HostVO host = _hostDao.findById(vo.getHostId());
+        response.setUrl(host.getPrivateIpAddress());
+        PhysicalNetworkServiceProviderVO providerVO = _physicalNetworkServiceProviderDao.findById(vo.getNetworkServiceProviderId());
+        response.setPhysicalNetworkId(providerVO.getUuid());
+        PhysicalNetworkVO nwVO = _physicalNetworkDao.findById(vo.getPhysicalNetworkId());
+        response.setPhysicalNetworkId(nwVO.getUuid());
+        response.setObjectName("baremetalpxeserver");
         return response;
     }
 
     @Override
-    public List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd
cmd) {
-        SearchCriteriaService<BaremetalPxeVO, BaremetalPxeVO> sc = SearchCriteria2.create(BaremetalPxeVO.class);
-        sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.KICK_START.toString());
-        if (cmd.getPodId() != null) {
-            sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cmd.getPodId());
-            if (cmd.getId() != null) {
-                sc.addAnd(sc.getEntity().getId(), Op.EQ, cmd.getId());
-            }
+    public List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxeServersCmd cmd)
{
+        List<BaremetalPxeResponse> responses = new ArrayList<BaremetalPxeResponse>();
+        if (cmd.getId() != null) {
+            BaremetalPxeVO vo = _pxeDao.findById(cmd.getId());
+            responses.add(getApiResponse(vo));
+            return responses;
         }
-        List<BaremetalPxeVO> vos = sc.list();
-        List<BaremetalPxeResponse> responses = new ArrayList<BaremetalPxeResponse>(vos.size());
+
+        List<BaremetalPxeVO> vos = _pxeDao.listAll();
         for (BaremetalPxeVO vo : vos) {
             responses.add(getApiResponse(vo));
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
index 73243b5..d3991a1 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java
@@ -25,7 +25,7 @@ package com.cloud.baremetal.networkservice;
 import java.util.List;
 
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
-import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
+import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
 
 import com.cloud.baremetal.database.BaremetalPxeVO;
 import com.cloud.deploy.DeployDestination;
@@ -55,7 +55,7 @@ public interface BaremetalPxeManager extends Manager, PluggableService {
 	
 	BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo);
 	
-	List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd cmd);
+	List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxeServersCmd cmd);
 	
     boolean addUserData(NicProfile nic, VirtualMachineProfile vm);
 		

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
index 606ec59..4ce4934 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
@@ -36,8 +36,9 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
-import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -179,8 +180,8 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
     }
 
     @Override
-    public List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd
cmd) {
-        return getServiceByType(BaremetalPxeManager.BaremetalPxeType.PING.toString()).listPxeServers(cmd);
+    public List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxeServersCmd cmd)
{
+        return getServiceByType(BaremetalPxeType.KICK_START.toString()).listPxeServers(cmd);
     }
 
     @Override
@@ -247,7 +248,7 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
 	    List<Class<?>> cmds = new ArrayList<Class<?>>();
 	    cmds.add(AddBaremetalKickStartPxeCmd.class);
 	    cmds.add(AddBaremetalPxePingServerCmd.class);
-	    cmds.add(ListBaremetalPxePingServersCmd.class);
+	    cmds.add(ListBaremetalPxeServersCmd.class);
 		return cmds;
 	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java
index 2103020..ef4fd57 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java
@@ -33,9 +33,9 @@ public class BaremetalPxeResponse extends BaseResponse {
     
     @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider")
     private String providerId;
-    
-    @SerializedName(ApiConstants.POD_ID) @Param(description="pod id where the device is in")
-    private String podId;
+
+    @SerializedName(ApiConstants.URL) @Param(description="url")
+    private String url;
 
 	public String getId() {
 		return id;
@@ -61,11 +61,11 @@ public class BaremetalPxeResponse extends BaseResponse {
 		this.providerId = providerId;
 	}
 
-	public String getPodId() {
-		return podId;
-	}
+    public String getUrl() {
+        return url;
+    }
 
-	public void setPodId(String podId) {
-		this.podId = podId;
-	}
+    public void setUrl(String url) {
+        this.url = url;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
index d74e31d..3975dab 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java
@@ -25,7 +25,7 @@ package com.cloud.baremetal.networkservice;
 import java.util.List;
 
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
-import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
+import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
 
 import com.cloud.baremetal.database.BaremetalPxeVO;
 import com.cloud.deploy.DeployDestination;
@@ -45,7 +45,7 @@ public interface BaremetalPxeService extends Adapter {
 	
     BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo);
 	
-	List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxePingServersCmd cmd);
+	List<BaremetalPxeResponse> listPxeServers(ListBaremetalPxeServersCmd cmd);
 	
 	String getPxeServiceType();
 	

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java
b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java
index 04c9137..33d39c0 100755
--- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java
+++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalDhcpCmd.java
@@ -45,7 +45,7 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 @APICommand(name="addBaremetalDhcp", description="adds a baremetal dhcp server", responseObject
= BaremetalDhcpResponse.class)
 public class AddBaremetalDhcpCmd extends BaseAsyncCmd {
-    private static final String s_name = "addexternaldhcpresponse";
+    private static final String s_name = "addbaremetaldhcpresponse";
     public static final Logger s_logger = Logger.getLogger(AddBaremetalDhcpCmd.class);
     
     @Inject BaremetalDhcpManager mgr;
@@ -56,9 +56,6 @@ public class AddBaremetalDhcpCmd extends BaseAsyncCmd {
     @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType=PhysicalNetworkResponse.class,
required=true, description="the Physical Network ID")
     private Long physicalNetworkId;
     
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
required = true, description="Pod Id")
-    private Long podId;
-    
     @Parameter(name=ApiConstants.DHCP_SERVER_TYPE, type=CommandType.STRING, required = true,
description="Type of dhcp device")
     private String dhcpType;
     
@@ -106,14 +103,6 @@ public class AddBaremetalDhcpCmd extends BaseAsyncCmd {
         return CallContext.current().getCallingAccount().getId();
     }
 
-    public Long getPodId() {
-        return podId;
-    }
-
-    public void setPodId(Long podId) {
-        this.podId = podId;
-    }
-
     public String getDhcpType() {
         return dhcpType;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxeCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxeCmd.java
b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxeCmd.java
index 49effca..4872691 100755
--- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxeCmd.java
+++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/AddBaremetalPxeCmd.java
@@ -20,6 +20,7 @@ package org.apache.cloudstack.api;
 
 import javax.inject.Inject;
 
+import com.cloud.baremetal.networkservice.BaremetalPxeResponse;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -43,7 +44,7 @@ import com.cloud.exception.NetworkRuleConflictException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 public class AddBaremetalPxeCmd extends BaseAsyncCmd {
-    private static final String s_name = "addexternalpxeresponse";
+    private static final String s_name = "addbaremetalpxeresponse";
     public static final Logger s_logger = Logger.getLogger(AddBaremetalPxeCmd.class);
     
     @Inject BaremetalPxeManager pxeMgr;
@@ -83,6 +84,10 @@ public class AddBaremetalPxeCmd extends BaseAsyncCmd {
             ResourceAllocationException, NetworkRuleConflictException {
         try {
             BaremetalPxeVO vo = pxeMgr.addPxeServer(this);
+            BaremetalPxeResponse rsp = pxeMgr.getApiResponse(vo);
+            rsp.setObjectName(s_name);
+            rsp.setResponseName(getCommandName());
+            this.setResponseObject(rsp);
         } catch (Exception e) {
             s_logger.warn("Unable to add external pxe server with url: " + getUrl(), e);
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java
b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java
index a147ca2..412a3d4 100755
--- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java
+++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalDhcpCmd.java
@@ -43,7 +43,7 @@ import com.cloud.exception.ResourceUnavailableException;
 @APICommand(name="listBaremetalDhcp", description="list baremetal dhcp servers", responseObject
= BaremetalDhcpResponse.class)
 public class ListBaremetalDhcpCmd extends BaseListCmd {
     private static final Logger s_logger = Logger.getLogger(ListBaremetalDhcpCmd.class);
-    private static final String s_name = "listexternaldhcpresponse";
+    private static final String s_name = "listbaremetaldhcpresponse";
     @Inject BaremetalDhcpManager _dhcpMgr;
     
     // ///////////////////////////////////////////////////
@@ -52,9 +52,6 @@ public class ListBaremetalDhcpCmd extends BaseListCmd {
     @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "DHCP server
device ID")
     private Long id;
     
-    @Parameter(name = ApiConstants.POD_ID, type = CommandType.LONG, description = "Pod ID
where pxe server is in")
-    private Long podId;
-    
     @Parameter(name = ApiConstants.DHCP_SERVER_TYPE, type = CommandType.STRING, description
= "Type of DHCP device")
     private String deviceType;
     
@@ -66,14 +63,6 @@ public class ListBaremetalDhcpCmd extends BaseListCmd {
         this.id = id;
     }
 
-    public Long getPodId() {
-        return podId;
-    }
-
-    public void setPodId(Long podId) {
-        this.podId = podId;
-    }
-    
     public String getDeviceType() {
         return deviceType;
     }
@@ -90,6 +79,7 @@ public class ListBaremetalDhcpCmd extends BaseListCmd {
             List<BaremetalDhcpResponse> dhcpResponses = _dhcpMgr.listBaremetalDhcps(this);
             response.setResponses(dhcpResponses);
             response.setResponseName(getCommandName());
+            response.setObjectName("baremetaldhcps");
             this.setResponseObject(response);
     	} catch (Exception e) {
     		s_logger.debug("Exception happend while executing ListBaremetalDhcpCmd");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxePingServersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxePingServersCmd.java
b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxePingServersCmd.java
deleted file mode 100755
index 926ad1d..0000000
--- a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxePingServersCmd.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-// 
-//   http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-// 
-// Automatically generated by addcopyright.py at 01/29/2013
-package org.apache.cloudstack.api;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseCmd.CommandType;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.baremetal.networkservice.BaremetalPxeManager;
-import com.cloud.baremetal.networkservice.BaremetalPxePingResponse;
-import com.cloud.baremetal.networkservice.BaremetalPxeResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-@APICommand(name="listBaremetalPxePingServer", description="list baremetal ping pxe server",
responseObject = BaremetalPxePingResponse.class)
-public class ListBaremetalPxePingServersCmd extends BaseListCmd {
-    private static final Logger s_logger = Logger.getLogger(ListBaremetalPxePingServersCmd.class);
-    private static final String s_name = "listpingpxeserverresponse";
-
-    @Inject
-    BaremetalPxeManager _pxeMgr;
-    // ///////////////////////////////////////////////////
-    // ////////////// API parameters /////////////////////
-    // ///////////////////////////////////////////////////
-
-    @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "Ping pxe server
device ID")
-    private Long id;
-    
-    @Parameter(name = ApiConstants.POD_ID, type = CommandType.LONG, description = "Pod ID
where pxe server is in")
-    private Long podId;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getPodId() {
-        return podId;
-    }
-
-    public void setPodId(Long podId) {
-        this.podId = podId;
-    }
-
-    @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException,
-            ResourceAllocationException, NetworkRuleConflictException {
-        try {
-            ListResponse<BaremetalPxeResponse> response = new ListResponse<BaremetalPxeResponse>();
-            List<BaremetalPxeResponse> pxeResponses = _pxeMgr.listPxeServers(this);
-            response.setResponses(pxeResponses);
-            response.setResponseName(getCommandName());
-            this.setResponseObject(response);
-        } catch (Exception e) {
-            s_logger.debug("Exception happend while executing ListPingPxeServersCmd" ,e);
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
-        }
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b37e6c14/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java
b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java
new file mode 100755
index 0000000..3463024
--- /dev/null
+++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalPxeServersCmd.java
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// 
+//   http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+// 
+// Automatically generated by addcopyright.py at 01/29/2013
+package org.apache.cloudstack.api;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.baremetal.networkservice.BaremetalPxeManager;
+import com.cloud.baremetal.networkservice.BaremetalPxePingResponse;
+import com.cloud.baremetal.networkservice.BaremetalPxeResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+@APICommand(name="listBaremetalPxeServers", description="list baremetal pxe server", responseObject
= BaremetalPxeResponse.class)
+public class ListBaremetalPxeServersCmd extends BaseListCmd {
+    private static final Logger s_logger = Logger.getLogger(ListBaremetalPxeServersCmd.class);
+    private static final String s_name = "listbaremetalpxeserversresponse";
+
+    @Inject
+    BaremetalPxeManager _pxeMgr;
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "Pxe server
device ID")
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException,
+            ResourceAllocationException, NetworkRuleConflictException {
+        try {
+            ListResponse<BaremetalPxeResponse> response = new ListResponse<BaremetalPxeResponse>();
+            List<BaremetalPxeResponse> pxeResponses = _pxeMgr.listPxeServers(this);
+            response.setResponses(pxeResponses);
+            response.setResponseName(getCommandName());
+            response.setObjectName("baremetalpxeservers");
+            this.setResponseObject(response);
+        } catch (Exception e) {
+            s_logger.debug("Exception happened while executing ListPingPxeServersCmd" ,e);
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+}


Mime
View raw message