From 57def20cf68458b20aaf5179f7b2bb587e4bd786 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Thu, 20 Jan 2011 09:52:32 -0800 Subject: [PATCH] moved all agent commands to api. --- .../computing/LibvirtComputingResource.java | 12 +- .../cloud/agent/api/AgentControlAnswer.java | 0 .../cloud/agent/api/AgentControlCommand.java | 0 .../com/cloud/agent/api/AttachIsoCommand.java | 0 .../cloud/agent/api/AttachVolumeAnswer.java | 0 .../cloud/agent/api/AttachVolumeCommand.java | 0 .../cloud/agent/api/BackupSnapshotAnswer.java | 0 .../agent/api/BackupSnapshotCommand.java | 0 .../com/cloud/agent/api/CancelCommand.java | 0 .../cloud/agent/api/ChangeAgentAnswer.java | 0 .../cloud/agent/api/ChangeAgentCommand.java | 0 .../cloud/agent/api/CheckHealthAnswer.java | 0 .../cloud/agent/api/CheckHealthCommand.java | 0 .../cloud/agent/api/CheckOnHostAnswer.java | 0 .../cloud/agent/api/CheckOnHostCommand.java | 4 +- .../com/cloud/agent/api/CheckStateAnswer.java | 0 .../cloud/agent/api/CheckStateCommand.java | 0 .../agent/api/CheckVirtualMachineAnswer.java | 0 .../agent/api/CheckVirtualMachineCommand.java | 0 .../agent/api/CleanupNetworkRulesCmd.java | 0 .../ConsoleAccessAuthenticationAnswer.java | 0 .../ConsoleAccessAuthenticationCommand.java | 0 .../api/ConsoleProxyLoadReportCommand.java | 0 ...atePrivateTemplateFromSnapshotCommand.java | 0 ...reatePrivateTemplateFromVolumeCommand.java | 0 .../api/CreateVolumeFromSnapshotAnswer.java | 0 .../api/CreateVolumeFromSnapshotCommand.java | 0 .../src/com/cloud/agent/api/CronCommand.java | 0 .../agent/api/DeleteSnapshotBackupAnswer.java | 0 .../api/DeleteSnapshotBackupCommand.java | 0 .../agent/api/DeleteSnapshotsDirCommand.java | 0 .../agent/api/DeleteStoragePoolCommand.java | 20 +-- .../src/com/cloud/agent/api/FenceAnswer.java | 0 .../src/com/cloud/agent/api/FenceCommand.java | 6 +- .../cloud/agent/api/GetFileStatsAnswer.java | 0 .../cloud/agent/api/GetFileStatsCommand.java | 0 .../cloud/agent/api/GetHostStatsAnswer.java | 0 .../cloud/agent/api/GetHostStatsCommand.java | 0 .../agent/api/GetStorageStatsAnswer.java | 0 .../agent/api/GetStorageStatsCommand.java | 0 .../com/cloud/agent/api/GetVmStatsAnswer.java | 0 .../cloud/agent/api/GetVmStatsCommand.java | 0 .../com/cloud/agent/api/GetVncPortAnswer.java | 0 .../cloud/agent/api/GetVncPortCommand.java | 0 .../com/cloud/agent/api/HostStatsEntry.java | 0 .../com/cloud/agent/api/MaintainAnswer.java | 0 .../com/cloud/agent/api/MaintainCommand.java | 0 .../cloud/agent/api/ManageSnapshotAnswer.java | 0 .../agent/api/ManageSnapshotCommand.java | 0 .../com/cloud/agent/api/MigrateAnswer.java | 0 .../com/cloud/agent/api/MigrateCommand.java | 0 .../cloud/agent/api/ModifySshKeysCommand.java | 0 .../cloud/agent/api/NetworkUsageAnswer.java | 0 .../cloud/agent/api/NetworkUsageCommand.java | 0 .../src/com/cloud/agent/api/PingAnswer.java | 0 .../src/com/cloud/agent/api/PingCommand.java | 0 .../cloud/agent/api/PingRoutingCommand.java | 0 .../api/PingRoutingWithNwGroupsCommand.java | 48 +++++++ .../agent/api/PingRoutingWithOvsCommand.java | 0 .../cloud/agent/api/PingStorageCommand.java | 0 .../com/cloud/agent/api/PingTestCommand.java | 0 .../com/cloud/agent/api/PoolEjectCommand.java | 0 .../agent/api/PrepareForMigrationAnswer.java | 0 .../agent/api/PrepareForMigrationCommand.java | 7 -- .../src/com/cloud/agent/api/ReadyAnswer.java | 0 .../src/com/cloud/agent/api/ReadyCommand.java | 0 .../src/com/cloud/agent/api/RebootAnswer.java | 0 .../com/cloud/agent/api/RebootCommand.java | 0 .../cloud/agent/api/RebootRouterCommand.java | 0 .../api/SecStorageFirewallCfgCommand.java | 57 --------- .../agent/api/SecStorageSetupCommand.java | 0 .../agent/api/SecurityIngressRuleAnswer.java | 0 .../agent/api/SecurityIngressRulesCmd.java | 0 .../src/com/cloud/agent/api/SetupAnswer.java | 0 .../src/com/cloud/agent/api/SetupCommand.java | 0 .../com/cloud/agent/api/ShutdownCommand.java | 0 .../com/cloud/agent/api/SnapshotCommand.java | 0 .../src/com/cloud/agent/api/StartAnswer.java | 0 .../com/cloud/agent/api/StartupAnswer.java | 0 .../com/cloud/agent/api/StartupCommand.java | 0 .../api/StartupExternalFirewallCommand.java | 0 .../StartupExternalLoadBalancerCommand.java | 0 .../cloud/agent/api/StartupProxyCommand.java | 0 .../agent/api/StartupRoutingCommand.java | 2 +- .../agent/api/StartupStorageCommand.java | 0 .../src/com/cloud/agent/api/StopAnswer.java | 0 .../src/com/cloud/agent/api/StopCommand.java | 0 .../com/cloud/agent/api/UpgradeAnswer.java | 0 .../com/cloud/agent/api/UpgradeCommand.java | 0 .../agent/api/ValidateSnapshotAnswer.java | 0 .../agent/api/ValidateSnapshotCommand.java | 0 .../src/com/cloud/agent/api/VmStatsEntry.java | 0 .../cloud/agent/api/check/CheckSshAnswer.java | 0 .../agent/api/check/CheckSshCommand.java | 0 .../proxy/CheckConsoleProxyLoadCommand.java | 0 .../api/proxy/ConsoleProxyLoadAnswer.java | 0 .../cloud/agent/api/proxy/ProxyCommand.java | 0 .../api/proxy/UpdateCertificateCommand.java | 0 .../proxy/WatchConsoleProxyLoadCommand.java | 0 .../routing/RemoteAccessVpnCfgCommand.java | 0 .../api/routing/SavePasswordCommand.java | 0 .../agent/api/routing/UserDataCommand.java | 0 .../agent/api/routing/VpnUsersCfgCommand.java | 0 .../api/storage/AbstractDownloadCommand.java | 0 .../api/storage/AbstractUploadCommand.java | 0 .../agent/api/storage/CopyVolumeAnswer.java | 0 .../agent/api/storage/CopyVolumeCommand.java | 11 +- .../cloud/agent/api/storage/CreateAnswer.java | 0 .../CreateEntityDownloadURLAnswer.java | 0 .../CreateEntityDownloadURLCommand.java | 0 .../storage/CreatePrivateTemplateAnswer.java | 0 .../storage/CreatePrivateTemplateCommand.java | 0 .../DeleteEntityDownloadURLAnswer.java | 0 .../DeleteEntityDownloadURLCommand.java | 0 .../api/storage/DeleteTemplateCommand.java | 1 - .../agent/api/storage/DestroyAnswer.java | 0 .../agent/api/storage/DestroyCommand.java | 10 +- .../agent/api/storage/DownloadAnswer.java | 13 +- .../agent/api/storage/DownloadCommand.java | 6 +- .../api/storage/DownloadProgressCommand.java | 0 .../ManageVolumeAvailabilityAnswer.java | 0 .../ManageVolumeAvailabilityCommand.java | 0 .../storage/PrimaryStorageDownloadAnswer.java | 0 .../PrimaryStorageDownloadCommand.java | 0 .../agent/api/storage/StorageCommand.java | 0 .../agent/api/storage/UpgradeDiskAnswer.java | 0 .../agent/api/storage/UpgradeDiskCommand.java | 0 .../cloud/agent/api/storage/UploadAnswer.java | 17 +-- .../agent/api/storage/UploadCommand.java | 27 ++-- .../api/storage/UploadProgressCommand.java | 0 .../src/com/cloud/agent/api/to/HostTO.java | 4 +- .../com/cloud/agent/api/to/TemplateTO.java | 5 +- api/src/com/cloud/host/Host.java | 38 ++++-- .../src/com/cloud/host/HostEnvironment.java | 0 .../src/com/cloud/host/HostStats.java | 0 api/src/com/cloud/network/Networks.java | 8 ++ .../src/com/cloud/storage/StorageStats.java | 0 .../VMTemplateStorageResourceAssoc.java | 38 +++--- .../src/com/cloud/storage/VolumeStats.java | 0 .../template/VirtualMachineTemplate.java | 6 + {core => api}/src/com/cloud/vm/VmStats.java | 0 core/.classpath | 2 +- .../com/cloud/agent/api/CheckOnVmAnswer.java | 52 -------- .../com/cloud/agent/api/CheckOnVmCommand.java | 41 ------ .../src/com/cloud/agent/api/MirrorAnswer.java | 85 ------------- .../com/cloud/agent/api/MirrorCommand.java | 104 --------------- .../api/PingRoutingWithNwGroupsCommand.java | 111 ---------------- .../api/routing/LoadBalancerCfgCommand.java | 76 ----------- .../cloud/agent/api/storage/ShareAnswer.java | 44 ------- .../cloud/agent/api/storage/ShareCommand.java | 89 ------------- .../VirtualRoutingResource.java | 38 +----- .../com/cloud/agent/transport/Request.java | 118 +++++++++++++++++- core/src/com/cloud/host/HostVO.java | 25 ++-- .../xen/resource/CitrixResourceBase.java | 92 +------------- core/src/com/cloud/network/NetworkEnums.java | 32 ----- .../storage/VMTemplateStoragePoolVO.java | 85 ++++++++----- .../storage/resource/StoragePoolResource.java | 6 +- .../src/com/cloud/server/StatsCollector.java | 25 ++-- .../storage/upload/UploadMonitorImpl.java | 2 +- 159 files changed, 378 insertions(+), 989 deletions(-) rename {core => api}/src/com/cloud/agent/api/AgentControlAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/AgentControlCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/AttachIsoCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/AttachVolumeAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/AttachVolumeCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/BackupSnapshotAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/BackupSnapshotCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CancelCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/ChangeAgentAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/ChangeAgentCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckHealthAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckHealthCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckOnHostAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckOnHostCommand.java (93%) rename {core => api}/src/com/cloud/agent/api/CheckStateAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckStateCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/CheckVirtualMachineCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java (100%) rename {core => api}/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/CronCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/DeleteStoragePoolCommand.java (70%) rename {core => api}/src/com/cloud/agent/api/FenceAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/FenceCommand.java (92%) rename {core => api}/src/com/cloud/agent/api/GetFileStatsAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/GetFileStatsCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/GetHostStatsAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/GetHostStatsCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/GetStorageStatsAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/GetStorageStatsCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/GetVmStatsAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/GetVmStatsCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/GetVncPortAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/GetVncPortCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/HostStatsEntry.java (100%) rename {core => api}/src/com/cloud/agent/api/MaintainAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/MaintainCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/ManageSnapshotAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/ManageSnapshotCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/MigrateAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/MigrateCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/ModifySshKeysCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/NetworkUsageAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/NetworkUsageCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/PingAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/PingCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/PingRoutingCommand.java (100%) create mode 100644 api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java rename {core => api}/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/PingStorageCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/PingTestCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/PoolEjectCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/PrepareForMigrationAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/PrepareForMigrationCommand.java (81%) rename {core => api}/src/com/cloud/agent/api/ReadyAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/ReadyCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/RebootAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/RebootCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/RebootRouterCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java (50%) rename {core => api}/src/com/cloud/agent/api/SecStorageSetupCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/SecurityIngressRuleAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/SecurityIngressRulesCmd.java (100%) rename {core => api}/src/com/cloud/agent/api/SetupAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/SetupCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/ShutdownCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/SnapshotCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/StartAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/StartupAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/StartupCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/StartupExternalFirewallCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/StartupProxyCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/StartupRoutingCommand.java (98%) rename {core => api}/src/com/cloud/agent/api/StartupStorageCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/StopAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/StopCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/UpgradeAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/UpgradeCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/ValidateSnapshotAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/ValidateSnapshotCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/VmStatsEntry.java (100%) rename {core => api}/src/com/cloud/agent/api/check/CheckSshAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/check/CheckSshCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/proxy/ProxyCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/proxy/UpdateCertificateCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/routing/SavePasswordCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/routing/UserDataCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/AbstractUploadCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/CopyVolumeCommand.java (87%) rename {core => api}/src/com/cloud/agent/api/storage/CreateAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java (96%) rename {core => api}/src/com/cloud/agent/api/storage/DestroyAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/DestroyCommand.java (85%) rename {core => api}/src/com/cloud/agent/api/storage/DownloadAnswer.java (91%) rename {core => api}/src/com/cloud/agent/api/storage/DownloadCommand.java (94%) rename {core => api}/src/com/cloud/agent/api/storage/DownloadProgressCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/StorageCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/storage/UploadAnswer.java (83%) rename {core => api}/src/com/cloud/agent/api/storage/UploadCommand.java (78%) rename {core => api}/src/com/cloud/agent/api/storage/UploadProgressCommand.java (100%) rename {core => api}/src/com/cloud/agent/api/to/HostTO.java (97%) rename {core => api}/src/com/cloud/agent/api/to/TemplateTO.java (89%) rename {core => api}/src/com/cloud/host/HostEnvironment.java (100%) rename {core => api}/src/com/cloud/host/HostStats.java (100%) rename {core => api}/src/com/cloud/storage/StorageStats.java (100%) rename {core => api}/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java (61%) rename {core => api}/src/com/cloud/storage/VolumeStats.java (100%) rename {core => api}/src/com/cloud/vm/VmStats.java (100%) delete mode 100644 core/src/com/cloud/agent/api/CheckOnVmAnswer.java delete mode 100644 core/src/com/cloud/agent/api/CheckOnVmCommand.java delete mode 100644 core/src/com/cloud/agent/api/MirrorAnswer.java delete mode 100644 core/src/com/cloud/agent/api/MirrorCommand.java delete mode 100644 core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java delete mode 100644 core/src/com/cloud/agent/api/routing/LoadBalancerCfgCommand.java delete mode 100644 core/src/com/cloud/agent/api/storage/ShareAnswer.java delete mode 100644 core/src/com/cloud/agent/api/storage/ShareCommand.java delete mode 100644 core/src/com/cloud/network/NetworkEnums.java diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java index e5319d555d8..d9bacc7e84e 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java @@ -104,7 +104,6 @@ import com.cloud.agent.api.ManageSnapshotAnswer; import com.cloud.agent.api.ManageSnapshotCommand; import com.cloud.agent.api.MigrateAnswer; import com.cloud.agent.api.MigrateCommand; -import com.cloud.agent.api.MirrorCommand; import com.cloud.agent.api.ModifySshKeysCommand; import com.cloud.agent.api.ModifyStoragePoolAnswer; import com.cloud.agent.api.ModifyStoragePoolCommand; @@ -165,8 +164,8 @@ import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource; import com.cloud.exception.InternalErrorException; import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy; import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.Networks.RouterPrivateIpStrategy; import com.cloud.network.Networks.TrafficType; import com.cloud.resource.ServerResource; import com.cloud.resource.ServerResourceBase; @@ -798,8 +797,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv return execute((GetHostStatsCommand)cmd); } else if (cmd instanceof CheckStateCommand) { return executeRequest(cmd); - } else if (cmd instanceof MirrorCommand) { - return executeRequest(cmd); } else if (cmd instanceof CheckHealthCommand) { return execute((CheckHealthCommand)cmd); } else if (cmd instanceof PrepareForMigrationCommand) { @@ -887,7 +884,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } KVMHABase.NfsStoragePool sp = new KVMHABase.NfsStoragePool(cmd.getPool().getUuid(), - cmd.getPool().getHostAddress(), + cmd.getPool().getHost(), cmd.getPool().getPath(), _mountPoint + File.separator + cmd.getPool().getUuid(), PoolType.PrimaryStorage); @@ -2220,8 +2217,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv return new StartAnswer(cmd); } catch (Exception e) { s_logger.warn("Exception ", e); - if (conn != null) - handleVmStartFailure(conn, vmName, vm); + if (conn != null) { + handleVmStartFailure(conn, vmName, vm); + } return new StartAnswer(cmd, e.getMessage()); } finally { synchronized (_vms) { diff --git a/core/src/com/cloud/agent/api/AgentControlAnswer.java b/api/src/com/cloud/agent/api/AgentControlAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/AgentControlAnswer.java rename to api/src/com/cloud/agent/api/AgentControlAnswer.java diff --git a/core/src/com/cloud/agent/api/AgentControlCommand.java b/api/src/com/cloud/agent/api/AgentControlCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/AgentControlCommand.java rename to api/src/com/cloud/agent/api/AgentControlCommand.java diff --git a/core/src/com/cloud/agent/api/AttachIsoCommand.java b/api/src/com/cloud/agent/api/AttachIsoCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/AttachIsoCommand.java rename to api/src/com/cloud/agent/api/AttachIsoCommand.java diff --git a/core/src/com/cloud/agent/api/AttachVolumeAnswer.java b/api/src/com/cloud/agent/api/AttachVolumeAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/AttachVolumeAnswer.java rename to api/src/com/cloud/agent/api/AttachVolumeAnswer.java diff --git a/core/src/com/cloud/agent/api/AttachVolumeCommand.java b/api/src/com/cloud/agent/api/AttachVolumeCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/AttachVolumeCommand.java rename to api/src/com/cloud/agent/api/AttachVolumeCommand.java diff --git a/core/src/com/cloud/agent/api/BackupSnapshotAnswer.java b/api/src/com/cloud/agent/api/BackupSnapshotAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/BackupSnapshotAnswer.java rename to api/src/com/cloud/agent/api/BackupSnapshotAnswer.java diff --git a/core/src/com/cloud/agent/api/BackupSnapshotCommand.java b/api/src/com/cloud/agent/api/BackupSnapshotCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/BackupSnapshotCommand.java rename to api/src/com/cloud/agent/api/BackupSnapshotCommand.java diff --git a/core/src/com/cloud/agent/api/CancelCommand.java b/api/src/com/cloud/agent/api/CancelCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CancelCommand.java rename to api/src/com/cloud/agent/api/CancelCommand.java diff --git a/core/src/com/cloud/agent/api/ChangeAgentAnswer.java b/api/src/com/cloud/agent/api/ChangeAgentAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/ChangeAgentAnswer.java rename to api/src/com/cloud/agent/api/ChangeAgentAnswer.java diff --git a/core/src/com/cloud/agent/api/ChangeAgentCommand.java b/api/src/com/cloud/agent/api/ChangeAgentCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ChangeAgentCommand.java rename to api/src/com/cloud/agent/api/ChangeAgentCommand.java diff --git a/core/src/com/cloud/agent/api/CheckHealthAnswer.java b/api/src/com/cloud/agent/api/CheckHealthAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckHealthAnswer.java rename to api/src/com/cloud/agent/api/CheckHealthAnswer.java diff --git a/core/src/com/cloud/agent/api/CheckHealthCommand.java b/api/src/com/cloud/agent/api/CheckHealthCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckHealthCommand.java rename to api/src/com/cloud/agent/api/CheckHealthCommand.java diff --git a/core/src/com/cloud/agent/api/CheckOnHostAnswer.java b/api/src/com/cloud/agent/api/CheckOnHostAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckOnHostAnswer.java rename to api/src/com/cloud/agent/api/CheckOnHostAnswer.java diff --git a/core/src/com/cloud/agent/api/CheckOnHostCommand.java b/api/src/com/cloud/agent/api/CheckOnHostCommand.java similarity index 93% rename from core/src/com/cloud/agent/api/CheckOnHostCommand.java rename to api/src/com/cloud/agent/api/CheckOnHostCommand.java index 38f808713ba..2bbb564acd4 100644 --- a/core/src/com/cloud/agent/api/CheckOnHostCommand.java +++ b/api/src/com/cloud/agent/api/CheckOnHostCommand.java @@ -18,7 +18,7 @@ package com.cloud.agent.api; import com.cloud.agent.api.to.HostTO; -import com.cloud.host.HostVO; +import com.cloud.host.Host; public class CheckOnHostCommand extends Command { HostTO host; @@ -27,7 +27,7 @@ public class CheckOnHostCommand extends Command { } - public CheckOnHostCommand(HostVO host) { + public CheckOnHostCommand(Host host) { this.host = new HostTO(host); } diff --git a/core/src/com/cloud/agent/api/CheckStateAnswer.java b/api/src/com/cloud/agent/api/CheckStateAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckStateAnswer.java rename to api/src/com/cloud/agent/api/CheckStateAnswer.java diff --git a/core/src/com/cloud/agent/api/CheckStateCommand.java b/api/src/com/cloud/agent/api/CheckStateCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckStateCommand.java rename to api/src/com/cloud/agent/api/CheckStateCommand.java diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java b/api/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java rename to api/src/com/cloud/agent/api/CheckVirtualMachineAnswer.java diff --git a/core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java b/api/src/com/cloud/agent/api/CheckVirtualMachineCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CheckVirtualMachineCommand.java rename to api/src/com/cloud/agent/api/CheckVirtualMachineCommand.java diff --git a/core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java b/api/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java similarity index 100% rename from core/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java rename to api/src/com/cloud/agent/api/CleanupNetworkRulesCmd.java diff --git a/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java b/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java rename to api/src/com/cloud/agent/api/ConsoleAccessAuthenticationAnswer.java diff --git a/core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java b/api/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java rename to api/src/com/cloud/agent/api/ConsoleAccessAuthenticationCommand.java diff --git a/core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java b/api/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java rename to api/src/com/cloud/agent/api/ConsoleProxyLoadReportCommand.java diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java b/api/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java rename to api/src/com/cloud/agent/api/CreatePrivateTemplateFromSnapshotCommand.java diff --git a/core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java b/api/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java rename to api/src/com/cloud/agent/api/CreatePrivateTemplateFromVolumeCommand.java diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java rename to api/src/com/cloud/agent/api/CreateVolumeFromSnapshotAnswer.java diff --git a/core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java rename to api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java diff --git a/core/src/com/cloud/agent/api/CronCommand.java b/api/src/com/cloud/agent/api/CronCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/CronCommand.java rename to api/src/com/cloud/agent/api/CronCommand.java diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java b/api/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java rename to api/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java rename to api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java b/api/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java rename to api/src/com/cloud/agent/api/DeleteSnapshotsDirCommand.java diff --git a/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java b/api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java similarity index 70% rename from core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java rename to api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java index 5f16b454bbb..98972e2be31 100644 --- a/core/src/com/cloud/agent/api/DeleteStoragePoolCommand.java +++ b/api/src/com/cloud/agent/api/DeleteStoragePoolCommand.java @@ -21,34 +21,34 @@ package com.cloud.agent.api; import java.io.File; import java.util.UUID; -import com.cloud.storage.StoragePoolVO; +import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.storage.StoragePool; public class DeleteStoragePoolCommand extends Command { - StoragePoolVO pool; + StorageFilerTO pool; public static final String LOCAL_PATH_PREFIX="/mnt/"; String localPath; - public DeleteStoragePoolCommand() { } - public DeleteStoragePoolCommand(StoragePoolVO pool, String localPath) { - this.pool = new StoragePoolVO(pool); + public DeleteStoragePoolCommand(StoragePool pool, String localPath) { + this.pool = new StorageFilerTO(pool); this.localPath = localPath; } - public DeleteStoragePoolCommand(StoragePoolVO pool) { - this(new StoragePoolVO(pool), LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); + public DeleteStoragePoolCommand(StoragePool pool) { + this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); } - public StoragePoolVO getPool() { + public StorageFilerTO getPool() { return pool; } - public void setPool(StoragePoolVO pool) { - this.pool = new StoragePoolVO(pool); + public void setPool(StoragePool pool) { + this.pool = new StorageFilerTO(pool); } @Override diff --git a/core/src/com/cloud/agent/api/FenceAnswer.java b/api/src/com/cloud/agent/api/FenceAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/FenceAnswer.java rename to api/src/com/cloud/agent/api/FenceAnswer.java diff --git a/core/src/com/cloud/agent/api/FenceCommand.java b/api/src/com/cloud/agent/api/FenceCommand.java similarity index 92% rename from core/src/com/cloud/agent/api/FenceCommand.java rename to api/src/com/cloud/agent/api/FenceCommand.java index 3b47909ce87..ffbc01e51aa 100644 --- a/core/src/com/cloud/agent/api/FenceCommand.java +++ b/api/src/com/cloud/agent/api/FenceCommand.java @@ -17,8 +17,8 @@ */ package com.cloud.agent.api; -import com.cloud.host.HostVO; -import com.cloud.vm.VMInstanceVO; +import com.cloud.host.Host; +import com.cloud.vm.VirtualMachine; public class FenceCommand extends Command { @@ -30,7 +30,7 @@ public class FenceCommand extends Command { String hostGuid; String hostIp; - public FenceCommand(VMInstanceVO vm, HostVO host) { + public FenceCommand(VirtualMachine vm, Host host) { super(); vmName = vm.getInstanceName(); hostGuid = host.getGuid(); diff --git a/core/src/com/cloud/agent/api/GetFileStatsAnswer.java b/api/src/com/cloud/agent/api/GetFileStatsAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/GetFileStatsAnswer.java rename to api/src/com/cloud/agent/api/GetFileStatsAnswer.java diff --git a/core/src/com/cloud/agent/api/GetFileStatsCommand.java b/api/src/com/cloud/agent/api/GetFileStatsCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/GetFileStatsCommand.java rename to api/src/com/cloud/agent/api/GetFileStatsCommand.java diff --git a/core/src/com/cloud/agent/api/GetHostStatsAnswer.java b/api/src/com/cloud/agent/api/GetHostStatsAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/GetHostStatsAnswer.java rename to api/src/com/cloud/agent/api/GetHostStatsAnswer.java diff --git a/core/src/com/cloud/agent/api/GetHostStatsCommand.java b/api/src/com/cloud/agent/api/GetHostStatsCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/GetHostStatsCommand.java rename to api/src/com/cloud/agent/api/GetHostStatsCommand.java diff --git a/core/src/com/cloud/agent/api/GetStorageStatsAnswer.java b/api/src/com/cloud/agent/api/GetStorageStatsAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/GetStorageStatsAnswer.java rename to api/src/com/cloud/agent/api/GetStorageStatsAnswer.java diff --git a/core/src/com/cloud/agent/api/GetStorageStatsCommand.java b/api/src/com/cloud/agent/api/GetStorageStatsCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/GetStorageStatsCommand.java rename to api/src/com/cloud/agent/api/GetStorageStatsCommand.java diff --git a/core/src/com/cloud/agent/api/GetVmStatsAnswer.java b/api/src/com/cloud/agent/api/GetVmStatsAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/GetVmStatsAnswer.java rename to api/src/com/cloud/agent/api/GetVmStatsAnswer.java diff --git a/core/src/com/cloud/agent/api/GetVmStatsCommand.java b/api/src/com/cloud/agent/api/GetVmStatsCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/GetVmStatsCommand.java rename to api/src/com/cloud/agent/api/GetVmStatsCommand.java diff --git a/core/src/com/cloud/agent/api/GetVncPortAnswer.java b/api/src/com/cloud/agent/api/GetVncPortAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/GetVncPortAnswer.java rename to api/src/com/cloud/agent/api/GetVncPortAnswer.java diff --git a/core/src/com/cloud/agent/api/GetVncPortCommand.java b/api/src/com/cloud/agent/api/GetVncPortCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/GetVncPortCommand.java rename to api/src/com/cloud/agent/api/GetVncPortCommand.java diff --git a/core/src/com/cloud/agent/api/HostStatsEntry.java b/api/src/com/cloud/agent/api/HostStatsEntry.java similarity index 100% rename from core/src/com/cloud/agent/api/HostStatsEntry.java rename to api/src/com/cloud/agent/api/HostStatsEntry.java diff --git a/core/src/com/cloud/agent/api/MaintainAnswer.java b/api/src/com/cloud/agent/api/MaintainAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/MaintainAnswer.java rename to api/src/com/cloud/agent/api/MaintainAnswer.java diff --git a/core/src/com/cloud/agent/api/MaintainCommand.java b/api/src/com/cloud/agent/api/MaintainCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/MaintainCommand.java rename to api/src/com/cloud/agent/api/MaintainCommand.java diff --git a/core/src/com/cloud/agent/api/ManageSnapshotAnswer.java b/api/src/com/cloud/agent/api/ManageSnapshotAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/ManageSnapshotAnswer.java rename to api/src/com/cloud/agent/api/ManageSnapshotAnswer.java diff --git a/core/src/com/cloud/agent/api/ManageSnapshotCommand.java b/api/src/com/cloud/agent/api/ManageSnapshotCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ManageSnapshotCommand.java rename to api/src/com/cloud/agent/api/ManageSnapshotCommand.java diff --git a/core/src/com/cloud/agent/api/MigrateAnswer.java b/api/src/com/cloud/agent/api/MigrateAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/MigrateAnswer.java rename to api/src/com/cloud/agent/api/MigrateAnswer.java diff --git a/core/src/com/cloud/agent/api/MigrateCommand.java b/api/src/com/cloud/agent/api/MigrateCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/MigrateCommand.java rename to api/src/com/cloud/agent/api/MigrateCommand.java diff --git a/core/src/com/cloud/agent/api/ModifySshKeysCommand.java b/api/src/com/cloud/agent/api/ModifySshKeysCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ModifySshKeysCommand.java rename to api/src/com/cloud/agent/api/ModifySshKeysCommand.java diff --git a/core/src/com/cloud/agent/api/NetworkUsageAnswer.java b/api/src/com/cloud/agent/api/NetworkUsageAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/NetworkUsageAnswer.java rename to api/src/com/cloud/agent/api/NetworkUsageAnswer.java diff --git a/core/src/com/cloud/agent/api/NetworkUsageCommand.java b/api/src/com/cloud/agent/api/NetworkUsageCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/NetworkUsageCommand.java rename to api/src/com/cloud/agent/api/NetworkUsageCommand.java diff --git a/core/src/com/cloud/agent/api/PingAnswer.java b/api/src/com/cloud/agent/api/PingAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/PingAnswer.java rename to api/src/com/cloud/agent/api/PingAnswer.java diff --git a/core/src/com/cloud/agent/api/PingCommand.java b/api/src/com/cloud/agent/api/PingCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/PingCommand.java rename to api/src/com/cloud/agent/api/PingCommand.java diff --git a/core/src/com/cloud/agent/api/PingRoutingCommand.java b/api/src/com/cloud/agent/api/PingRoutingCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/PingRoutingCommand.java rename to api/src/com/cloud/agent/api/PingRoutingCommand.java diff --git a/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java b/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java new file mode 100644 index 00000000000..06a4de581b7 --- /dev/null +++ b/api/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2010 Cloud.com. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later +version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +package com.cloud.agent.api; + +import java.util.HashMap; +import java.util.Map; + +import com.cloud.host.Host; +import com.cloud.utils.Pair; +import com.cloud.vm.VirtualMachine.State; + + +public class PingRoutingWithNwGroupsCommand extends PingRoutingCommand { + HashMap> newGroupStates; + + protected PingRoutingWithNwGroupsCommand() { + super(); + } + + public PingRoutingWithNwGroupsCommand(Host.Type type, long id, Map states, HashMap> nwGrpStates) { + super(type, id, states); + newGroupStates = nwGrpStates; + } + + public HashMap> getNewGroupStates() { + return newGroupStates; + } + + public void setNewGroupStates(HashMap> newGroupStates) { + this.newGroupStates = newGroupStates; + } +} diff --git a/core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java b/api/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java rename to api/src/com/cloud/agent/api/PingRoutingWithOvsCommand.java diff --git a/core/src/com/cloud/agent/api/PingStorageCommand.java b/api/src/com/cloud/agent/api/PingStorageCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/PingStorageCommand.java rename to api/src/com/cloud/agent/api/PingStorageCommand.java diff --git a/core/src/com/cloud/agent/api/PingTestCommand.java b/api/src/com/cloud/agent/api/PingTestCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/PingTestCommand.java rename to api/src/com/cloud/agent/api/PingTestCommand.java diff --git a/core/src/com/cloud/agent/api/PoolEjectCommand.java b/api/src/com/cloud/agent/api/PoolEjectCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/PoolEjectCommand.java rename to api/src/com/cloud/agent/api/PoolEjectCommand.java diff --git a/core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java b/api/src/com/cloud/agent/api/PrepareForMigrationAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/PrepareForMigrationAnswer.java rename to api/src/com/cloud/agent/api/PrepareForMigrationAnswer.java diff --git a/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java b/api/src/com/cloud/agent/api/PrepareForMigrationCommand.java similarity index 81% rename from core/src/com/cloud/agent/api/PrepareForMigrationCommand.java rename to api/src/com/cloud/agent/api/PrepareForMigrationCommand.java index c9d7e87fcb1..f73b75c752f 100644 --- a/core/src/com/cloud/agent/api/PrepareForMigrationCommand.java +++ b/api/src/com/cloud/agent/api/PrepareForMigrationCommand.java @@ -17,10 +17,7 @@ */ package com.cloud.agent.api; -import java.util.List; - import com.cloud.agent.api.to.VirtualMachineTO; -import com.cloud.storage.VolumeVO; public class PrepareForMigrationCommand extends StartCommand { @@ -31,10 +28,6 @@ public class PrepareForMigrationCommand extends StartCommand { super(vm); } - public PrepareForMigrationCommand(String vmName, String vnet, String[] storageHosts, List vols, boolean mirrored) { - //super(vmName, storageHosts, vols, mirrored); - } - @Override public boolean executeInSequence() { return true; diff --git a/core/src/com/cloud/agent/api/ReadyAnswer.java b/api/src/com/cloud/agent/api/ReadyAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/ReadyAnswer.java rename to api/src/com/cloud/agent/api/ReadyAnswer.java diff --git a/core/src/com/cloud/agent/api/ReadyCommand.java b/api/src/com/cloud/agent/api/ReadyCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ReadyCommand.java rename to api/src/com/cloud/agent/api/ReadyCommand.java diff --git a/core/src/com/cloud/agent/api/RebootAnswer.java b/api/src/com/cloud/agent/api/RebootAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/RebootAnswer.java rename to api/src/com/cloud/agent/api/RebootAnswer.java diff --git a/core/src/com/cloud/agent/api/RebootCommand.java b/api/src/com/cloud/agent/api/RebootCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/RebootCommand.java rename to api/src/com/cloud/agent/api/RebootCommand.java diff --git a/core/src/com/cloud/agent/api/RebootRouterCommand.java b/api/src/com/cloud/agent/api/RebootRouterCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/RebootRouterCommand.java rename to api/src/com/cloud/agent/api/RebootRouterCommand.java diff --git a/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java b/api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java similarity index 50% rename from core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java rename to api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java index a27cbfa95ab..1b2f7b3e84b 100644 --- a/core/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java +++ b/api/src/com/cloud/agent/api/SecStorageFirewallCfgCommand.java @@ -18,74 +18,17 @@ package com.cloud.agent.api; -import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; -import com.cloud.agent.transport.Request; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; import com.google.gson.annotations.Expose; -import com.google.gson.reflect.TypeToken; public class SecStorageFirewallCfgCommand extends Command { private static final Logger s_logger = Logger.getLogger(SecStorageFirewallCfgCommand.class); - public static class PortConfigListTypeAdaptor implements JsonDeserializer>, JsonSerializer> { - static final GsonBuilder s_gBuilder; - static { - s_gBuilder = Request.initBuilder(); - } - - static final Type listType = new TypeToken>() {}.getType(); - - public PortConfigListTypeAdaptor() { - } - - public JsonElement serialize(List src, Type typeOfSrc, JsonSerializationContext context) { - if (src.size() == 0) { - s_logger.info("Returning JsonNull"); - return new JsonNull(); - } - Gson json = s_gBuilder.create(); - s_logger.debug("Returning gson tree"); - JsonArray array = new JsonArray(); - for (PortConfig pc : src) { - array.add(json.toJsonTree(pc)); - } - - return array; - } - - public List deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - if (json.isJsonNull()) { - return new ArrayList(); - } - Gson jsonp = s_gBuilder.create(); - List pcs = new ArrayList(); - JsonArray array = json.getAsJsonArray(); - Iterator it = array.iterator(); - while (it.hasNext()) { - JsonElement element = it.next(); - pcs.add(jsonp.fromJson(element, PortConfig.class)); - } - return pcs; - } - - } public static class PortConfig { @Expose boolean add; @Expose String sourceIp; diff --git a/core/src/com/cloud/agent/api/SecStorageSetupCommand.java b/api/src/com/cloud/agent/api/SecStorageSetupCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/SecStorageSetupCommand.java rename to api/src/com/cloud/agent/api/SecStorageSetupCommand.java diff --git a/core/src/com/cloud/agent/api/SecurityIngressRuleAnswer.java b/api/src/com/cloud/agent/api/SecurityIngressRuleAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/SecurityIngressRuleAnswer.java rename to api/src/com/cloud/agent/api/SecurityIngressRuleAnswer.java diff --git a/core/src/com/cloud/agent/api/SecurityIngressRulesCmd.java b/api/src/com/cloud/agent/api/SecurityIngressRulesCmd.java similarity index 100% rename from core/src/com/cloud/agent/api/SecurityIngressRulesCmd.java rename to api/src/com/cloud/agent/api/SecurityIngressRulesCmd.java diff --git a/core/src/com/cloud/agent/api/SetupAnswer.java b/api/src/com/cloud/agent/api/SetupAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/SetupAnswer.java rename to api/src/com/cloud/agent/api/SetupAnswer.java diff --git a/core/src/com/cloud/agent/api/SetupCommand.java b/api/src/com/cloud/agent/api/SetupCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/SetupCommand.java rename to api/src/com/cloud/agent/api/SetupCommand.java diff --git a/core/src/com/cloud/agent/api/ShutdownCommand.java b/api/src/com/cloud/agent/api/ShutdownCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ShutdownCommand.java rename to api/src/com/cloud/agent/api/ShutdownCommand.java diff --git a/core/src/com/cloud/agent/api/SnapshotCommand.java b/api/src/com/cloud/agent/api/SnapshotCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/SnapshotCommand.java rename to api/src/com/cloud/agent/api/SnapshotCommand.java diff --git a/core/src/com/cloud/agent/api/StartAnswer.java b/api/src/com/cloud/agent/api/StartAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/StartAnswer.java rename to api/src/com/cloud/agent/api/StartAnswer.java diff --git a/core/src/com/cloud/agent/api/StartupAnswer.java b/api/src/com/cloud/agent/api/StartupAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/StartupAnswer.java rename to api/src/com/cloud/agent/api/StartupAnswer.java diff --git a/core/src/com/cloud/agent/api/StartupCommand.java b/api/src/com/cloud/agent/api/StartupCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/StartupCommand.java rename to api/src/com/cloud/agent/api/StartupCommand.java diff --git a/core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java b/api/src/com/cloud/agent/api/StartupExternalFirewallCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/StartupExternalFirewallCommand.java rename to api/src/com/cloud/agent/api/StartupExternalFirewallCommand.java diff --git a/core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java b/api/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java rename to api/src/com/cloud/agent/api/StartupExternalLoadBalancerCommand.java diff --git a/core/src/com/cloud/agent/api/StartupProxyCommand.java b/api/src/com/cloud/agent/api/StartupProxyCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/StartupProxyCommand.java rename to api/src/com/cloud/agent/api/StartupProxyCommand.java diff --git a/core/src/com/cloud/agent/api/StartupRoutingCommand.java b/api/src/com/cloud/agent/api/StartupRoutingCommand.java similarity index 98% rename from core/src/com/cloud/agent/api/StartupRoutingCommand.java rename to api/src/com/cloud/agent/api/StartupRoutingCommand.java index f55bad47a01..390a4787431 100755 --- a/core/src/com/cloud/agent/api/StartupRoutingCommand.java +++ b/api/src/com/cloud/agent/api/StartupRoutingCommand.java @@ -20,7 +20,7 @@ import java.util.HashMap; import java.util.Map; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.NetworkEnums.RouterPrivateIpStrategy; +import com.cloud.network.Networks.RouterPrivateIpStrategy; import com.cloud.vm.VirtualMachine.State; public class StartupRoutingCommand extends StartupCommand { diff --git a/core/src/com/cloud/agent/api/StartupStorageCommand.java b/api/src/com/cloud/agent/api/StartupStorageCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/StartupStorageCommand.java rename to api/src/com/cloud/agent/api/StartupStorageCommand.java diff --git a/core/src/com/cloud/agent/api/StopAnswer.java b/api/src/com/cloud/agent/api/StopAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/StopAnswer.java rename to api/src/com/cloud/agent/api/StopAnswer.java diff --git a/core/src/com/cloud/agent/api/StopCommand.java b/api/src/com/cloud/agent/api/StopCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/StopCommand.java rename to api/src/com/cloud/agent/api/StopCommand.java diff --git a/core/src/com/cloud/agent/api/UpgradeAnswer.java b/api/src/com/cloud/agent/api/UpgradeAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/UpgradeAnswer.java rename to api/src/com/cloud/agent/api/UpgradeAnswer.java diff --git a/core/src/com/cloud/agent/api/UpgradeCommand.java b/api/src/com/cloud/agent/api/UpgradeCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/UpgradeCommand.java rename to api/src/com/cloud/agent/api/UpgradeCommand.java diff --git a/core/src/com/cloud/agent/api/ValidateSnapshotAnswer.java b/api/src/com/cloud/agent/api/ValidateSnapshotAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/ValidateSnapshotAnswer.java rename to api/src/com/cloud/agent/api/ValidateSnapshotAnswer.java diff --git a/core/src/com/cloud/agent/api/ValidateSnapshotCommand.java b/api/src/com/cloud/agent/api/ValidateSnapshotCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/ValidateSnapshotCommand.java rename to api/src/com/cloud/agent/api/ValidateSnapshotCommand.java diff --git a/core/src/com/cloud/agent/api/VmStatsEntry.java b/api/src/com/cloud/agent/api/VmStatsEntry.java similarity index 100% rename from core/src/com/cloud/agent/api/VmStatsEntry.java rename to api/src/com/cloud/agent/api/VmStatsEntry.java diff --git a/core/src/com/cloud/agent/api/check/CheckSshAnswer.java b/api/src/com/cloud/agent/api/check/CheckSshAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/check/CheckSshAnswer.java rename to api/src/com/cloud/agent/api/check/CheckSshAnswer.java diff --git a/core/src/com/cloud/agent/api/check/CheckSshCommand.java b/api/src/com/cloud/agent/api/check/CheckSshCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/check/CheckSshCommand.java rename to api/src/com/cloud/agent/api/check/CheckSshCommand.java diff --git a/core/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java b/api/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java rename to api/src/com/cloud/agent/api/proxy/CheckConsoleProxyLoadCommand.java diff --git a/core/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java b/api/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java rename to api/src/com/cloud/agent/api/proxy/ConsoleProxyLoadAnswer.java diff --git a/core/src/com/cloud/agent/api/proxy/ProxyCommand.java b/api/src/com/cloud/agent/api/proxy/ProxyCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/proxy/ProxyCommand.java rename to api/src/com/cloud/agent/api/proxy/ProxyCommand.java diff --git a/core/src/com/cloud/agent/api/proxy/UpdateCertificateCommand.java b/api/src/com/cloud/agent/api/proxy/UpdateCertificateCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/proxy/UpdateCertificateCommand.java rename to api/src/com/cloud/agent/api/proxy/UpdateCertificateCommand.java diff --git a/core/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java b/api/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java rename to api/src/com/cloud/agent/api/proxy/WatchConsoleProxyLoadCommand.java diff --git a/core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java b/api/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java rename to api/src/com/cloud/agent/api/routing/RemoteAccessVpnCfgCommand.java diff --git a/core/src/com/cloud/agent/api/routing/SavePasswordCommand.java b/api/src/com/cloud/agent/api/routing/SavePasswordCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/routing/SavePasswordCommand.java rename to api/src/com/cloud/agent/api/routing/SavePasswordCommand.java diff --git a/core/src/com/cloud/agent/api/routing/UserDataCommand.java b/api/src/com/cloud/agent/api/routing/UserDataCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/routing/UserDataCommand.java rename to api/src/com/cloud/agent/api/routing/UserDataCommand.java diff --git a/core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java b/api/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java rename to api/src/com/cloud/agent/api/routing/VpnUsersCfgCommand.java diff --git a/core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java b/api/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java rename to api/src/com/cloud/agent/api/storage/AbstractDownloadCommand.java diff --git a/core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java b/api/src/com/cloud/agent/api/storage/AbstractUploadCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/AbstractUploadCommand.java rename to api/src/com/cloud/agent/api/storage/AbstractUploadCommand.java diff --git a/core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java b/api/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java rename to api/src/com/cloud/agent/api/storage/CopyVolumeAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java b/api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java similarity index 87% rename from core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java rename to api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java index 152bd1563e0..3e367230795 100644 --- a/core/src/com/cloud/agent/api/storage/CopyVolumeCommand.java +++ b/api/src/com/cloud/agent/api/storage/CopyVolumeCommand.java @@ -19,13 +19,14 @@ package com.cloud.agent.api.storage; import com.cloud.agent.api.Command; -import com.cloud.storage.StoragePoolVO; +import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.storage.StoragePool; public class CopyVolumeCommand extends Command { long volumeId; String volumePath; - StoragePoolVO pool; + StorageFilerTO pool; String secondaryStorageURL; boolean toSecondaryStorage; String vmName; @@ -33,10 +34,10 @@ public class CopyVolumeCommand extends Command { public CopyVolumeCommand() { } - public CopyVolumeCommand(long volumeId, String volumePath, StoragePoolVO pool, String secondaryStorageURL, boolean toSecondaryStorage) { + public CopyVolumeCommand(long volumeId, String volumePath, StoragePool pool, String secondaryStorageURL, boolean toSecondaryStorage) { this.volumeId = volumeId; this.volumePath = volumePath; - this.pool = pool; + this.pool = new StorageFilerTO(pool); this.secondaryStorageURL = secondaryStorageURL; this.toSecondaryStorage = toSecondaryStorage; } @@ -54,7 +55,7 @@ public class CopyVolumeCommand extends Command { return volumeId; } - public StoragePoolVO getPool() { + public StorageFilerTO getPool() { return pool; } diff --git a/core/src/com/cloud/agent/api/storage/CreateAnswer.java b/api/src/com/cloud/agent/api/storage/CreateAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/CreateAnswer.java rename to api/src/com/cloud/agent/api/storage/CreateAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java rename to api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java rename to api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java diff --git a/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java b/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java rename to api/src/com/cloud/agent/api/storage/CreatePrivateTemplateAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java b/api/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java rename to api/src/com/cloud/agent/api/storage/CreatePrivateTemplateCommand.java diff --git a/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java b/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java rename to api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java rename to api/src/com/cloud/agent/api/storage/DeleteEntityDownloadURLCommand.java diff --git a/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java b/api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java similarity index 96% rename from core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java rename to api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java index f65b07d755f..5d09d3dd9d8 100644 --- a/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java +++ b/api/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java @@ -19,7 +19,6 @@ package com.cloud.agent.api.storage; import com.cloud.agent.api.Command; -import com.cloud.storage.StoragePoolVO; public class DeleteTemplateCommand extends Command { diff --git a/core/src/com/cloud/agent/api/storage/DestroyAnswer.java b/api/src/com/cloud/agent/api/storage/DestroyAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/DestroyAnswer.java rename to api/src/com/cloud/agent/api/storage/DestroyAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/DestroyCommand.java b/api/src/com/cloud/agent/api/storage/DestroyCommand.java similarity index 85% rename from core/src/com/cloud/agent/api/storage/DestroyCommand.java rename to api/src/com/cloud/agent/api/storage/DestroyCommand.java index 6a624e983c2..c5e3de08b85 100755 --- a/core/src/com/cloud/agent/api/storage/DestroyCommand.java +++ b/api/src/com/cloud/agent/api/storage/DestroyCommand.java @@ -19,9 +19,9 @@ package com.cloud.agent.api.storage; import com.cloud.agent.api.to.VolumeTO; import com.cloud.storage.Storage; -import com.cloud.storage.StoragePoolVO; -import com.cloud.storage.VMTemplateStoragePoolVO; -import com.cloud.storage.VolumeVO; +import com.cloud.storage.StoragePool; +import com.cloud.storage.VMTemplateStorageResourceAssoc; +import com.cloud.storage.Volume; public class DestroyCommand extends StorageCommand { // in VMware, things are designed around VM instead of volume, we need it the volume VM context if the volume is attached @@ -31,12 +31,12 @@ public class DestroyCommand extends StorageCommand { protected DestroyCommand() { } - public DestroyCommand(StoragePoolVO pool, VolumeVO volume, String vmName) { + public DestroyCommand(StoragePool pool, Volume volume, String vmName) { this.volume = new VolumeTO(volume, pool); this.vmName = vmName; } - public DestroyCommand(StoragePoolVO pool, VMTemplateStoragePoolVO templatePoolRef) { + public DestroyCommand(StoragePool pool, VMTemplateStorageResourceAssoc templatePoolRef) { volume = new VolumeTO(templatePoolRef.getId(), null, Storage.StorageResourceType.STORAGE_POOL, pool.getPoolType(), pool.getUuid(), null, pool.getPath(), templatePoolRef.getInstallPath(), templatePoolRef.getTemplateSize(), null); diff --git a/core/src/com/cloud/agent/api/storage/DownloadAnswer.java b/api/src/com/cloud/agent/api/storage/DownloadAnswer.java similarity index 91% rename from core/src/com/cloud/agent/api/storage/DownloadAnswer.java rename to api/src/com/cloud/agent/api/storage/DownloadAnswer.java index 6fc8599374d..5b361944f39 100644 --- a/core/src/com/cloud/agent/api/storage/DownloadAnswer.java +++ b/api/src/com/cloud/agent/api/storage/DownloadAnswer.java @@ -21,14 +21,14 @@ import java.io.File; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; -import com.cloud.storage.VMTemplateHostVO; +import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; public class DownloadAnswer extends Answer { private String jobId; private int downloadPct; private String errorString; - private VMTemplateHostVO.Status downloadStatus; + private VMTemplateStorageResourceAssoc.Status downloadStatus; private String downloadPath; private String installPath; private long templateSize = 0L; @@ -45,7 +45,7 @@ public class DownloadAnswer extends Answer { return downloadStatus.toString(); } - public VMTemplateHostVO.Status getDownloadStatus() { + public VMTemplateStorageResourceAssoc.Status getDownloadStatus() { return downloadStatus; } @@ -94,8 +94,9 @@ public class DownloadAnswer extends Answer { } private static String fixPath(String path){ - if (path == null) - return path; + if (path == null) { + return path; + } if (path.startsWith(File.separator)) { path=path.substring(File.separator.length()); } @@ -105,7 +106,7 @@ public class DownloadAnswer extends Answer { return path; } - public void setDownloadStatus(VMTemplateHostVO.Status downloadStatus) { + public void setDownloadStatus(VMTemplateStorageResourceAssoc.Status downloadStatus) { this.downloadStatus = downloadStatus; } diff --git a/core/src/com/cloud/agent/api/storage/DownloadCommand.java b/api/src/com/cloud/agent/api/storage/DownloadCommand.java similarity index 94% rename from core/src/com/cloud/agent/api/storage/DownloadCommand.java rename to api/src/com/cloud/agent/api/storage/DownloadCommand.java index ea5c37806f0..700eb0e40a4 100644 --- a/core/src/com/cloud/agent/api/storage/DownloadCommand.java +++ b/api/src/com/cloud/agent/api/storage/DownloadCommand.java @@ -17,8 +17,8 @@ */ package com.cloud.agent.api.storage; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Storage.ImageFormat; +import com.cloud.template.VirtualMachineTemplate; /** @@ -64,9 +64,9 @@ public class DownloadCommand extends AbstractDownloadCommand { this.maxDownloadSizeInBytes = that.getMaxDownloadSizeInBytes(); } - public DownloadCommand(VMTemplateVO template, Long maxDownloadSizeInBytes) { + public DownloadCommand(VirtualMachineTemplate template, Long maxDownloadSizeInBytes) { super(template.getUniqueName(), template.getUrl(), template.getFormat(), template.getAccountId()); - this.hvm = template.requiresHvm(); + this.hvm = template.isRequiresHvm(); this.checksum = template.getChecksum(); this.id = template.getId(); this.description = template.getDisplayText(); diff --git a/core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java b/api/src/com/cloud/agent/api/storage/DownloadProgressCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/DownloadProgressCommand.java rename to api/src/com/cloud/agent/api/storage/DownloadProgressCommand.java diff --git a/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java b/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java rename to api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java b/api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java rename to api/src/com/cloud/agent/api/storage/ManageVolumeAvailabilityCommand.java diff --git a/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java rename to api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java rename to api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java diff --git a/core/src/com/cloud/agent/api/storage/StorageCommand.java b/api/src/com/cloud/agent/api/storage/StorageCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/StorageCommand.java rename to api/src/com/cloud/agent/api/storage/StorageCommand.java diff --git a/core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java b/api/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java rename to api/src/com/cloud/agent/api/storage/UpgradeDiskAnswer.java diff --git a/core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java b/api/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java rename to api/src/com/cloud/agent/api/storage/UpgradeDiskCommand.java diff --git a/core/src/com/cloud/agent/api/storage/UploadAnswer.java b/api/src/com/cloud/agent/api/storage/UploadAnswer.java similarity index 83% rename from core/src/com/cloud/agent/api/storage/UploadAnswer.java rename to api/src/com/cloud/agent/api/storage/UploadAnswer.java index b878bf7ca6b..d122218fcda 100755 --- a/core/src/com/cloud/agent/api/storage/UploadAnswer.java +++ b/api/src/com/cloud/agent/api/storage/UploadAnswer.java @@ -4,7 +4,7 @@ import java.io.File; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; -import com.cloud.storage.UploadVO; +import com.cloud.storage.Upload; public class UploadAnswer extends Answer { @@ -12,7 +12,7 @@ public class UploadAnswer extends Answer { private String jobId; private int uploadPct; private String errorString; - private UploadVO.Status uploadStatus; + private Upload.Status uploadStatus; private String uploadPath; private String installPath; public Long templateSize = 0L; @@ -28,7 +28,7 @@ public class UploadAnswer extends Answer { return uploadStatus.toString(); } - public UploadVO.Status getUploadStatus() { + public Upload.Status getUploadStatus() { return uploadStatus; } @@ -50,7 +50,7 @@ public class UploadAnswer extends Answer { } public UploadAnswer(String jobId, int uploadPct, String errorString, - UploadVO.Status uploadStatus, String fileSystemPath, String installPath, long templateSize) { + Upload.Status uploadStatus, String fileSystemPath, String installPath, long templateSize) { super(); this.jobId = jobId; this.uploadPct = uploadPct; @@ -62,7 +62,7 @@ public class UploadAnswer extends Answer { } public UploadAnswer(String jobId, int uploadPct, Command command, - UploadVO.Status uploadStatus, String fileSystemPath, String installPath) { + Upload.Status uploadStatus, String fileSystemPath, String installPath) { super(command); this.jobId = jobId; this.uploadPct = uploadPct; @@ -72,8 +72,9 @@ public class UploadAnswer extends Answer { } private static String fixPath(String path){ - if (path == null) - return path; + if (path == null) { + return path; + } if (path.startsWith(File.separator)) { path=path.substring(File.separator.length()); } @@ -83,7 +84,7 @@ public class UploadAnswer extends Answer { return path; } - public void setUploadStatus(UploadVO.Status uploadStatus) { + public void setUploadStatus(Upload.Status uploadStatus) { this.uploadStatus = uploadStatus; } diff --git a/core/src/com/cloud/agent/api/storage/UploadCommand.java b/api/src/com/cloud/agent/api/storage/UploadCommand.java similarity index 78% rename from core/src/com/cloud/agent/api/storage/UploadCommand.java rename to api/src/com/cloud/agent/api/storage/UploadCommand.java index a3f0695694b..6b50bba308b 100644 --- a/core/src/com/cloud/agent/api/storage/UploadCommand.java +++ b/api/src/com/cloud/agent/api/storage/UploadCommand.java @@ -1,15 +1,14 @@ package com.cloud.agent.api.storage; -import com.cloud.storage.VMTemplateHostVO; -import com.cloud.storage.Upload.Type; -import com.cloud.storage.VMTemplateVO; -import com.cloud.agent.api.storage.AbstractUploadCommand; import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth; +import com.cloud.agent.api.to.TemplateTO; +import com.cloud.storage.Upload.Type; +import com.cloud.template.VirtualMachineTemplate; public class UploadCommand extends AbstractUploadCommand { - private VMTemplateVO template; + private TemplateTO template; private String url; private String installPath; private boolean hvm; @@ -20,14 +19,14 @@ public class UploadCommand extends AbstractUploadCommand { private long id; private Type type; - public UploadCommand(VMTemplateVO template, String url, VMTemplateHostVO vmTemplateHost) { + public UploadCommand(VirtualMachineTemplate template, String url, String installPath, long sizeInBytes) { - this.template = template; + this.template = new TemplateTO(template); this.url = url; - this.installPath = vmTemplateHost.getInstallPath(); + this.installPath = installPath; this.checksum = template.getChecksum(); this.id = template.getId(); - this.templateSizeInBytes = vmTemplateHost.getSize(); + this.templateSizeInBytes = sizeInBytes; } @@ -56,19 +55,21 @@ public class UploadCommand extends AbstractUploadCommand { } - public VMTemplateVO getTemplate() { + public TemplateTO getTemplate() { return template; } - public void setTemplate(VMTemplateVO template) { + public void setTemplate(TemplateTO template) { this.template = template; } - public String getUrl() { + @Override + public String getUrl() { return url; } - public void setUrl(String url) { + @Override + public void setUrl(String url) { this.url = url; } diff --git a/core/src/com/cloud/agent/api/storage/UploadProgressCommand.java b/api/src/com/cloud/agent/api/storage/UploadProgressCommand.java similarity index 100% rename from core/src/com/cloud/agent/api/storage/UploadProgressCommand.java rename to api/src/com/cloud/agent/api/storage/UploadProgressCommand.java diff --git a/core/src/com/cloud/agent/api/to/HostTO.java b/api/src/com/cloud/agent/api/to/HostTO.java similarity index 97% rename from core/src/com/cloud/agent/api/to/HostTO.java rename to api/src/com/cloud/agent/api/to/HostTO.java index 91cfa65437e..bb80215666d 100644 --- a/core/src/com/cloud/agent/api/to/HostTO.java +++ b/api/src/com/cloud/agent/api/to/HostTO.java @@ -17,7 +17,7 @@ */ package com.cloud.agent.api.to; -import com.cloud.host.HostVO; +import com.cloud.host.Host; public class HostTO { private String guid; @@ -29,7 +29,7 @@ public class HostTO { protected HostTO() { } - public HostTO(HostVO vo) { + public HostTO(Host vo) { guid = vo.getGuid(); privateNetwork = new NetworkTO(vo.getPrivateIpAddress(), vo.getPrivateNetmask(), vo.getPrivateMacAddress()); if (vo.getPublicIpAddress() != null) { diff --git a/core/src/com/cloud/agent/api/to/TemplateTO.java b/api/src/com/cloud/agent/api/to/TemplateTO.java similarity index 89% rename from core/src/com/cloud/agent/api/to/TemplateTO.java rename to api/src/com/cloud/agent/api/to/TemplateTO.java index 02372598170..126a7b911e1 100644 --- a/core/src/com/cloud/agent/api/to/TemplateTO.java +++ b/api/src/com/cloud/agent/api/to/TemplateTO.java @@ -17,9 +17,8 @@ */ package com.cloud.agent.api.to; -import com.cloud.storage.VMTemplateStoragePoolVO; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Storage.ImageFormat; +import com.cloud.template.VirtualMachineTemplate; public class TemplateTO { private long id; @@ -29,7 +28,7 @@ public class TemplateTO { protected TemplateTO() { } - public TemplateTO(VMTemplateVO template, VMTemplateStoragePoolVO storedAt) { + public TemplateTO(VirtualMachineTemplate template) { this.id = template.getId(); this.uniqueName = template.getUniqueName(); this.format = template.getFormat(); diff --git a/api/src/com/cloud/host/Host.java b/api/src/com/cloud/host/Host.java index 3aaa504069c..ef5baf1cb53 100755 --- a/api/src/com/cloud/host/Host.java +++ b/api/src/com/cloud/host/Host.java @@ -19,8 +19,7 @@ package com.cloud.host; import java.util.Date; -import com.cloud.host.Status; -import com.cloud.hypervisor.Hypervisor.HypervisorType;; +import com.cloud.hypervisor.Hypervisor.HypervisorType; /** @@ -56,7 +55,7 @@ public interface Host { /** * @return id of the host. */ - Long getId(); + long getId(); /** * @return name of the machine. @@ -145,27 +144,46 @@ public interface Host { /** * @return version */ - public String getVersion(); + String getVersion(); /* * @return total size */ - public long getTotalSize(); + long getTotalSize(); /* * @return capabilities */ - public String getCapabilities(); + String getCapabilities(); /* * @return last pinged time */ - public long getLastPinged(); + long getLastPinged(); /* * @return management server id */ - public Long getManagementServerId(); + Long getManagementServerId(); /* *@return removal date */ - public Date getRemoved(); + Date getRemoved(); + + Long getClusterId(); + + String getPublicIpAddress(); + + String getPublicNetmask(); + + String getPrivateNetmask(); + + String getStorageNetmask(); + + String getStorageMacAddress(); + + String getPublicMacAddress(); + + String getPrivateMacAddress(); + + String getStorageNetmaskDeux(); + + String getStorageMacAddressDeux(); - public Long getClusterId(); } diff --git a/core/src/com/cloud/host/HostEnvironment.java b/api/src/com/cloud/host/HostEnvironment.java similarity index 100% rename from core/src/com/cloud/host/HostEnvironment.java rename to api/src/com/cloud/host/HostEnvironment.java diff --git a/core/src/com/cloud/host/HostStats.java b/api/src/com/cloud/host/HostStats.java similarity index 100% rename from core/src/com/cloud/host/HostStats.java rename to api/src/com/cloud/host/HostStats.java diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java index 889ca567047..4527574a4d3 100644 --- a/api/src/com/cloud/network/Networks.java +++ b/api/src/com/cloud/network/Networks.java @@ -36,6 +36,14 @@ public class Networks { Firewall } + public enum RouterPrivateIpStrategy { + None, + DcGlobal, //global to data center + HostLocal; + + public static String DummyPrivateIp = "169.254.1.1"; + } + /** * Different ways to assign ip address to this network. */ diff --git a/core/src/com/cloud/storage/StorageStats.java b/api/src/com/cloud/storage/StorageStats.java similarity index 100% rename from core/src/com/cloud/storage/StorageStats.java rename to api/src/com/cloud/storage/StorageStats.java diff --git a/core/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java b/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java similarity index 61% rename from core/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java rename to api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java index d42c7f10cb7..a78db8d3ac4 100644 --- a/core/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java +++ b/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java @@ -26,40 +26,42 @@ import java.util.Date; public interface VMTemplateStorageResourceAssoc { public static enum Status {UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS} - public String getInstallPath(); + String getInstallPath(); - public long getTemplateId(); + long getTemplateId(); - public void setTemplateId(long templateId); + void setTemplateId(long templateId); - public int getDownloadPercent(); + int getDownloadPercent(); - public void setDownloadPercent(int downloadPercent); + void setDownloadPercent(int downloadPercent); - public void setDownloadState(Status downloadState); + void setDownloadState(Status downloadState); - public Long getId(); + long getId(); - public Date getCreated(); + Date getCreated(); - public Date getLastUpdated(); + Date getLastUpdated(); - public void setLastUpdated(Date date); + void setLastUpdated(Date date); - public void setInstallPath(String installPath); + void setInstallPath(String installPath); - public Status getDownloadState(); + Status getDownloadState(); - public void setLocalDownloadPath(String localPath); + void setLocalDownloadPath(String localPath); - public String getLocalDownloadPath(); + String getLocalDownloadPath(); - public void setErrorString(String errorString); + void setErrorString(String errorString); - public String getErrorString(); + String getErrorString(); - public void setJobId(String jobId); + void setJobId(String jobId); - public String getJobId();; + String getJobId();; + + long getTemplateSize(); } diff --git a/core/src/com/cloud/storage/VolumeStats.java b/api/src/com/cloud/storage/VolumeStats.java similarity index 100% rename from core/src/com/cloud/storage/VolumeStats.java rename to api/src/com/cloud/storage/VolumeStats.java diff --git a/api/src/com/cloud/template/VirtualMachineTemplate.java b/api/src/com/cloud/template/VirtualMachineTemplate.java index 6228f95ac3e..3a40f25f1fb 100755 --- a/api/src/com/cloud/template/VirtualMachineTemplate.java +++ b/api/src/com/cloud/template/VirtualMachineTemplate.java @@ -77,4 +77,10 @@ public interface VirtualMachineTemplate extends ControlledEntity { HypervisorType getHypervisorType(); int getBits(); + + String getUniqueName(); + + String getUrl(); + + String getChecksum(); } diff --git a/core/src/com/cloud/vm/VmStats.java b/api/src/com/cloud/vm/VmStats.java similarity index 100% rename from core/src/com/cloud/vm/VmStats.java rename to api/src/com/cloud/vm/VmStats.java diff --git a/core/.classpath b/core/.classpath index db9b9a922f1..f1a4de71803 100644 --- a/core/.classpath +++ b/core/.classpath @@ -38,6 +38,6 @@ - + diff --git a/core/src/com/cloud/agent/api/CheckOnVmAnswer.java b/core/src/com/cloud/agent/api/CheckOnVmAnswer.java deleted file mode 100644 index 84885962223..00000000000 --- a/core/src/com/cloud/agent/api/CheckOnVmAnswer.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api; - -public class CheckOnVmAnswer extends Answer { - boolean determined; - boolean alive; - - protected CheckOnVmAnswer() { - } - - public CheckOnVmAnswer(CheckOnVmCommand cmd, Boolean alive) { - this(cmd, alive, null); - } - - public CheckOnVmAnswer(CheckOnVmCommand cmd, Boolean alive, String details) { - super(cmd, true, details); - if (alive == null) { - determined = false; - } else { - determined = true; - this.alive = alive; - } - } - - public CheckOnVmAnswer(CheckOnVmCommand cmd, Exception e) { - super(cmd, e); - } - - public boolean isDetermined() { - return determined; - } - - public boolean isAlive() { - return alive; - } -} diff --git a/core/src/com/cloud/agent/api/CheckOnVmCommand.java b/core/src/com/cloud/agent/api/CheckOnVmCommand.java deleted file mode 100644 index 09275570aa0..00000000000 --- a/core/src/com/cloud/agent/api/CheckOnVmCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api; - -import com.cloud.host.HostVO; -import com.cloud.vm.VMInstanceVO; - -/** - * @author ahuang - * - */ -public class CheckOnVmCommand extends Command { - - protected CheckOnVmCommand() { - } - - public CheckOnVmCommand(VMInstanceVO vm, HostVO host) { - - } - - @Override - public boolean executeInSequence() { - return false; - } - -} diff --git a/core/src/com/cloud/agent/api/MirrorAnswer.java b/core/src/com/cloud/agent/api/MirrorAnswer.java deleted file mode 100644 index eb627ab6a82..00000000000 --- a/core/src/com/cloud/agent/api/MirrorAnswer.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api; - -import java.util.ArrayList; -import java.util.List; - -import com.cloud.storage.Volume; -import com.cloud.storage.VolumeVO; - - -/** - * @author chiradeep - * - */ -public class MirrorAnswer extends Answer { - public enum MirrorState { - NOT_MIRRORED, - ACTIVE, - DEGRADED, - FAILED - } - - public enum DiskState { - ACTIVE, - REBUILD, - FAILED - } - - public class MirrorInfo { - public Volume.VolumeType volType; - public VolumeVO vol1; - public VolumeVO vol2; - public DiskState disk1State; - public DiskState disk2State; - public MirrorState mirrorState; - public int rebuildPct; - } - - String vmName; - //List mirrorInfo = new ArrayList(); - String error; - - - protected MirrorAnswer() { - } - - - public MirrorAnswer(MirrorCommand cmd, String vmName, String err) { - super(cmd, false, err); - this.vmName = vmName; - } - - public MirrorAnswer(MirrorCommand cmd, String vmName){ - super(cmd, true, null); - this.vmName = vmName; - } - - public String getVmName() { - return vmName; - } - - - public void setVmName(String vmName) { - this.vmName = vmName; - } - - - -} diff --git a/core/src/com/cloud/agent/api/MirrorCommand.java b/core/src/com/cloud/agent/api/MirrorCommand.java deleted file mode 100644 index c7d10f4abe5..00000000000 --- a/core/src/com/cloud/agent/api/MirrorCommand.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -package com.cloud.agent.api; - -import java.util.List; - -import com.cloud.storage.VolumeVO; - -public class MirrorCommand extends Command { - - protected String vmName; - protected String removeHost; - protected String addHost; - protected List removeVols; - protected List addVols; - - - public MirrorCommand(String vmName, String removeHost, String addHost, - List removeVols, List addVols) { - super(); - this.vmName = vmName; - this.removeHost = removeHost; - this.addHost = addHost; - this.removeVols = removeVols; - this.addVols = addVols; - } - - protected MirrorCommand() { - //satisfies gson - } - - public String getVmName() { - return vmName; - } - - - public void setVmName(String vmName) { - this.vmName = vmName; - } - - - public String getRemoveHost() { - return removeHost; - } - - - public void setRemoveHost(String removeHost) { - this.removeHost = removeHost; - } - - - public String getAddHost() { - return addHost; - } - - - public void setAddHost(String addHost) { - this.addHost = addHost; - } - - - public List getRemoveVols() { - return removeVols; - } - - - public void setRemoveVols(List removeVols) { - this.removeVols = removeVols; - } - - - public List getAddVols() { - return addVols; - } - - - public void setAddVols(List addVols) { - this.addVols = addVols; - } - - - @Override - public boolean executeInSequence() { - return true; - } - - -} \ No newline at end of file diff --git a/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java b/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java deleted file mode 100644 index 09b4748ff91..00000000000 --- a/core/src/com/cloud/agent/api/PingRoutingWithNwGroupsCommand.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later -version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api; - -import java.util.HashMap; -import java.util.Map; - -import com.cloud.agent.transport.Request; -import com.cloud.host.Host; -import com.cloud.utils.Pair; -import com.cloud.vm.VirtualMachine.State; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - - -public class PingRoutingWithNwGroupsCommand extends PingRoutingCommand { - HashMap> newGroupStates; - - public static class NwGroupsCommandTypeAdaptor implements JsonDeserializer>, JsonSerializer> { - static final GsonBuilder s_gBuilder; - static { - s_gBuilder = Request.initBuilder(); - } - - public NwGroupsCommandTypeAdaptor() { - } - - @Override - public JsonElement serialize(Pair src, - java.lang.reflect.Type typeOfSrc, JsonSerializationContext context) { - JsonArray array = new JsonArray(); - Gson json = s_gBuilder.create(); - if(src.first() != null) { - array.add(json.toJsonTree(src.first())); - } else { - array.add(new JsonNull()); - } - - if (src.second() != null) { - array.add(json.toJsonTree(src.second())); - } else { - array.add(new JsonNull()); - } - - return array; - } - - @Override - public Pair deserialize(JsonElement json, - java.lang.reflect.Type type, JsonDeserializationContext context) - throws JsonParseException { - Pair pairs = new Pair(null, null); - JsonArray array = json.getAsJsonArray(); - if (array.size() != 2) { - return pairs; - } - JsonElement element = array.get(0); - if (!element.isJsonNull()) { - pairs.first(element.getAsLong()); - } - - element = array.get(1); - if (!element.isJsonNull()) { - pairs.second(element.getAsLong()); - } - - return pairs; - } - - } - protected PingRoutingWithNwGroupsCommand() { - super(); - } - - public PingRoutingWithNwGroupsCommand(Host.Type type, long id, Map states, HashMap> nwGrpStates) { - super(type, id, states); - newGroupStates = nwGrpStates; - } - - public HashMap> getNewGroupStates() { - return newGroupStates; - } - - public void setNewGroupStates(HashMap> newGroupStates) { - this.newGroupStates = newGroupStates; - } -} diff --git a/core/src/com/cloud/agent/api/routing/LoadBalancerCfgCommand.java b/core/src/com/cloud/agent/api/routing/LoadBalancerCfgCommand.java deleted file mode 100644 index 3190e2a35d8..00000000000 --- a/core/src/com/cloud/agent/api/routing/LoadBalancerCfgCommand.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api.routing; - -import com.cloud.network.LoadBalancerConfigurator; - -/** - * @author chiradeep - * - */ -public class LoadBalancerCfgCommand extends NetworkElementCommand { - private String [] config; - private String [] addFwRules; - private String [] removeFwRules;; - private String routerName; - private String routerIp; - - //no-args to satisfy gson - protected LoadBalancerCfgCommand() { - - } - - public LoadBalancerCfgCommand(String[] config, String[][] addRemoveRules, String routerName, String routerIp) { - super(); - this.config = config; - this.addFwRules = addRemoveRules[LoadBalancerConfigurator.ADD]; - this.removeFwRules = addRemoveRules[LoadBalancerConfigurator.REMOVE]; - this.routerName = routerName; - this.routerIp = routerIp; - } - - public String getRouterName() { - return routerName; - } - - public String getRouterIp() { - return routerIp; - } - - public String[] getConfig() { - return config; - } - - public void setConfig(String[] config) { - this.config = config; - } - - public String[] getAddFwRules() { - return addFwRules; - } - - public String[] getRemoveFwRules() { - return removeFwRules; - } - - @Override - public boolean executeInSequence() { - return false; - } - -} diff --git a/core/src/com/cloud/agent/api/storage/ShareAnswer.java b/core/src/com/cloud/agent/api/storage/ShareAnswer.java deleted file mode 100644 index 1ddbdd33505..00000000000 --- a/core/src/com/cloud/agent/api/storage/ShareAnswer.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api.storage; - -import java.util.Map; - -import com.cloud.agent.api.Answer; - -public class ShareAnswer extends Answer { - - protected ShareAnswer() { - } - - Map mapping; - - public ShareAnswer(ShareCommand cmd, Map mapping) { - super(cmd, true, null); - this.mapping = mapping; - } - - public ShareAnswer(ShareCommand cmd, String details) { - super(cmd, false, details); - } - - public Map getMappings() { - return mapping; - } - -} diff --git a/core/src/com/cloud/agent/api/storage/ShareCommand.java b/core/src/com/cloud/agent/api/storage/ShareCommand.java deleted file mode 100644 index 09ad9957594..00000000000 --- a/core/src/com/cloud/agent/api/storage/ShareCommand.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.agent.api.storage; - -import java.util.List; - -import com.cloud.storage.VolumeVO; - -public class ShareCommand extends StorageCommand { - public static String UnshareAll = "unshare_all"; - - private boolean share; - private boolean removePreviousShare; - private List volumes; - private String vmName; - private String initiatorIqn; - - protected ShareCommand() { - } - - public ShareCommand(String vmName, List vols, String initiatorIqn, boolean removePreviousShare) { - super(); - this.vmName = vmName; - this.initiatorIqn = initiatorIqn; - this.share = true; - this.volumes = vols; - this.removePreviousShare = removePreviousShare; - } - - public ShareCommand(String vmName, List vols, String initiatorIqn) { - super(); - this.vmName = vmName; - this.initiatorIqn = initiatorIqn; - this.share = false; - this.volumes = vols; - this.removePreviousShare = true; - } - - public ShareCommand(String vmName, List vols) { - super(); - this.vmName = vmName; - this.initiatorIqn = UnshareAll; - this.share = false; - this.volumes = vols; - this.removePreviousShare = true; - } - - // NOTE: We set this to false because we leave it up to the business logic - // to make sure it is already created before calling shared. - @Override - public boolean executeInSequence() { - return false; - } - - public boolean isShare() { - return share; - } - - public List getVolumes() { - return volumes; - } - - public String getVmName() { - return vmName; - } - - public String getInitiatorIqn() { - return initiatorIqn; - } - - public boolean removePreviousShare() { - return removePreviousShare; - } -} diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java index c1357c1385d..393198c0fe7 100755 --- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java +++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java @@ -47,9 +47,8 @@ import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand; import com.cloud.agent.api.routing.DhcpEntryCommand; import com.cloud.agent.api.routing.IPAssocCommand; import com.cloud.agent.api.routing.IpAssocAnswer; -import com.cloud.agent.api.routing.LoadBalancerCfgCommand; -import com.cloud.agent.api.routing.NetworkElementCommand; import com.cloud.agent.api.routing.LoadBalancerConfigCommand; +import com.cloud.agent.api.routing.NetworkElementCommand; import com.cloud.agent.api.routing.SavePasswordCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer; import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; @@ -98,8 +97,6 @@ public class VirtualRoutingResource implements Manager { try { if (cmd instanceof SetPortForwardingRulesCommand ) { return execute((SetPortForwardingRulesCommand)cmd); - }else if (cmd instanceof LoadBalancerCfgCommand) { - return execute((LoadBalancerCfgCommand)cmd); } else if (cmd instanceof LoadBalancerConfigCommand) { return execute((LoadBalancerConfigCommand)cmd); } else if (cmd instanceof IPAssocCommand) { @@ -239,39 +236,6 @@ public class VirtualRoutingResource implements Manager { return new Answer(cmd); } - protected Answer execute(final LoadBalancerCfgCommand cmd) { - - File tmpCfgFile = null; - try { - String cfgFilePath = ""; - String routerIP = null; - - if (cmd.getRouterIp() != null) { - tmpCfgFile = File.createTempFile(cmd.getRouterIp().replace('.', '_'), "cfg"); - final PrintWriter out - = new PrintWriter(new BufferedWriter(new FileWriter(tmpCfgFile))); - for (int i=0; i < cmd.getConfig().length; i++) { - out.println(cmd.getConfig()[i]); - } - out.close(); - cfgFilePath = tmpCfgFile.getAbsolutePath(); - routerIP = cmd.getRouterIp(); - } - - final String result = setLoadBalancerConfig(cfgFilePath, - cmd.getAddFwRules(), cmd.getRemoveFwRules(), - routerIP); - - return new Answer(cmd, result == null, result); - } catch (final IOException e) { - return new Answer(cmd, false, e.getMessage()); - } finally { - if (tmpCfgFile != null) { - tmpCfgFile.delete(); - } - } - } - protected Answer execute(final IPAssocCommand cmd) { IpAddressTO[] ips = cmd.getIpAddresses(); String[] results = new String[cmd.getIpAddresses().length]; diff --git a/core/src/com/cloud/agent/transport/Request.java b/core/src/com/cloud/agent/transport/Request.java index c8a3e22ad73..298eeed1107 100755 --- a/core/src/com/cloud/agent/transport/Request.java +++ b/core/src/com/cloud/agent/transport/Request.java @@ -19,14 +19,14 @@ package com.cloud.agent.transport; import java.lang.reflect.Type; import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import org.apache.log4j.Logger; import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; -import com.cloud.agent.api.PingRoutingWithNwGroupsCommand; -import com.cloud.agent.api.SecStorageFirewallCfgCommand; import com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig; import com.cloud.exception.UnsupportedVersionException; import com.cloud.storage.VolumeVO; @@ -35,6 +35,14 @@ import com.cloud.utils.Pair; import com.cloud.utils.exception.CloudRuntimeException; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; import com.google.gson.reflect.TypeToken; /** @@ -64,8 +72,9 @@ public class Request { public static Version get(final byte ver) throws UnsupportedVersionException { for (final Version version : Version.values()) { - if (ver == version.ordinal()) + if (ver == version.ordinal()) { return version; + } } throw new UnsupportedVersionException("Can't lookup version: " + ver, UnsupportedVersionException.UnknownVersion); } @@ -86,8 +95,8 @@ public class Request { s_gBuilder.registerTypeAdapter(Answer[].class, new ArrayTypeAdaptor()); final Type listType = new TypeToken>() {}.getType(); s_gBuilder.registerTypeAdapter(listType, new VolListTypeAdaptor()); - s_gBuilder.registerTypeAdapter(new TypeToken>() {}.getType(), new SecStorageFirewallCfgCommand.PortConfigListTypeAdaptor()); - s_gBuilder.registerTypeAdapter(new TypeToken>() {}.getType(), new PingRoutingWithNwGroupsCommand.NwGroupsCommandTypeAdaptor()); + s_gBuilder.registerTypeAdapter(new TypeToken>() {}.getType(), new PortConfigListTypeAdaptor()); + s_gBuilder.registerTypeAdapter(new TypeToken>() {}.getType(), new NwGroupsCommandTypeAdaptor()); s_logger.info("Builder inited."); } @@ -368,4 +377,103 @@ public class Request { public static boolean isControl(final byte[] bytes) { return (bytes[3] & FLAG_CONTROL) > 0; } + + public static class NwGroupsCommandTypeAdaptor implements JsonDeserializer>, JsonSerializer> { + static final GsonBuilder s_gBuilder; + static { + s_gBuilder = Request.initBuilder(); + } + + public NwGroupsCommandTypeAdaptor() { + } + + @Override + public JsonElement serialize(Pair src, + java.lang.reflect.Type typeOfSrc, JsonSerializationContext context) { + JsonArray array = new JsonArray(); + Gson json = s_gBuilder.create(); + if(src.first() != null) { + array.add(json.toJsonTree(src.first())); + } else { + array.add(new JsonNull()); + } + + if (src.second() != null) { + array.add(json.toJsonTree(src.second())); + } else { + array.add(new JsonNull()); + } + + return array; + } + + @Override + public Pair deserialize(JsonElement json, + java.lang.reflect.Type type, JsonDeserializationContext context) + throws JsonParseException { + Pair pairs = new Pair(null, null); + JsonArray array = json.getAsJsonArray(); + if (array.size() != 2) { + return pairs; + } + JsonElement element = array.get(0); + if (!element.isJsonNull()) { + pairs.first(element.getAsLong()); + } + + element = array.get(1); + if (!element.isJsonNull()) { + pairs.second(element.getAsLong()); + } + + return pairs; + } + + } + + public static class PortConfigListTypeAdaptor implements JsonDeserializer>, JsonSerializer> { + static final GsonBuilder s_gBuilder; + static { + s_gBuilder = Request.initBuilder(); + } + + static final Type listType = new TypeToken>() {}.getType(); + + public PortConfigListTypeAdaptor() { + } + + @Override + public JsonElement serialize(List src, Type typeOfSrc, JsonSerializationContext context) { + if (src.size() == 0) { + s_logger.info("Returning JsonNull"); + return new JsonNull(); + } + Gson json = s_gBuilder.create(); + s_logger.debug("Returning gson tree"); + JsonArray array = new JsonArray(); + for (PortConfig pc : src) { + array.add(json.toJsonTree(pc)); + } + + return array; + } + + @Override + public List deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { + if (json.isJsonNull()) { + return new ArrayList(); + } + Gson jsonp = s_gBuilder.create(); + List pcs = new ArrayList(); + JsonArray array = json.getAsJsonArray(); + Iterator it = array.iterator(); + while (it.hasNext()) { + JsonElement element = it.next(); + pcs.add(jsonp.fromJson(element, PortConfig.class)); + } + return pcs; + } + + } } diff --git a/core/src/com/cloud/host/HostVO.java b/core/src/com/cloud/host/HostVO.java index 53f0c6c5b7b..af1bea360a1 100644 --- a/core/src/com/cloud/host/HostVO.java +++ b/core/src/com/cloud/host/HostVO.java @@ -38,6 +38,7 @@ import javax.persistence.Transient; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.utils.NumbersUtil; import com.cloud.utils.db.GenericDao; @Entity @@ -48,7 +49,7 @@ public class HostVO implements Host { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") - private Long id; + private long id; @Column(name="disconnected") @Temporal(value=TemporalType.TIMESTAMP) @@ -144,7 +145,8 @@ public class HostVO implements Host { return storageNetmaskDeux; } - public Long getClusterId() { + @Override + public Long getClusterId() { return clusterId; } @@ -331,7 +333,7 @@ public class HostVO implements Host { protected HostVO() { } - public HostVO(Long id, + public HostVO(long id, String name, Type type, String privateIpAddress, @@ -364,7 +366,7 @@ public class HostVO implements Host { this.fsType = fsType; } - public HostVO(Long id, + public HostVO(long id, String name, Type type, String privateIpAddress, @@ -486,6 +488,7 @@ public class HostVO implements Host { this.managementServerId = managementServerId; } + @Override public long getLastPinged() { return lastPinged; } @@ -495,10 +498,12 @@ public class HostVO implements Host { return parent; } + @Override public long getTotalSize() { return totalSize; } + @Override public String getCapabilities() { return caps; } @@ -508,10 +513,12 @@ public class HostVO implements Host { return created; } + @Override public Date getRemoved() { return removed; } + @Override public String getVersion() { return version; } @@ -520,7 +527,8 @@ public class HostVO implements Host { this.type = type; } - public Long getId() { + @Override + public long getId() { return id; } @@ -544,10 +552,12 @@ public class HostVO implements Host { return podId; } + @Override public Long getManagementServerId() { return managementServerId; } + @Override public Date getDisconnectedOn() { return disconnectedOn; } @@ -566,6 +576,7 @@ public class HostVO implements Host { this.guid = guid; } + @Override public Integer getCpus() { return cpus; } @@ -600,7 +611,7 @@ public class HostVO implements Host { @Override public int hashCode() { - return id != null ? id.hashCode() : -1; + return NumbersUtil.hash(id); } @Override @@ -614,7 +625,7 @@ public class HostVO implements Host { @Override public String toString() { - return new StringBuilder(type.toString()).append("-").append(Long.toString(id)).append("-").append(name).toString(); + return new StringBuilder(type.toString()).append("-").append(id).append("-").append(name).toString(); } public void setHypervisorType(HypervisorType hypervisorType) { diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index bff6a33059a..d52a901fb1d 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -126,7 +126,6 @@ import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand; import com.cloud.agent.api.routing.DhcpEntryCommand; import com.cloud.agent.api.routing.IPAssocCommand; import com.cloud.agent.api.routing.IpAssocAnswer; -import com.cloud.agent.api.routing.LoadBalancerCfgCommand; import com.cloud.agent.api.routing.LoadBalancerConfigCommand; import com.cloud.agent.api.routing.NetworkElementCommand; import com.cloud.agent.api.routing.RemoteAccessVpnCfgCommand; @@ -143,8 +142,6 @@ import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; -import com.cloud.agent.api.storage.ShareAnswer; -import com.cloud.agent.api.storage.ShareCommand; import com.cloud.agent.api.to.IpAddressTO; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.PortForwardingRuleTO; @@ -170,7 +167,6 @@ import com.cloud.resource.ServerResource; import com.cloud.storage.Storage; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.StoragePoolType; -import com.cloud.storage.StoragePoolVO; import com.cloud.storage.Volume; import com.cloud.storage.Volume.VolumeType; import com.cloud.storage.VolumeVO; @@ -349,8 +345,6 @@ public abstract class CitrixResourceBase implements ServerResource { return execute((CreateCommand) cmd); } else if (cmd instanceof SetPortForwardingRulesCommand) { return execute((SetPortForwardingRulesCommand) cmd); - } else if (cmd instanceof LoadBalancerCfgCommand) { - return execute((LoadBalancerCfgCommand) cmd); } else if (cmd instanceof LoadBalancerConfigCommand) { return execute((LoadBalancerConfigCommand) cmd); } else if (cmd instanceof IPAssocCommand) { @@ -387,8 +381,6 @@ public abstract class CitrixResourceBase implements ServerResource { return execute((MigrateCommand) cmd); } else if (cmd instanceof DestroyCommand) { return execute((DestroyCommand) cmd); - } else if (cmd instanceof ShareCommand) { - return execute((ShareCommand) cmd); } else if (cmd instanceof ModifyStoragePoolCommand) { return execute((ModifyStoragePoolCommand) cmd); } else if (cmd instanceof DeleteStoragePoolCommand) { @@ -1094,63 +1086,6 @@ public abstract class CitrixResourceBase implements ServerResource { return new SetPortForwardingRulesAnswer(cmd, results); } - protected Answer execute(final LoadBalancerCfgCommand cmd) { - Connection conn = getConnection(); - String routerIp = cmd.getRouterIp(); - - if (routerIp == null) { - return new Answer(cmd); - } - - String tmpCfgFilePath = "/tmp/" + cmd.getRouterIp().replace('.', '_') + ".cfg"; - String tmpCfgFileContents = ""; - for (int i = 0; i < cmd.getConfig().length; i++) { - tmpCfgFileContents += cmd.getConfig()[i]; - tmpCfgFileContents += "\n"; - } - - String result = callHostPlugin(conn, "vmops", "createFile", "filepath", tmpCfgFilePath, "filecontents", tmpCfgFileContents); - - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "LoadBalancerCfgCommand failed to create HA proxy cfg file."); - } - - String[] addRules = cmd.getAddFwRules(); - String[] removeRules = cmd.getRemoveFwRules(); - - String args = ""; - args += "-i " + routerIp; - args += " -f " + tmpCfgFilePath; - - StringBuilder sb = new StringBuilder(); - if (addRules.length > 0) { - for (int i = 0; i < addRules.length; i++) { - sb.append(addRules[i]).append(','); - } - - args += " -a " + sb.toString(); - } - - sb = new StringBuilder(); - if (removeRules.length > 0) { - for (int i = 0; i < removeRules.length; i++) { - sb.append(removeRules[i]).append(','); - } - - args += " -d " + sb.toString(); - } - - result = callHostPlugin(conn, "vmops", "setLoadBalancerRule", "args", args); - - if (result == null || result.isEmpty()) { - return new Answer(cmd, false, "LoadBalancerCfgCommand failed"); - } - - callHostPlugin(conn, "vmops", "deleteFile", "filepath", tmpCfgFilePath); - - return new Answer(cmd); - } - protected Answer execute(final LoadBalancerConfigCommand cmd) { Connection conn = getConnection(); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); @@ -3983,15 +3918,14 @@ public abstract class CitrixResourceBase implements ServerResource { protected Answer execute(DeleteStoragePoolCommand cmd) { Connection conn = getConnection(); - StoragePoolVO pool = cmd.getPool(); - StorageFilerTO poolTO = new StorageFilerTO(pool); + StorageFilerTO poolTO = cmd.getPool(); try { SR sr = getStorageRepository(conn, poolTO); removeSR(conn, sr); Answer answer = new Answer(cmd, true, "success"); return answer; } catch (Exception e) { - String msg = "DeleteStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + _host.uuid + " pool: " + pool.getName() + pool.getHostAddress() + pool.getPath(); + String msg = "DeleteStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + _host.uuid + " pool: " + poolTO.getHost() + poolTO.getPath(); s_logger.warn(msg, e); return new Answer(cmd, false, msg); } @@ -4553,30 +4487,10 @@ public abstract class CitrixResourceBase implements ServerResource { return new Answer(cmd, true, "Success"); } - public ShareAnswer execute(final ShareCommand cmd) { - Connection conn = getConnection(); - if (!cmd.isShare()) { - SR sr = getISOSRbyVmName(conn, cmd.getVmName()); - try { - if (sr != null) { - Set vms = VM.getByNameLabel(conn, cmd.getVmName()); - if (vms.size() == 0) { - removeSR(conn, sr); - } - } - } catch (Exception e) { - String msg = "SR.getNameLabel failed due to " + e.getMessage() + e.toString(); - s_logger.warn(msg); - } - } - return new ShareAnswer(cmd, new HashMap()); - } - public CopyVolumeAnswer execute(final CopyVolumeCommand cmd) { Connection conn = getConnection(); String volumeUUID = cmd.getVolumePath(); - StoragePoolVO pool = cmd.getPool(); - StorageFilerTO poolTO = new StorageFilerTO(pool); + StorageFilerTO poolTO = cmd.getPool(); String secondaryStorageURL = cmd.getSecondaryStorageURL(); URI uri = null; diff --git a/core/src/com/cloud/network/NetworkEnums.java b/core/src/com/cloud/network/NetworkEnums.java deleted file mode 100644 index 100507d30f8..00000000000 --- a/core/src/com/cloud/network/NetworkEnums.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.network; - -/** - * @author chiradeep - * - */ -public class NetworkEnums { - public enum RouterPrivateIpStrategy { - None, - DcGlobal, //global to data center - HostLocal; - - public static String DummyPrivateIp = "169.254.1.1"; - } -} diff --git a/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java b/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java index 3044e716286..cd4894624d9 100644 --- a/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java +++ b/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java @@ -18,19 +18,19 @@ package com.cloud.storage; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + import com.cloud.utils.db.GenericDaoBase; /** @@ -43,7 +43,7 @@ import com.cloud.utils.db.GenericDaoBase; public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc{ @Id @GeneratedValue(strategy=GenerationType.IDENTITY) - Long id; + long id; @Column(name="pool_id") private long poolId; @@ -72,11 +72,13 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc{ @Column (name="marked_for_gc") boolean markedForGC; - public String getInstallPath() { + @Override + public String getInstallPath() { return installPath; } - public long getTemplateSize() { + @Override + public long getTemplateSize() { return templateSize; } @@ -88,47 +90,58 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc{ this.poolId = poolId; } - public long getTemplateId() { + @Override + public long getTemplateId() { return templateId; } - public void setTemplateId(long templateId) { + @Override + public void setTemplateId(long templateId) { this.templateId = templateId; } - public int getDownloadPercent() { + @Override + public int getDownloadPercent() { return downloadPercent; } - public void setDownloadPercent(int downloadPercent) { + @Override + public void setDownloadPercent(int downloadPercent) { this.downloadPercent = downloadPercent; } - public void setDownloadState(Status downloadState) { + @Override + public void setDownloadState(Status downloadState) { this.downloadState = downloadState; } - public Long getId() { + @Override + public long getId() { return id; } - public Date getCreated() { + @Override + public Date getCreated() { return created; } - public Date getLastUpdated() { + @Override + public Date getLastUpdated() { return lastUpdated; } - public void setLastUpdated(Date date) { + @Override + public void setLastUpdated(Date date) { lastUpdated = date; } - public void setInstallPath(String installPath) { + @Override + public void setInstallPath(String installPath) { this.installPath = installPath; } - public Status getDownloadState() { + @Override + public Status getDownloadState() { return downloadState; } @@ -161,27 +174,33 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc{ } - public void setLocalDownloadPath(String localPath) { + @Override + public void setLocalDownloadPath(String localPath) { this.localDownloadPath = localPath; } - public String getLocalDownloadPath() { + @Override + public String getLocalDownloadPath() { return localDownloadPath; } - public void setErrorString(String errorString) { + @Override + public void setErrorString(String errorString) { this.errorString = errorString; } - public String getErrorString() { + @Override + public String getErrorString() { return errorString; } - public void setJobId(String jobId) { + @Override + public void setJobId(String jobId) { this.jobId = jobId; } - public String getJobId() { + @Override + public String getJobId() { return jobId; } diff --git a/core/src/com/cloud/storage/resource/StoragePoolResource.java b/core/src/com/cloud/storage/resource/StoragePoolResource.java index 7178607b113..9979b787217 100644 --- a/core/src/com/cloud/storage/resource/StoragePoolResource.java +++ b/core/src/com/cloud/storage/resource/StoragePoolResource.java @@ -23,10 +23,8 @@ import com.cloud.agent.api.storage.CopyVolumeCommand; import com.cloud.agent.api.storage.CreateAnswer; import com.cloud.agent.api.storage.CreateCommand; import com.cloud.agent.api.storage.DestroyCommand; -import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; -import com.cloud.agent.api.storage.ShareAnswer; -import com.cloud.agent.api.storage.ShareCommand; +import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; public interface StoragePoolResource { // FIXME: Should have a PrimaryStorageDownloadAnswer @@ -35,8 +33,6 @@ public interface StoragePoolResource { // FIXME: Should have an DestroyAnswer Answer execute(DestroyCommand cmd); - ShareAnswer execute(ShareCommand cmd); - CopyVolumeAnswer execute(CopyVolumeCommand cmd); CreateAnswer execute(CreateCommand cmd); diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index 25e4f145e6b..3c16644796e 100755 --- a/server/src/com/cloud/server/StatsCollector.java +++ b/server/src/com/cloud/server/StatsCollector.java @@ -157,22 +157,15 @@ public class StatsCollector { List hosts = _hostDao.search(sc, null); for (HostVO host : hosts) { - if (host.getId() != null) - { - HostStatsEntry stats = (HostStatsEntry) _agentMgr.getHostStatistics(host.getId()); - if (stats != null) - { - hostStats.put(host.getId(), stats); - } - else - { - s_logger.warn("Received invalid host stats for host: " + host.getId()); - } - } - else - { - s_logger.warn("Host: " + host.getId() + " does not exist, skipping host statistics"); - } + HostStatsEntry stats = (HostStatsEntry) _agentMgr.getHostStatistics(host.getId()); + if (stats != null) + { + hostStats.put(host.getId(), stats); + } + else + { + s_logger.warn("Received invalid host stats for host: " + host.getId()); + } } _hostStats = hostStats; } diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java index 68bb36cf168..b02aec8bf33 100755 --- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java +++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java @@ -154,7 +154,7 @@ public class UploadMonitorImpl implements UploadMonitor { if(vmTemplateHost != null) { start(); - UploadCommand ucmd = new UploadCommand(template, url, vmTemplateHost); + UploadCommand ucmd = new UploadCommand(template, url, vmTemplateHost.getInstallPath(), vmTemplateHost.getSize()); UploadListener ul = new UploadListener(sserver, _timer, _uploadDao, uploadTemplateObj, this, ucmd, template.getAccountId(), template.getName(), type, eventId, asyncJobId, asyncMgr); _listenerMap.put(uploadTemplateObj, ul);