cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [9/9] git commit: updated refs/heads/vmsync to 309f8da
Date Tue, 18 Jun 2013 00:24:54 GMT
Finally starting vm again


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

Branch: refs/heads/vmsync
Commit: 309f8da6de19108343749ac2f2edde80107e4f37
Parents: 6adf761
Author: Alex Huang <alex.huang@gmail.com>
Authored: Mon Jun 17 17:03:52 2013 -0700
Committer: Alex Huang <alex.huang@gmail.com>
Committed: Mon Jun 17 17:25:04 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/engine/config/Configs.java       | 46 --------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java | 11 +++--
 .../framework/jobs/impl/OutcomeImpl.java        |  6 ++-
 3 files changed, 12 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/309f8da6/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java b/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java
deleted file mode 100644
index 14598bd..0000000
--- a/engine/components-api/src/org/apache/cloudstack/engine/config/Configs.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.engine.config;
-
-import org.apache.cloudstack.config.ConfigKey;
-import org.apache.cloudstack.engine.service.api.OrchestrationService;
-
-public interface Configs {
-    
-    public static final ConfigKey<Integer> StartRetry = new ConfigKey<Integer>(
-            Integer.class, "start.retry", "Advanced", OrchestrationService.class, "10", "Number
of times to retry create and start commands", true, null);
-    public static final ConfigKey<Long> VmOpWaitInterval = new ConfigKey<Long>(
-            Long.class, "vm.op.wait.interval", "Advanced", OrchestrationService.class, "120",
"Time (in seconds) to wait before checking if a previous operation has succeeded",
-            true, null);
-    public static final ConfigKey<Integer> VmOpLockStateRetry = new ConfigKey<Integer>(
-            Integer.class, "vm.op.lock.state.retry", "Advanced", OrchestrationService.class,
"5", "Times to retry locking the state of a VM for operations",
-            true, "-1 means try forever");
-    public static final ConfigKey<Long> VmOpCleanupInterval = new ConfigKey<Long>(
-            Long.class, "vm.op.cleanup.interval", "Advanced", OrchestrationService.class,
"86400", "Interval to run the thread that cleans up the vm operations (in seconds)",
-            false, "Seconds");
-    public static final ConfigKey<Long> VmOpCleanupWait = new ConfigKey<Long>(
-            Long.class, "vm.op.cleanup.wait", "Advanced", OrchestrationService.class, "3600",
"Time (in seconds) to wait before cleanuping up any vm work items", false, "Seconds");
-    public static final ConfigKey<Integer> VmOpCancelInterval = new ConfigKey<Integer>(
-            Integer.class, "vm.op.cancel.interval", "Advanced", OrchestrationService.class,
"3600", "Time (in seconds) to wait before cancelling a operation", false, "Seconds");
-    public static final ConfigKey<Integer> Wait = new ConfigKey<Integer>(
-            Integer.class, "wait", "Advanced", OrchestrationService.class, "1800", "Time
in seconds to wait for control commands to return", false, null);
-    public static final ConfigKey<Boolean> VmDestroyForcestop = new ConfigKey<Boolean>(
-            Boolean.class, "vm.destroy.forcestop", "Advanced", OrchestrationService.class,
"false", "On destroy, force-stop takes this value ", true, null);
-
-    public static final ConfigKey<Long> PingInterval = new ConfigKey<Long>(
-            Long.class, "ping.interval", "Advanced", OrchestrationService.class, "60", "Ping
interval in seconds", null);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/309f8da6/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 4dd0e3c..8989235 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -739,7 +739,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         txn.commit();
     	final long jobId = workJob.getId();
     	AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(jobId);
-        return new VmOutcome(workJob, VirtualMachine.PowerState.PowerOn);
+        return new VmOutcome(workJob, VirtualMachine.PowerState.PowerOn, vm.getId());
     }
 
     private Pair<DeploymentPlan, DeployDestination> findDestination(VirtualMachineProfileImpl
profile, DeploymentPlan planRequested, boolean reuseVolume,
@@ -3664,11 +3664,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
     }
 
     public class VmOutcome extends OutcomeImpl<VirtualMachine> {
-        public VmOutcome(final AsyncJob job, final PowerState desiredPowerState) {
+        private long _vmId;
+
+        public VmOutcome(final AsyncJob job, final PowerState desiredPowerState, final long
vmId) {
             super(VirtualMachine.class, job, _jobCheckInterval.value(), new Predicate() {
                 @Override
                 public boolean checkCondition() {
-                    VMInstanceVO instance = _vmDao.findById(job.getInstanceId());
+                    VMInstanceVO instance = _vmDao.findById(vmId);
                     if (instance.getPowerState() == desiredPowerState)
                         return true;
 
@@ -3679,11 +3681,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                     return false;
                 }
             }, Topics.VM_POWER_STATE, AsyncJob.Topics.JOB_STATE);
+            _vmId = vmId;
         }
 
         @Override
         protected VirtualMachine retrieve() {
-            return _vmDao.findById(_job.getInstanceId());
+            return _vmDao.findById(_vmId);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/309f8da6/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/OutcomeImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/OutcomeImpl.java
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/OutcomeImpl.java
index 020029d..8a8b8d6 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/OutcomeImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/OutcomeImpl.java
@@ -63,7 +63,11 @@ public class OutcomeImpl<T> implements Outcome<T> {
     @Override
     public T get() throws InterruptedException, ExecutionException {
         s_jobMgr.waitAndCheck(_topics, _checkIntervalInMs, -1, _predicate);
-        s_jobMgr.disjoinJob(AsyncJobExecutionContext.getCurrentExecutionContext().getJob().getId(),
_job.getId());
+        try {
+            AsyncJobExecutionContext.getCurrentExecutionContext().disjoinJob(_job.getId());
+        } catch (Throwable e) {
+            throw new ExecutionException("Job task has trouble executing", e);
+        }
 
         return retrieve();
     }


Mime
View raw message