cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [7/9] git commit: updated refs/heads/master to ccfe557
Date Tue, 10 Dec 2013 04:52:14 GMT
add Apache Licensed and add check native


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

Branch: refs/heads/master
Commit: 5e23f00b1ab53daaeb5ad85943a8b04567d12ac5
Parents: 69302e1
Author: tuna <ng.tuna@gmail.com>
Authored: Tue Dec 10 10:21:09 2013 +0700
Committer: tuna <ng.tuna@gmail.com>
Committed: Tue Dec 10 10:37:29 2013 +0700

----------------------------------------------------------------------
 .../agent/api/PerformanceMonitorAnswer.java     | 16 +++++++++
 .../agent/api/PerformanceMonitorCommand.java    | 16 +++++++++
 .../network/as/AutoScaleVmGroupVmMapVO.java     | 16 +++++++++
 .../as/dao/AutoScaleVmGroupVmMapDao.java        | 16 +++++++++
 .../as/dao/AutoScaleVmGroupVmMapDaoImpl.java    | 16 +++++++++
 scripts/vm/hypervisor/xenserver/perfmon.py      | 16 +++++++++
 server/src/com/cloud/server/StatsCollector.java | 36 ++++++++++++++++----
 setup/db/db/schema-40to410.sql                  |  4 +--
 8 files changed, 128 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/core/src/com/cloud/agent/api/PerformanceMonitorAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PerformanceMonitorAnswer.java b/core/src/com/cloud/agent/api/PerformanceMonitorAnswer.java
