cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [1/4] git commit: updated refs/heads/master to 638f1cf
Date Sun, 06 Dec 2015 19:17:23 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master afe113092 -> 638f1cf09


CLOUDSTACK-9047 use 'State's only with context
  there are more types called 'State'
  (or to be called so but now 'state')
  So remove imports and prepend their enclosing class/context to them.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/586c3251
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/586c3251
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/586c3251

Branch: refs/heads/master
Commit: 586c325167347eb1a2e7debb66d9b610b18807c5
Parents: ea7c2d9
Author: Daan Hoogland <daan@onecht.net>
Authored: Mon Nov 9 10:42:23 2015 +0100
Committer: Daan Hoogland <daan@onecht.net>
Committed: Mon Nov 16 13:41:12 2015 +0000

----------------------------------------------------------------------
 .../orchestration/NetworkOrchestrator.java      |  3 +-
 .../network/router/CommandSetupHelper.java      |  5 +--
 .../VirtualNetworkApplianceManagerImpl.java     | 45 ++++++++++----------
 3 files changed, 25 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/586c3251/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index e60e346..f2c6fc3 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -97,7 +97,6 @@ import com.cloud.host.Status;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.network.IpAddress;
-import com.cloud.network.IpAddress.State;
 import com.cloud.network.IpAddressManager;
 import com.cloud.network.Network;
 import com.cloud.network.Network.Capability;
@@ -2921,7 +2920,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         List<PublicIp> publicIpsToRelease = new ArrayList<PublicIp>();
         if (userIps != null && !userIps.isEmpty()) {
             for (IPAddressVO userIp : userIps) {
-                userIp.setState(State.Releasing);
+                userIp.setState(IpAddress.State.Releasing);
                 PublicIp publicIp = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId()));
                 publicIpsToRelease.add(publicIp);
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/586c3251/server/src/com/cloud/network/router/CommandSetupHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/CommandSetupHelper.java b/server/src/com/cloud/network/router/CommandSetupHelper.java
index 1818dbd..67c52e3 100644
--- a/server/src/com/cloud/network/router/CommandSetupHelper.java
+++ b/server/src/com/cloud/network/router/CommandSetupHelper.java
@@ -122,7 +122,6 @@ import com.cloud.vm.NicProfile;
 import com.cloud.vm.NicVO;
 import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineManager;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.dao.DomainRouterDao;
