diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 79c67d05fe8..798f8f5b3dd 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -1525,7 +1525,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene } if(trackExternalChange) { - if(hostId != vm.getHostId()) { + if(vm.getHostId() == null || hostId != vm.getHostId()) { try { stateTransitTo(vm, VirtualMachine.Event.AgentReportMigrated, hostId); } catch (NoTransitionException e) { diff --git a/setup/db/db/schema-225to226.sql b/setup/db/db/schema-225to226.sql index f42b90aed97..eb39f0c91a9 100644 --- a/setup/db/db/schema-225to226.sql +++ b/setup/db/db/schema-225to226.sql @@ -9,5 +9,27 @@ ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `unique_name` varchar(64) NOT UPDATE `cloud`.`network_offerings` SET unique_name=name; ALTER TABLE `cloud`.`network_offerings` MODIFY `unique_name` varchar(64) NOT NULL UNIQUE COMMENT 'unique name of the network offering'; +DROP TABLE IF EXISTS `cloud`.`certificate`; +CREATE TABLE IF NOT EXISTS `cloud`.`keystore` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `name` varchar(64) NOT NULL COMMENT 'unique name for the certifiation', + `certificate` text NOT NULL COMMENT 'the actual certificate being stored in the db', + `key` text NOT NULL COMMENT 'private key associated wih the certificate', + `domain_suffix` varchar(256) NOT NULL COMMENT 'DNS domain suffix associated with the certificate', + PRIMARY KEY (`id`), + UNIQUE(name) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE IF NOT EXISTS `cloud`.`cmd_exec_log` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `host_id` bigint unsigned NOT NULL COMMENT 'host id of the system VM agent that command is sent to', + `instance_id` bigint unsigned NOT NULL COMMENT 'instance id of the system VM that command is executed on', + `command_name` varchar(255) NOT NULL COMMENT 'command name', + `weight` integer NOT NULL DEFAULT 1 COMMENT 'command weight in consideration of the load factor added to host that is executing the command', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + INDEX `i_cmd_exec_log__host_id`(`host_id`), + INDEX `i_cmd_exec_log__instance_id`(`instance_id`), + CONSTRAINT `fk_cmd_exec_log_ref__inst_id` FOREIGN KEY (`instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/setup/db/db/schema-227to228.sql b/setup/db/db/schema-227to228.sql index 5fe695abd42..3ce53a22e0f 100644 --- a/setup/db/db/schema-227to228.sql +++ b/setup/db/db/schema-227to228.sql @@ -11,7 +11,7 @@ ALTER TABLE `cloud`.`service_offering` ADD COLUMN `vm_type` varchar(32) COMMENT ALTER TABLE `cloud`.`storage_pool` MODIFY `host_address` varchar(255) NOT NULL; DROP TABLE IF EXISTS `cloud`.`certificate`; -CREATE TABLE `cloud`.`keystore` ( +CREATE TABLE IF NOT EXISTS `cloud`.`keystore` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `name` varchar(64) NOT NULL COMMENT 'unique name for the certifiation', `certificate` text NOT NULL COMMENT 'the actual certificate being stored in the db', @@ -21,7 +21,7 @@ CREATE TABLE `cloud`.`keystore` ( UNIQUE(name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `cloud`.`cmd_exec_log` ( +CREATE TABLE IF NOT EXISTS `cloud`.`cmd_exec_log` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `host_id` bigint unsigned NOT NULL COMMENT 'host id of the system VM agent that command is sent to', `instance_id` bigint unsigned NOT NULL COMMENT 'instance id of the system VM that command is executed on', @@ -34,7 +34,7 @@ CREATE TABLE `cloud`.`cmd_exec_log` ( CONSTRAINT `fk_cmd_exec_log_ref__inst_id` FOREIGN KEY (`instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `cloud`.`network_tags` ( +CREATE TABLE IF NOT EXISTS `cloud`.`network_tags` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `network_id` bigint unsigned NOT NULL COMMENT 'id of the network', `tag` varchar(255) NOT NULL COMMENT 'tag', diff --git a/utils/src/com/cloud/utils/StringUtils.java b/utils/src/com/cloud/utils/StringUtils.java index 2b3e7ba2ce6..f4226efe333 100644 --- a/utils/src/com/cloud/utils/StringUtils.java +++ b/utils/src/com/cloud/utils/StringUtils.java @@ -119,4 +119,16 @@ public class StringUtils { } return sb.toString(); } + + public static String getMaskedPasswordForDisplay(String password) { + if(password == null || password.isEmpty()) + return "*"; + + StringBuffer sb = new StringBuffer(); + sb.append(password.charAt(0)); + for(int i = 1; i < password.length(); i++) + sb.append("*"); + + return sb.toString(); + } }