added type to startup commands to be used later

This commit is contained in:
Alex Huang 2011-01-26 10:15:21 -08:00
parent 4dd2e6df72
commit ea59085ae7
7 changed files with 36 additions and 13 deletions

View File

@ -61,7 +61,7 @@ public class DummyResource implements ServerResource {
@Override
public StartupCommand[] initialize() {
return new StartupCommand[] {new StartupCommand()};
return new StartupCommand[] {new StartupCommand(Host.Type.Storage)};
}
@Override

View File

@ -17,7 +17,10 @@
*/
package com.cloud.agent.api;
import com.cloud.host.Host;
public class StartupCommand extends Command {
Host.Type type;
String dataCenter;
String pod;
String cluster;
@ -41,10 +44,11 @@ public class StartupCommand extends Command {
String agentTag;
String resourceName;
public StartupCommand() {
public StartupCommand(Host.Type type) {
this.type = type;
}
public StartupCommand(Long id, String name, String dataCenter, String pod, String guid, String version) {
public StartupCommand(Long id, Host.Type type, String name, String dataCenter, String pod, String guid, String version) {
super();
this.id = id;
this.dataCenter = dataCenter;
@ -52,6 +56,11 @@ public class StartupCommand extends Command {
this.guid = guid;
this.name = name;
this.version = version;
this.type = type;
}
public Host.Type getHostType() {
return type;
}
public String getIqn() {
@ -232,9 +241,9 @@ public class StartupCommand extends Command {
}
public String getGuidWithoutResource() {
if (resourceName == null)
return guid;
else {
if (resourceName == null) {
return guid;
} else {
int hyph = guid.lastIndexOf('-');
if (hyph == -1) {
return guid;

View File

@ -1,5 +1,10 @@
package com.cloud.agent.api;
public class StartupExternalFirewallCommand extends StartupCommand {
import com.cloud.host.Host;
public class StartupExternalFirewallCommand extends StartupCommand {
public StartupExternalFirewallCommand() {
super(Host.Type.ExternalFirewall);
}
}

View File

@ -1,5 +1,10 @@
package com.cloud.agent.api;
import com.cloud.host.Host;
public class StartupExternalLoadBalancerCommand extends StartupCommand {
public StartupExternalLoadBalancerCommand() {
super(Host.Type.ExternalLoadBalancer);
}
}

View File

@ -17,12 +17,14 @@
*/
package com.cloud.agent.api;
import com.cloud.host.Host;
public class StartupProxyCommand extends StartupCommand {
private int proxyPort;
private long proxyVmId;
public StartupProxyCommand() {
super();
super(Host.Type.ConsoleProxy);
setIqn("NoIqn");
}

View File

@ -19,6 +19,7 @@ package com.cloud.agent.api;
import java.util.HashMap;
import java.util.Map;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Networks.RouterPrivateIpStrategy;
import com.cloud.vm.VirtualMachine.State;
@ -35,7 +36,7 @@ public class StartupRoutingCommand extends StartupCommand {
Map<String, String> hostDetails; //stuff like host os, cpu capabilities
public StartupRoutingCommand() {
super();
super(Host.Type.Routing);
hostDetails = new HashMap<String, String>();
getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), RouterPrivateIpStrategy.DcGlobal.toString());
@ -62,7 +63,7 @@ public class StartupRoutingCommand extends StartupCommand {
final Map<String, String> hostDetails,
Map<String, State> vms) {
super();
super(Host.Type.Routing);
this.cpus = cpus;
this.speed = speed;
this.memory = memory;

View File

@ -20,6 +20,7 @@ package com.cloud.agent.api;
import java.util.HashMap;
import java.util.Map;
import com.cloud.host.Host;
import com.cloud.storage.Storage;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.template.TemplateInfo;
@ -37,11 +38,11 @@ public class StartupStorageCommand extends StartupCommand {
String nfsShare;
public StartupStorageCommand() {
super();
super(Host.Type.Storage);
}
public StartupStorageCommand(String parent, StoragePoolType fsType, long totalSize, Map<String, TemplateInfo> info) {
super();
super(Host.Type.Storage);
this.parent = parent;
this.totalSize = totalSize;
this.templateInfo = info;
@ -51,7 +52,7 @@ public class StartupStorageCommand extends StartupCommand {
public StartupStorageCommand(String parent, StoragePoolType fsType, Map<String, TemplateInfo> templateInfo, StoragePoolInfo poolInfo) {
super();
super(Host.Type.Storage);
this.parent = parent;
this.templateInfo = templateInfo;
this.totalSize = poolInfo.capacityBytes;