From 5db972494a8e6b090e16b14f675226929d3244a7 Mon Sep 17 00:00:00 2001
From: Avishay Traeger <avishay@il.ibm.com>
Date: Sun, 12 Jan 2014 15:41:31 +0200
Subject: [PATCH] Update host on driver retype

The volume's host was not updated on retype where the driver handled
the retype. Now update in all cases.

Change-Id: I64b72ae5617d1dacad8f37c4246ce0f079e015bb
Closes-Bug: #1268305
---
 cinder/tests/test_volume.py | 2 ++
 cinder/volume/manager.py    | 1 +
 2 files changed, 3 insertions(+)

diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py
index 6eb542d7c..3a5af17cd 100644
--- a/cinder/tests/test_volume.py
+++ b/cinder/tests/test_volume.py
@@ -2220,10 +2220,12 @@ class VolumeTestCase(BaseVolumeTestCase):
         if not exc:
             self.assertEqual(volume['volume_type_id'], vol_type['id'])
             self.assertEqual(volume['status'], 'available')
+            self.assertEqual(volume['host'], 'newhost')
             self.assertEqual(volumes_in_use, 1)
         else:
             self.assertEqual(volume['volume_type_id'], old_vol_type['id'])
             self.assertEqual(volume['status'], 'available')
+            self.assertEqual(volume['host'], CONF.host)
             self.assertEqual(volumes_in_use, 0)
 
     def test_retype_volume_driver_success(self):
diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py
index 1da9d01f0..7c8ef353b 100644
--- a/cinder/volume/manager.py
+++ b/cinder/volume/manager.py
@@ -1215,6 +1215,7 @@ class VolumeManager(manager.SchedulerDependentManager):
 
         self.db.volume_update(context, volume_id,
                               {'volume_type_id': new_type_id,
+                               'host': host['host'],
                                'status': status_update['status']})
 
         if old_reservations:
-- 
2.45.2