@@ -598,7 +597,7 @@ public class CommandSetupHelper {
     }
 
     public void createVmDataCommandForVMs(final DomainRouterVO router, final Commands cmds,
final long guestNetworkId) {
-        final List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId,
State.Running, State.Migrating, State.Stopping);
+        final List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId,
VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping);
         final DataCenterVO dc = _dcDao.findById(router.getDataCenterId());
         for (final UserVmVO vm : vms) {
             boolean createVmData = true;
@@ -617,7 +616,7 @@ public class CommandSetupHelper {
     }
 
     public void createDhcpEntryCommandsForVMs(final DomainRouterVO router, final Commands
cmds, final long guestNetworkId) {
-        final List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId,
State.Running, State.Migrating, State.Stopping);
+        final List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId,
VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping);
         final DataCenterVO dc = _dcDao.findById(router.getDataCenterId());
         for (final UserVmVO vm : vms) {
             boolean createDhcp = true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/586c3251/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index f0e5f09..d291936 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -232,7 +232,6 @@ import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.ReservationContextImpl;
 import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineGuru;
 import com.cloud.vm.VirtualMachineManager;
 import com.cloud.vm.VirtualMachineProfile;
@@ -251,7 +250,7 @@ import com.cloud.vm.dao.VMInstanceDao;
  */
 @Local(value = { VirtualNetworkApplianceManager.class, VirtualNetworkApplianceService.class
})
 public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements VirtualNetworkApplianceManager,
VirtualNetworkApplianceService, VirtualMachineGuru, Listener,
-Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
+Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualMachine>
{
     private static final Logger s_logger = Logger.getLogger(VirtualNetworkApplianceManagerImpl.class);
 
     @Inject
@@ -444,7 +443,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         }
 
         // Check that the router is stopped
-        if (!router.getState().equals(State.Stopped)) {
+        if (!router.getState().equals(VirtualMachine.State.Stopped)) {
             s_logger.warn("Unable to upgrade router " + router.toString() + " in state "
+ router.getState());
             throw new InvalidParameterValueException("Unable to upgrade router " + router.toString()
+ " in state " + router.getState()
                     + "; make sure the router is stopped and not in an error state before
upgrading.");
@@ -544,7 +543,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         _accountMgr.checkAccess(caller, null, true, router);
 
         // Can reboot domain router only in Running state
-        if (router == null || router.getState() != State.Running) {
+        if (router == null || router.getState() != VirtualMachine.State.Running) {
             s_logger.warn("Unable to reboot, virtual router is not in the right state " +
router.getState());
             throw new ResourceUnavailableException("Unable to reboot domR, it is not in right
state " + router.getState(), DataCenter.class, router.getDataCenterId());
         }
@@ -746,7 +745,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         @Override
         protected void runInContext() {
             try {
-                final List<DomainRouterVO> routers = _routerDao.listByStateAndNetworkType(State.Running,
GuestType.Isolated, mgmtSrvrId);
+                final List<DomainRouterVO> routers = _routerDao.listByStateAndNetworkType(VirtualMachine.State.Running,
GuestType.Isolated, mgmtSrvrId);
                 s_logger.debug("Found " + routers.size() + " running routers. ");
 
                 for (final DomainRouterVO router : routers) {
@@ -910,7 +909,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
             if (conns == null || conns.isEmpty()) {
                 continue;
             }
-            if (router.getState() != State.Running) {
+            if (router.getState() != VirtualMachine.State.Running) {
                 for (final Site2SiteVpnConnectionVO conn : conns) {
                     if (conn.getState() != Site2SiteVpnConnection.State.Error) {
                         conn.setState(Site2SiteVpnConnection.State.Disconnected);
@@ -991,7 +990,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
                 continue;
             }
             final RedundantState prevState = router.getRedundantState();
-            if (router.getState() != State.Running) {
+            if (router.getState() != VirtualMachine.State.Running) {
                 router.setRedundantState(RedundantState.UNKNOWN);
                 updated = true;
             } else {
@@ -1041,7 +1040,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
     // Ensure router status is update to date before execute this function. The
     // function would try best to recover all routers except MASTER
     protected void recoverRedundantNetwork(final DomainRouterVO masterRouter, final DomainRouterVO
backupRouter) {
-        if (masterRouter.getState() == State.Running && backupRouter.getState() ==
State.Running) {
+        if (masterRouter.getState() == VirtualMachine.State.Running && backupRouter.getState()
== VirtualMachine.State.Running) {
             final HostVO masterHost = _hostDao.findById(masterRouter.getHostId());
             final HostVO backupHost = _hostDao.findById(backupRouter.getHostId());
             if (masterHost.getState() == Status.Up && backupHost.getState() == Status.Up)
{
@@ -1174,7 +1173,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
                     final DomainRouterVO router0 = routers.get(0);
                     final DomainRouterVO router1 = routers.get(1);
 
-                    if (router0.getState() != State.Running || router1.getState() != State.Running)
{
+                    if (router0.getState() != VirtualMachine.State.Running || router1.getState()
!= VirtualMachine.State.Running) {
                         updateRoutersRedundantState(routers);
                         // Wilder Rodrigues (wrodrigues@schubergphilis.com) - One of the
routers is not running,
                         // so we don't have to continue here since the host will be null
any way. Also, there is no need
@@ -1188,8 +1187,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
                     } else {
                         router = router1;
                     }
-                    // && router.getState() == State.Stopped
-                    if (router.getHostId() == null && router.getState() == State.Running)
{
+                    // && router.getState() == VirtualMachine.State.Stopped
+                    if (router.getHostId() == null && router.getState() == VirtualMachine.State.Running)
{
                         s_logger.debug("Skip router pair (" + router0.getInstanceName() +
"," + router1.getInstanceName() + ") due to can't find host");
                         continue;
                     }
@@ -1259,7 +1258,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
 
     protected void getRouterAlerts() {
         try {
-            final List<DomainRouterVO> routers = _routerDao.listByStateAndManagementServer(State.Running,
mgmtSrvrId);
+            final List<DomainRouterVO> routers = _routerDao.listByStateAndManagementServer(VirtualMachine.State.Running,
mgmtSrvrId);
 
             s_logger.debug("Found " + routers.size() + " running routers. ");
 
@@ -2148,7 +2147,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         }
 
         for (final VirtualRouter router : routers) {
-            if (router.getState() != State.Running) {
+            if (router.getState() != VirtualMachine.State.Running) {
                 s_logger.warn("Failed to start remote access VPN: router not in right state
" + router.getState());
                 throw new ResourceUnavailableException("Failed to start remote access VPN:
router not in right state " + router.getState(), DataCenter.class,
                         network.getDataCenterId());
@@ -2189,11 +2188,11 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
 
         boolean result = true;
         for (final VirtualRouter router : routers) {
-            if (router.getState() == State.Running) {
+            if (router.getState() == VirtualMachine.State.Running) {
                 final Commands cmds = new Commands(Command.OnError.Continue);
                 _commandSetupHelper.createApplyVpnCommands(false, vpn, router, cmds);
                 result = result && _nwHelper.sendCommandsToRouter(router, cmds);
-            } else if (router.getState() == State.Stopped) {
+            } else if (router.getState() == VirtualMachine.State.Stopped) {
                 s_logger.debug("Router " + router + " is in Stopped state, not sending deleteRemoteAccessVpn
command to it");
                 continue;
             } else {
@@ -2226,7 +2225,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         }
 
         for (final DomainRouterVO router : routers) {
-            if (router.getState() != State.Running) {
+            if (router.getState() != VirtualMachine.State.Running) {
                 s_logger.warn("Failed to add/remove VPN users: router not in running state");
                 throw new ResourceUnavailableException("Unable to assign ip addresses, domR
is not in right state " + router.getState(), DataCenter.class,
                         network.getDataCenterId());
@@ -2306,7 +2305,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
 
         // After start network, check if it's already running
         router = _routerDao.findById(routerId);
-        if (router.getState() == State.Running) {
+        if (router.getState() == VirtualMachine.State.Running) {
             return router;
         }
 
@@ -2365,8 +2364,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         for (DomainRouterVO router : routers) {
             if (router.isStopPending()) {
                 s_logger.info("Stopping router " + router.getInstanceName() + " due to stop
pending flag found!");
-                final State state = router.getState();
-                if (state != State.Stopped && state != State.Destroyed) {
+                final VirtualMachine.State state = router.getState();
+                if (state != VirtualMachine.State.Stopped && state != VirtualMachine.State.Destroyed)
{
                     try {
                         stopRouter(router.getId(), false);
                     } catch (final ResourceUnavailableException e) {
@@ -2598,18 +2597,18 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
     }
 
     @Override
-    public boolean preStateTransitionEvent(final State oldState, final VirtualMachine.Event
event, final State newState, final VirtualMachine vo, final boolean status,
+    public boolean preStateTransitionEvent(final VirtualMachine.State oldState, final VirtualMachine.Event
event, final VirtualMachine.State newState, final VirtualMachine vo, final boolean status,
             final Object opaque) {
         return true;
     }
 
     @Override
-    public boolean postStateTransitionEvent(final StateMachine2.Transition<State, VirtualMachine.Event>
transition, final VirtualMachine vo, final boolean status, final Object opaque) {
-        final State newState = transition.getToState();
+    public boolean postStateTransitionEvent(final StateMachine2.Transition<VirtualMachine.State,
VirtualMachine.Event> transition, final VirtualMachine vo, final boolean status, final
Object opaque) {
+        final VirtualMachine.State newState = transition.getToState();
         final VirtualMachine.Event event = transition.getEvent();
         if (vo.getType() == VirtualMachine.Type.DomainRouter &&
                 event == VirtualMachine.Event.FollowAgentPowerOnReport &&
-                newState == State.Running &&
+                newState == VirtualMachine.State.Running &&
                 isOutOfBandMigrated(opaque)) {
             s_logger.debug("Virtual router " + vo.getInstanceName() + " is powered-on out-of-band");
         }


Mime
View raw message