index 931e237..10f4185 100644
--- a/core/src/com/cloud/agent/api/PerformanceMonitorAnswer.java
+++ b/core/src/com/cloud/agent/api/PerformanceMonitorAnswer.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.agent.api;
 
 public class PerformanceMonitorAnswer extends Answer {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/core/src/com/cloud/agent/api/PerformanceMonitorCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PerformanceMonitorCommand.java b/core/src/com/cloud/agent/api/PerformanceMonitorCommand.java
index 41a7945..882d7b1 100644
--- a/core/src/com/cloud/agent/api/PerformanceMonitorCommand.java
+++ b/core/src/com/cloud/agent/api/PerformanceMonitorCommand.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.agent.api;
 
 import java.util.HashMap;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVmMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVmMapVO.java b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVmMapVO.java
index 30a89f3..d70f9bf 100644
--- a/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVmMapVO.java
+++ b/engine/schema/src/com/cloud/network/as/AutoScaleVmGroupVmMapVO.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.network.as;
 
 import javax.persistence.Column;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java
index 1a080ad..b7234e7 100644
--- a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDao.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.network.as.dao;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java
b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java
index f7b354a..494092d 100644
--- a/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.network.as.dao;
 
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/scripts/vm/hypervisor/xenserver/perfmon.py
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/perfmon.py b/scripts/vm/hypervisor/xenserver/perfmon.py
index 9db2958..eb14e32 100755
--- a/scripts/vm/hypervisor/xenserver/perfmon.py
+++ b/scripts/vm/hypervisor/xenserver/perfmon.py
@@ -1,4 +1,20 @@
 #!/usr/bin/python
+# 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.
 
 import pprint
 import XenAPI

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index 33597e0..82f774f 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -623,7 +623,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
 				List<AutoScaleVmGroupVO> asGroups = _asGroupDao.listAll();
 				for (AutoScaleVmGroupVO asGroup : asGroups) {
 					// check group state
-					if (asGroup.getState().equals("enabled")) {
+					if ((asGroup.getState().equals("enabled")) && (is_native(asGroup.getId())))
{
 						// check minimum vm of group
 						Integer currentVM = _asGroupVmDao.countByGroup(asGroup.getId());
 						if (currentVM < asGroup.getMinMembers()) {
@@ -733,7 +733,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
 										}
 									}
 
-									String scaleAction = getAutoscaleAction(avgCounter, asGroup.getId(), currentVM);
+									String scaleAction = getAutoscaleAction(avgCounter, asGroup.getId(), currentVM,
params);
 									if (scaleAction != null) {
 										s_logger.debug("[AutoScale] Doing scale action: " + scaleAction + " for group "
+ asGroup.getId());
 										if (scaleAction.equals("scaleup")) {
@@ -758,7 +758,21 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
 
 		}
 		
-		private String getAutoscaleAction(HashMap<Long, Double> avgCounter, long groupId,
long currentVM) {
+		private boolean is_native(long groupId) {
+			List <AutoScaleVmGroupPolicyMapVO> vos = _asGroupPolicyDao.listByVmGroupId(groupId);
+			for (AutoScaleVmGroupPolicyMapVO vo : vos) {
+				List<AutoScalePolicyConditionMapVO> ConditionPolicies = _asConditionMapDao.findByPolicyId(vo.getPolicyId());
+				for (AutoScalePolicyConditionMapVO ConditionPolicy : ConditionPolicies) {
+					ConditionVO condition = _asConditionDao.findById(ConditionPolicy.getConditionId());
+					CounterVO counter = _asCounterDao.findById(condition.getCounterid());
+					if (counter.getSource() == Counter.Source.cpu || counter.getSource() == Counter.Source.memory)
+						return true;
+				}
+			}
+			return false;
+		}
+		
+		private String getAutoscaleAction(HashMap<Long, Double> avgCounter, long groupId,
long currentVM, Map<String, String> params) {
 			
 			List<AutoScaleVmGroupPolicyMapVO> listMap = _asGroupPolicyDao.listByVmGroupId(groupId);
 			if ( (listMap == null) || (listMap.size() == 0) )
@@ -785,9 +799,19 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
 							for (ConditionVO conditionVO : lstConditions) {
 								long thresholdValue = conditionVO.getThreshold();
 								Double thresholdPercent = (double)thresholdValue / 100;
-								Double sum = avgCounter.get(conditionVO.getCounterid());
-								Double avg = sum/ currentVM;
-										
+								CounterVO counterVO = _asCounterDao.findById(conditionVO.getCounterid());
+//								Double sum = avgCounter.get(conditionVO.getCounterid());
+								long counter_count=1;
+								do {
+									String counter_param = params.get("counter" + String.valueOf(counter_count));
+									Counter.Source counter_source = counterVO.getSource(); 
+									if (counter_param.equals(counter_source.toString()))
+										break;
+									counter_count++;
+								} while (1==1);
+								
+								Double sum = avgCounter.get(counter_count);
+								Double avg = sum / currentVM;
 								Operator op = conditionVO.getRelationalOperator();
 								boolean bConditionCheck = ((op == com.cloud.network.as.Condition.Operator.EQ) &&
(thresholdPercent == avg))
 										|| ((op == com.cloud.network.as.Condition.Operator.GE) && (avg >= thresholdPercent))

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e23f00b/setup/db/db/schema-40to410.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql
index ca1edb1..65fb350 100644
--- a/setup/db/db/schema-40to410.sql
+++ b/setup/db/db/schema-40to410.sql
@@ -417,8 +417,8 @@ INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created)
VALUES (1,
 INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (2, UUID(),
'snmp','Linux System CPU - percentage', '1.3.6.1.4.1.2021.11.10.0', now());
 INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (3, UUID(),
'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now());
 INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (100, UUID(),
'netscaler','Response Time - microseconds', 'RESPTIME', now());
-INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (4, UUID(),
'cpu','Linux User CPU - percentage', '1.3.6.1.4.1.2021.11.9.1', now());
-INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (5, UUID(),
'memory','Linux User RAM - percentage', '1.3.6.1.4.1.2021.11.10.1', now());
+INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (4, UUID(),
'cpu','Linux User CPU - percentage - native', '1.3.6.1.4.1.2021.11.9.1', now());
+INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (5, UUID(),
'memory','Linux User RAM - percentage - native', '1.3.6.1.4.1.2021.11.10.1', now());
 
 CREATE TABLE  `cloud`.`user_ipv6_address` (
   `id` bigint unsigned NOT NULL UNIQUE auto_increment,


Mime
View raw message