if (!(firstCmd instanceof StartupStorageCommand)) {
return null;
}
com.cloud.host.Host.Type type = null;
StartupStorageCommand ssCmd = ((StartupStorageCommand) firstCmd);
if (ssCmd.getHostType() == Host.Type.SecondaryStorageCmdExecutor) {
type = ssCmd.getHostType();
} else {
if (ssCmd.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE) {
type = Host.Type.SecondaryStorage;
if (resource != null && resource instanceof DummySecondaryStorageResource) {
host.setResource(null);
}
} else if (ssCmd.getResourceType() == Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE) {
type = Host.Type.LocalSecondaryStorage;
} else {
type = Host.Type.Storage;
}
final Map<String, String> hostDetails = ssCmd.getHostDetails();
if (hostDetails != null) {
if (details != null) {
details.putAll(hostDetails);
} else {
details = hostDetails;
}
}
host.setDetails(details);
host.setParent(ssCmd.getParent());
host.setTotalSize(ssCmd.getTotalSize());
host.setHypervisorType(HypervisorType.None);
host.setType(type);
if (ssCmd.getNfsShare() != null) {
host.setStorageUrl(ssCmd.getNfsShare());
}
}
return host;
}