|
| 1 | +package com.cloud.hypervisor.kvm.resource; |
| 2 | + |
| 3 | +import java.util.HashMap; |
| 4 | +import java.util.Map; |
| 5 | + |
| 6 | +import javax.naming.ConfigurationException; |
| 7 | + |
| 8 | +import com.cloud.agent.api.Answer; |
| 9 | +import com.cloud.agent.api.Command; |
| 10 | +import com.cloud.agent.api.PingCommand; |
| 11 | +import com.cloud.agent.api.StartupCommand; |
| 12 | +import com.cloud.agent.api.StartupRoutingCommand; |
| 13 | +import com.cloud.host.Host.Type; |
| 14 | +import com.cloud.hypervisor.Hypervisor; |
| 15 | +import com.cloud.hypervisor.xen.resource.CitrixResourceBase; |
| 16 | +import com.cloud.resource.ServerResource; |
| 17 | +import com.cloud.resource.ServerResourceBase; |
| 18 | +import com.cloud.vm.State; |
| 19 | + |
| 20 | +public class KvmDummyResourceBase extends ServerResourceBase implements ServerResource { |
| 21 | + private String _zoneId; |
| 22 | + private String _podId; |
| 23 | + private String _guid; |
| 24 | + private String _agentIp; |
| 25 | + @Override |
| 26 | + public Type getType() { |
| 27 | + // TODO Auto-generated method stub |
| 28 | + return null; |
| 29 | + } |
| 30 | + |
| 31 | + @Override |
| 32 | + public StartupCommand[] initialize() { |
| 33 | + StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.Type.KVM, new HashMap<String, String>(), new HashMap<String, State>()); |
| 34 | + cmd.setDataCenter(_zoneId); |
| 35 | + cmd.setPod(_podId); |
| 36 | + cmd.setGuid(_guid); |
| 37 | + cmd.setName(_agentIp); |
| 38 | + cmd.setPrivateIpAddress(_agentIp); |
| 39 | + cmd.setStorageIpAddress(_agentIp); |
| 40 | + cmd.setVersion(KvmDummyResourceBase.class.getPackage().getImplementationVersion()); |
| 41 | + return new StartupCommand[] { cmd }; |
| 42 | + } |
| 43 | + |
| 44 | + @Override |
| 45 | + public PingCommand getCurrentStatus(long id) { |
| 46 | + // TODO Auto-generated method stub |
| 47 | + return null; |
| 48 | + } |
| 49 | + |
| 50 | + @Override |
| 51 | + public Answer executeRequest(Command cmd) { |
| 52 | + // TODO Auto-generated method stub |
| 53 | + return null; |
| 54 | + } |
| 55 | + |
| 56 | + @Override |
| 57 | + protected String getDefaultScriptsDir() { |
| 58 | + // TODO Auto-generated method stub |
| 59 | + return null; |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { |
| 64 | + _zoneId = (String)params.get("zone"); |
| 65 | + _podId = (String)params.get("pod"); |
| 66 | + _guid = (String)params.get("guid"); |
| 67 | + _agentIp = (String)params.get("agentIp"); |
| 68 | + return true; |
| 69 | + } |
| 70 | +} |
0 commit comments