diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 9b12f467c82..8d330d45948 100755 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -251,4 +251,7 @@ restartNetwork=com.cloud.api.commands.RestartNetworkCmd;15 registerSSHKeyPair=com.cloud.api.commands.RegisterSSHKeyPairCmd;15 createSSHKeyPair=com.cloud.api.commands.CreateSSHKeyPairCmd;15 deleteSSHKeyPair=com.cloud.api.commands.DeleteSSHKeyPairCmd;15 -listSSHKeyPairs=com.cloud.api.commands.ListSSHKeyPairsCmd;15 +listSSHKeyPairs=com.cloud.api.commands.ListSSHKeyPairsCmd;15 + +### PXE server commands +AddPxeServer=com.cloud.api.AddPxeServerCmd;1 diff --git a/scripts/util/ipmi.py b/scripts/util/ipmi.py index 9fc4674a155..fa819c61fd1 100644 --- a/scripts/util/ipmi.py +++ b/scripts/util/ipmi.py @@ -80,7 +80,44 @@ def ping(args): else: return 0 -call_table = {"ping":ping} +def boot_dev(args): + hostname = args.get("hostname") + usrname = args.get("usrname") + password = args.get("password") + dev = args.get("dev") + + if hostname == None: + print "No hostname" + return 1 + + if dev == None: + print "No boot device specified" + return 1 + + o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "bootdev", dev) + if o.ret: + print o.stderr + return 1 + else: + return 0 + +def reboot(args): + hostname = args.get("hostname") + usrname = args.get("usrname") + password = args.get("password") + + if hostname == None: + print "No hostname" + return 1 + + o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "reset") + if o.ret: + print o.stderr + return 1 + else: + return 0 + +call_table = {"ping":ping, "boot_dev":boot_dev, "reboot":reboot} def dispatch(args): cmd = args[1] params = args[2:] diff --git a/server/src/com/cloud/baremetal/LinMinPxeServerResource.java b/server/src/com/cloud/baremetal/LinMinPxeServerResource.java index 99b53bd5954..401ec2e04b4 100644 --- a/server/src/com/cloud/baremetal/LinMinPxeServerResource.java +++ b/server/src/com/cloud/baremetal/LinMinPxeServerResource.java @@ -8,6 +8,7 @@ import java.io.StringReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; +import java.util.HashMap; import java.util.Map; import javax.naming.ConfigurationException; @@ -25,6 +26,7 @@ import com.cloud.agent.IAgentControl; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.PingCommand; +import com.cloud.agent.api.PingRoutingCommand; import com.cloud.agent.api.ReadyAnswer; import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.StartupCommand; @@ -36,6 +38,7 @@ import com.cloud.host.Host.Type; import com.cloud.resource.ServerResource; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.ssh.SSHCmdHelper; +import com.cloud.vm.VirtualMachine.State; public class LinMinPxeServerResource implements ServerResource { private static final Logger s_logger = Logger.getLogger(LinMinPxeServerResource.class); @@ -164,8 +167,8 @@ public class LinMinPxeServerResource implements ServerResource { @Override public PingCommand getCurrentStatus(long id) { - // TODO Auto-generated method stub - return null; + //TODO: check server + return new PingRoutingCommand(getType(), id, new HashMap()); } protected ReadyAnswer execute(ReadyCommand cmd) { diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java index a11c9865479..c345a5aca28 100644 --- a/server/src/com/cloud/network/NetworkManager.java +++ b/server/src/com/cloud/network/NetworkManager.java @@ -42,6 +42,7 @@ import com.cloud.user.AccountVO; import com.cloud.utils.Pair; import com.cloud.vm.Nic; import com.cloud.vm.NicProfile; +import com.cloud.vm.NicVO; import com.cloud.vm.ReservationContext; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; diff --git a/server/src/com/cloud/vm/BareMetalVmManagerImpl.java b/server/src/com/cloud/vm/BareMetalVmManagerImpl.java index c438bad73ff..34521df33db 100644 --- a/server/src/com/cloud/vm/BareMetalVmManagerImpl.java +++ b/server/src/com/cloud/vm/BareMetalVmManagerImpl.java @@ -407,6 +407,8 @@ public class BareMetalVmManagerImpl extends UserVmManagerImpl implements BareMet throw new CloudRuntimeException("Pepare PXE server failed"); } + profile.addBootArgs("PxeBoot"); + return true; }