From 9adf91f7b9c9be8e3eecd66139655f70845ffa3a Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Sun, 12 Aug 2012 16:34:02 +0530 Subject: [PATCH 1/2] CS-15879 Removed safe update flag as it is a client only setting --- setup/db/db/schema-303to40.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup/db/db/schema-303to40.sql b/setup/db/db/schema-303to40.sql index a44e64ea4c9..9f249661a19 100644 --- a/setup/db/db/schema-303to40.sql +++ b/setup/db/db/schema-303to40.sql @@ -81,8 +81,6 @@ AlTER TABLE physical_network_service_providers ADD CONSTRAINT `fk_pnetwork_servi UPDATE `cloud`.`configuration` SET description='In second, timeout for creating volume from snapshot' WHERE name='create.volume.from.snapshot.wait'; ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `max_data_volumes_limit` int unsigned DEFAULT 6 COMMENT 'Max. data volumes per VM supported by hypervisor'; -SET SQL_SAFE_UPDATES=0; UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit`=13 WHERE `hypervisor_type`='XenServer' AND (`hypervisor_version`='6.0' OR `hypervisor_version`='6.0.2'); -SET SQL_SAFE_UPDATES=1; INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `description`) VALUES ('Advanced', 'DEFAULT', 'management-server', 'event.purge.interval', '86400', 'The interval (in seconds) to wait before running the event purge thread'); UPDATE `cloud`.`configuration` SET description='Do URL encoding for the api response, false by default' WHERE name='encode.api.response'; From ff773a812227f7e851e79cc11b49d66ad278101a Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Sun, 12 Aug 2012 17:05:28 +0530 Subject: [PATCH 2/2] CS-15621: Using migrateVolumes method which does not perform input validation. Some input validation in the migrateVolume method prevented migration of volume in READY state. Also using volume disk offering to check if it is a local or shared one. Verified on XS 6.0.2 Test scenario - Created 2 shared primary storage pools - Created data volume using shared disk offering - Attached it to a running VM (created in one storage pool) - Detached it (now it is in READY state) - Created a new VM in stopped state (using deployVirtualMachine API with startVm=false) - Attached the data volume to this new VM - Started new VM (migrated volume scenario got hit when the planner assigned the other shared pool) --- server/src/com/cloud/storage/StorageManagerImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index c17379f48bb..b9e775d13f2 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -3241,7 +3241,8 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag if (s_logger.isDebugEnabled()) { s_logger.debug("Mismatch in storage pool " + assignedPool + " assigned by deploymentPlanner and the one associated with volume " + vol); } - if (vm.getServiceOffering().getUseLocalStorage()) + DiskOfferingVO diskOffering = _diskOfferingDao.findById(vol.getDiskOfferingId()); + if (diskOffering.getUseLocalStorage()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Local volume " + vol + " will be recreated on storage pool " + assignedPool + " assigned by deploymentPlanner"); @@ -3252,10 +3253,12 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag s_logger.debug("Shared volume " + vol + " will be migrated on storage pool " + assignedPool + " assigned by deploymentPlanner"); } try { - Volume migratedVol = migrateVolume(vol.getId(), assignedPool.getId()); - vm.addDisk(new VolumeTO(migratedVol, assignedPool)); + List volumesToMigrate = new ArrayList(); + volumesToMigrate.add(vol); + migrateVolumes(volumesToMigrate, assignedPool); + vm.addDisk(new VolumeTO(vol, assignedPool)); } catch (ConcurrentOperationException e) { - throw new StorageUnavailableException("Volume migration failed for " + vol, Volume.class, vol.getId()); + throw new CloudRuntimeException("Migration of volume " + vol + " to storage pool " + assignedPool + " failed", e); } } } else {