diff --git a/.gitignore b/.gitignore
index 83a0abf0c2e..fe83cbeb1db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,4 +19,5 @@ cloud-*.tar.bz2
build.number
api.log.*.gz
cloud.log.*.*
+unittest
deps/cloud.userlibraries
diff --git a/build/build-cloud.xml b/build/build-cloud.xml
index 4c9f50e0c15..8cc213bad19 100755
--- a/build/build-cloud.xml
+++ b/build/build-cloud.xml
@@ -587,6 +587,7 @@
+
diff --git a/build/build-common.xml b/build/build-common.xml
index 8038a62c78d..e22db9dd0b6 100755
--- a/build/build-common.xml
+++ b/build/build-common.xml
@@ -26,6 +26,7 @@
+
@@ -52,7 +53,7 @@
-
+
diff --git a/build/developer.xml b/build/developer.xml
index ac0956a96c4..8221953fa5f 100755
--- a/build/developer.xml
+++ b/build/developer.xml
@@ -8,15 +8,41 @@
generally developer targets that has nothing to do with compiling.
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -173,5 +199,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/package.xml b/build/package.xml
index 68d5aba41b5..854eb601143 100755
--- a/build/package.xml
+++ b/build/package.xml
@@ -145,7 +145,7 @@
-
+
diff --git a/deps/cloud-junit-4.8.1.jar b/deps/cloud-junit-4.8.1.jar
deleted file mode 100644
index 524cd65ce5f..00000000000
Binary files a/deps/cloud-junit-4.8.1.jar and /dev/null differ
diff --git a/server/.classpath b/server/.classpath
index f64100f07e3..5165c69a4e6 100644
--- a/server/.classpath
+++ b/server/.classpath
@@ -7,5 +7,6 @@
+
diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
index e0693663711..9ea37dbd204 100644
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -356,38 +356,40 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager, Clu
while (en.hasMoreElements()) {
investigator = en.nextElement();
alive = investigator.isVmAlive(vm, host);
+ s_logger.info(investigator.getName() + " found " + vm + "to be alive? " + alive);
if (alive != null) {
- s_logger.debug(investigator.getName() + " found VM " + vm.getName() + "to be alive? " + alive);
break;
}
}
- if (alive != null && alive) {
+
+ boolean fenced = false;
+ if (alive == null) {
+ s_logger.debug("Fencing off VM that we don't know the state of");
+ Enumeration enfb = _fenceBuilders.enumeration();
+ while (enfb.hasMoreElements()) {
+ FenceBuilder fb = enfb.nextElement();
+ Boolean result = fb.fenceOff(vm, host);
+ s_logger.info("Fencer " + fb.getName() + " returned " + result);
+ if (result != null && result) {
+ fenced = true;
+ break;
+ }
+ }
+ } else if (!alive) {
+ fenced = true;
+ } else {
s_logger.debug("VM " + vm.getName() + " is found to be alive by " + investigator.getName());
if (host.getStatus() == Status.Up) {
s_logger.info(vm + " is alive and host is up. No need to restart it.");
- return null;
+ return null;
} else {
s_logger.debug("Rescheduling because the host is not up but the vm is alive");
return (System.currentTimeMillis() >> 10) + _investigateRetryInterval;
}
}
- boolean fenced = false;
- if (alive == null || !alive) {
- fenced = true;
- s_logger.debug("Fencing off VM that we don't know the state of");
- Enumeration enfb = _fenceBuilders.enumeration();
- while (enfb.hasMoreElements()) {
- final FenceBuilder fb = enfb.nextElement();
- Boolean result = fb.fenceOff(vm, host);
- if (result != null && !result) {
- fenced = false;
- }
- }
- }
-
- if (alive== null && !fenced) {
- s_logger.debug("We were unable to fence off the VM " + vm.toString());
+ if (!fenced) {
+ s_logger.debug("We were unable to fence off the VM " + vm);
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return (System.currentTimeMillis() >> 10) + _restartRetryInterval;
}
@@ -446,7 +448,6 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager, Clu
if (s_logger.isDebugEnabled()) {
s_logger.debug("Rescheduling VM " + vm.toString() + " to try again in " + _restartRetryInterval);
}
-
} catch (final InsufficientCapacityException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index 57fb6984e88..bc21c144a7c 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -90,6 +90,17 @@ DROP TABLE IF EXISTS `cloud`.`firewall_rules`;
DROP TABLE IF EXISTS `cloud`.`ssh_keypairs`;
DROP TABLE IF EXISTS `cloud`.`usage_event`;
DROP TABLE IF EXISTS `cloud`.`host_tags`;
+DROP TABLE IF EXISTS `cloud`.`version`;
+
+CREATE TABLE `cloud`.`version` (
+ `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
+ `version` char(40) NOT NULL UNIQUE COMMENT 'version',
+ `updated` datetime NOT NULL COMMENT 'Date this version table was updated`,
+ `step` char(32) NOT NULL COMMENT 'Step in the upgrade to this version',
+ `dump_path` char(255) NOT NULL COMMENT `path to the dump of the database before upgrade`,
+ PRIMARY KEY (`id`),
+ INDEX `i_version__version`(`version`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`op_it_work` (
`id` char(40) COMMENT 'reservation id',
@@ -739,7 +750,6 @@ CREATE TABLE `cloud`.`vm_instance` (
`proxy_assign_time` DATETIME NULL COMMENT 'time when console proxy was assigned',
`vnc_password` varchar(255) NOT NULL COMMENT 'vnc password',
`ha_enabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Should HA be enabled for this VM',
- `mirrored_vols` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Are the volumes mirrored',
`update_count` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'date state was updated',
`update_time` datetime COMMENT 'date the destroy was requested',
`created` datetime NOT NULL COMMENT 'date created',
@@ -864,7 +874,6 @@ CREATE TABLE `cloud`.`console_proxy` (
`public_mac_address` varchar(17) unique COMMENT 'mac address of the public facing network card',
`public_ip_address` varchar(15) UNIQUE COMMENT 'public ip address for the console proxy',
`public_netmask` varchar(15) COMMENT 'public netmask used for the console proxy',
- `ram_size` int(10) unsigned NOT NULL DEFAULT 512 COMMENT 'memory to use in mb',
`active_session` int(10) NOT NULL DEFAULT 0 COMMENT 'active session number',
`last_update` DATETIME NULL COMMENT 'Last session update time',
`session_details` BLOB NULL COMMENT 'session detail info',
@@ -877,7 +886,6 @@ CREATE TABLE `cloud`.`secondary_storage_vm` (
`public_mac_address` varchar(17) unique COMMENT 'mac address of the public facing network card',
`public_ip_address` varchar(15) UNIQUE COMMENT 'public ip address for the sec storage vm',
`public_netmask` varchar(15) COMMENT 'public netmask used for the sec storage vm',
- `ram_size` int(10) unsigned NOT NULL DEFAULT 512 COMMENT 'memory to use in mb',
`guid` varchar(255) COMMENT 'copied from guid of secondary storage host',
`nfs_share` varchar(255) COMMENT 'server and path exported by the nfs server ',
`last_update` DATETIME NULL COMMENT 'Last session update time',
@@ -907,7 +915,6 @@ CREATE TABLE `cloud`.`account` (
`state` varchar(10) NOT NULL default 'enabled',
`removed` datetime COMMENT 'date removed',
`cleanup_needed` tinyint(1) NOT NULL default '0',
--- `network_domain` varchar(100) COMMENT 'Network domain name of the Vms of the account',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/utils/src/com/cloud/utils/component/Adapters.java b/utils/src/com/cloud/utils/component/Adapters.java
index 04cad7df26c..76139996c03 100755
--- a/utils/src/com/cloud/utils/component/Adapters.java
+++ b/utils/src/com/cloud/utils/component/Adapters.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -69,7 +70,7 @@ public class Adapters implements Iterable {
}
protected void set(List> adapters) {
- HashMap map = new HashMap(adapters.size());
+ HashMap map = new LinkedHashMap(adapters.size());
for (ComponentInfo adapter : adapters) {
@SuppressWarnings("unchecked")
T t = (T)adapter.instance;
diff --git a/utils/src/com/cloud/utils/testcase/ComponentSetup.java b/utils/test/com/cloud/utils/testcase/ComponentSetup.java
similarity index 100%
rename from utils/src/com/cloud/utils/testcase/ComponentSetup.java
rename to utils/test/com/cloud/utils/testcase/ComponentSetup.java
diff --git a/utils/src/com/cloud/utils/testcase/ComponentTestCase.java b/utils/test/com/cloud/utils/testcase/ComponentTestCase.java
similarity index 100%
rename from utils/src/com/cloud/utils/testcase/ComponentTestCase.java
rename to utils/test/com/cloud/utils/testcase/ComponentTestCase.java
diff --git a/utils/src/com/cloud/utils/testcase/Log4jEnabledTestCase.java b/utils/test/com/cloud/utils/testcase/Log4jEnabledTestCase.java
similarity index 100%
rename from utils/src/com/cloud/utils/testcase/Log4jEnabledTestCase.java
rename to utils/test/com/cloud/utils/testcase/Log4jEnabledTestCase.java