You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/02/21 20:15:16 UTC

[45/45] git commit: refs/heads/storage_refactor - rebase to master

Updated Branches:
  refs/heads/storage_refactor fb5d2c104 -> 6c2252a42 (forced update)


rebase to master


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

Branch: refs/heads/storage_refactor
Commit: 6c2252a42182cb35fa055e05a6d5f8b9837f8c99
Parents: 9d975b0
Author: Edison Su <su...@gmail.com>
Authored: Thu Feb 21 11:14:35 2013 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Thu Feb 21 11:14:35 2013 -0800

----------------------------------------------------------------------
 server/test/com/cloud/vm/UserVmManagerTest.java |   11 ++--
 setup/db/create-schema.sql                      |    1 +
 setup/db/db/schema-40to410.sql                  |   40 --------------
 setup/db/db/schema-410to420.sql                 |   49 ++++++++++++++++++
 4 files changed, 56 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c2252a4/server/test/com/cloud/vm/UserVmManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/UserVmManagerTest.java b/server/test/com/cloud/vm/UserVmManagerTest.java
index 07cad47..0795a35 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -35,6 +35,7 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.VolumeManager;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDao;
@@ -53,7 +54,7 @@ public class UserVmManagerTest {
 
     @Spy UserVmManagerImpl _userVmMgr = new UserVmManagerImpl();
     @Mock VirtualMachineManager _itMgr;
-    @Mock StorageManager _storageMgr;
+    @Mock VolumeManager _storageMgr;
     @Mock Account _account;
     @Mock AccountManager _accountMgr;
     @Mock AccountDao _accountDao;
@@ -76,7 +77,7 @@ public class UserVmManagerTest {
         _userVmMgr._templateDao = _templateDao;
         _userVmMgr._volsDao = _volsDao;
         _userVmMgr._itMgr = _itMgr;
-        _userVmMgr._storageMgr = _storageMgr;
+        _userVmMgr.volumeMgr = _storageMgr;
         _userVmMgr._accountDao = _accountDao;
         _userVmMgr._userDao = _userDao;
         _userVmMgr._accountMgr = _accountMgr;
@@ -116,7 +117,7 @@ public class UserVmManagerTest {
         doNothing().when(_volsDao).attachVolume(anyLong(), anyLong(), anyLong());
         when(_volumeMock.getId()).thenReturn(3L);
         doNothing().when(_volsDao).detachVolume(anyLong());
-        when(_storageMgr.destroyVolume(_volumeMock)).thenReturn(true);
+      
         when(_templateMock.getUuid()).thenReturn("e0552266-7060-11e2-bbaa-d55f5db67735");
 
         _userVmMgr.restoreVMInternal(_account, _vmMock, null);
@@ -141,7 +142,7 @@ public class UserVmManagerTest {
         doNothing().when(_volsDao).attachVolume(anyLong(), anyLong(), anyLong());
         when(_volumeMock.getId()).thenReturn(3L);
         doNothing().when(_volsDao).detachVolume(anyLong());
-        when(_storageMgr.destroyVolume(_volumeMock)).thenReturn(true);
+     
         when(_templateMock.getUuid()).thenReturn("e0552266-7060-11e2-bbaa-d55f5db67735");
 
         _userVmMgr.restoreVMInternal(_account, _vmMock, null);
@@ -171,7 +172,7 @@ public class UserVmManagerTest {
         doNothing().when(_volsDao).attachVolume(anyLong(), anyLong(), anyLong());
         when(_volumeMock.getId()).thenReturn(3L);
         doNothing().when(_volsDao).detachVolume(anyLong());
-        when(_storageMgr.destroyVolume(_volumeMock)).thenReturn(true);
+      
         when(_templateMock.getUuid()).thenReturn("b1a3626e-72e0-4697-8c7c-a110940cc55d");
 
         _userVmMgr.restoreVMInternal(_account, _vmMock, 14L);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c2252a4/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index 7361681..1556913 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -1049,6 +1049,7 @@ CREATE TABLE  `cloud`.`vm_template` (
   `source_template_id` bigint unsigned COMMENT 'Id of the original template, if this template is created from snapshot',
   `template_tag` varchar(255) COMMENT 'template tag',
   `sort_key` int(32) NOT NULL default 0 COMMENT 'sort key used for customising sort method',
+  `image_data_store_id` bigint unsigned,
   PRIMARY KEY  (`id`),
   INDEX `i_vm_template__removed`(`removed`),
   CONSTRAINT `uc_vm_template__uuid` UNIQUE (`uuid`)

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c2252a4/setup/db/db/schema-40to410.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql
index 47b7cbe..774a767 100644
--- a/setup/db/db/schema-40to410.sql
+++ b/setup/db/db/schema-40to410.sql
@@ -21,7 +21,6 @@
 
 use cloud;
 
-alter table vm_template add image_data_store_id bigint unsigned;
 alter table vm_template add size bigint unsigned;
 alter table vm_template add state varchar(255);
 alter table vm_template add update_count bigint unsigned;
@@ -58,45 +57,6 @@ alter table cluster add column owner varchar(255);
 alter table cluster add column created datetime COMMENT 'date created';
 alter table cluster add column lastUpdated datetime COMMENT 'last updated';
 alter table cluster add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone';
-CREATE TABLE  `cloud`.`object_datastore_ref` (
-  `id` bigint unsigned NOT NULL auto_increment,
-  `datastore_id` bigint unsigned NOT NULL,
-  `datastore_role` varchar(255) NOT NULL,
-  `object_id` bigint unsigned NOT NULL,
-  `object_type` varchar(255) NOT NULL,
-  `created` DATETIME NOT NULL,
-  `last_updated` DATETIME,
-  `job_id` varchar(255),
-  `download_pct` int(10) unsigned,
-  `download_state` varchar(255),
-  `error_str` varchar(255),
-  `local_path` varchar(255),
-  `install_path` varchar(255),
-  `size` bigint unsigned COMMENT 'the size of the template on the pool',
-  `state` varchar(255) NOT NULL,
-  `update_count` bigint unsigned NOT NULL,
-  `updated` DATETIME,
-  PRIMARY KEY  (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-
-CREATE TABLE `cloud`.`data_store_provider` (
-  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
-  `name` varchar(255) NOT NULL COMMENT 'name of primary data store provider',
-  `uuid` varchar(255) NOT NULL COMMENT 'uuid of primary data store provider',
-  PRIMARY KEY(`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE `cloud`.`image_data_store` (
-  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
-  `name` varchar(255) NOT NULL COMMENT 'name of data store',
-  `image_provider_id` bigint unsigned NOT NULL COMMENT 'id of image_data_store_provider',
-  `protocol` varchar(255) NOT NULL COMMENT 'protocol of data store',
-  `data_center_id` bigint unsigned  COMMENT 'datacenter id of data store',
-  `scope` varchar(255) COMMENT 'scope of data store',
-  `uuid` varchar(255) COMMENT 'uuid of data store',
-  PRIMARY KEY(`id`),
-  CONSTRAINT `fk_tags__image_data_store_provider_id` FOREIGN KEY(`image_provider_id`) REFERENCES `data_store_provider`(`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 CREATE TABLE `cloud`.`vm_compute_tags` (
   `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c2252a4/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 0335f2a..eed7390 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -24,6 +24,55 @@ UPDATE `cloud`.`hypervisor_capabilities` SET `max_hosts_per_cluster`=32 WHERE `h
 INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '5.1', 128, 0, 32);
 DELETE FROM `cloud`.`configuration` where name='vmware.percluster.host.max';
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xen.nics.max', '7', 'Maximum allowed nics for Vms created on Xen');
+alter table template_host_ref add state varchar(255);
+alter table template_host_ref add update_count bigint unsigned;
+alter table template_host_ref add updated datetime;
+alter table volume_host_ref add state varchar(255);
+alter table volume_host_ref add update_count bigint unsigned;
+alter table volume_host_ref add updated datetime;
+alter table template_spool_ref add updated datetime;
+CREATE TABLE  `cloud`.`object_datastore_ref` (
+  `id` bigint unsigned NOT NULL auto_increment,
+  `datastore_uuid`  varchar(255) NOT NULL,
+  `datastore_role` varchar(255) NOT NULL,
+  `object_uuid` varchar(255) NOT NULL,
+  `object_type` varchar(255) NOT NULL,
+  `created` DATETIME NOT NULL,
+  `last_updated` DATETIME,
+  `job_id` varchar(255),
+  `download_pct` int(10) unsigned,
+  `download_state` varchar(255),
+  `url` varchar(255),
+  `format` varchar(255),
+  `checksum` varchar(255),
+  `error_str` varchar(255),
+  `local_path` varchar(255),
+  `install_path` varchar(255),
+  `size` bigint unsigned COMMENT 'the size of the template on the pool',
+  `state` varchar(255) NOT NULL,
+  `update_count` bigint unsigned NOT NULL,
+  `updated` DATETIME,
+  PRIMARY KEY  (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`data_store_provider` (
+  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+  `name` varchar(255) NOT NULL COMMENT 'name of primary data store provider',
+  `uuid` varchar(255) NOT NULL COMMENT 'uuid of primary data store provider',
+  PRIMARY KEY(`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`image_data_store` (
+  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+  `name` varchar(255) NOT NULL COMMENT 'name of data store',
+  `image_provider_id` bigint unsigned NOT NULL COMMENT 'id of image_data_store_provider',
+  `protocol` varchar(255) NOT NULL COMMENT 'protocol of data store',
+  `data_center_id` bigint unsigned  COMMENT 'datacenter id of data store',
+  `scope` varchar(255) COMMENT 'scope of data store',
+  `uuid` varchar(255) COMMENT 'uuid of data store',
+  PRIMARY KEY(`id`),
+  CONSTRAINT `fk_tags__image_data_store_provider_id` FOREIGN KEY(`image_provider_id`) REFERENCES `data_store_provider`(`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 
 ALTER TABLE `cloud`.`service_offering` ADD COLUMN `is_volatile` tinyint(1) unsigned NOT NULL DEFAULT 0  COMMENT 'true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk';