summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJian Wen <wenjianhn@gmail.com>2012-08-29 22:29:25 +0800
committerJian Wen <wenjianhn@gmail.com>2012-08-29 22:37:25 +0800
commitf94391fb41b42909ae9508ed54316199fccfe41d (patch)
tree5535c2b2aad6f1b2774fea2b9e443f8b697e3684
parent20c6bb6c9000fa0d193f688b668f5f3eeda8fb05 (diff)
downloadnova-f94391fb41b42909ae9508ed54316199fccfe41d.tar.gz
nova-f94391fb41b42909ae9508ed54316199fccfe41d.tar.xz
nova-f94391fb41b42909ae9508ed54316199fccfe41d.zip
Add a new exception for live migration.
Raises new exception InvalidLocalStorage instead of InvalidSharedStorage when block migration is used with shared storage. Corrects the message of InvalidSharedStorage. Fixes bug 1043165 Change-Id: I68bfac3f89276edc38c00ca963911fe07456dc0d
-rw-r--r--nova/exception.py6
-rw-r--r--nova/tests/test_libvirt.py2
-rw-r--r--nova/virt/libvirt/driver.py6
3 files changed, 9 insertions, 5 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 95a43a05f..60cc5ae30 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -864,7 +864,11 @@ class VolumeTypeExists(Duplicate):
class InvalidSharedStorage(NovaException):
- message = _("%(path)s is on shared storage: %(reason)s")
+ message = _("%(path)s is not on shared storage: %(reason)s")
+
+
+class InvalidLocalStorage(NovaException):
+ message = _("%(path)s is not on local storage: %(reason)s")
class MigrationError(NovaException):
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index 885cf7e83..0932443cd 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -1762,7 +1762,7 @@ class LibvirtConnTestCase(test.TestCase):
conn._check_shared_storage_test_file("file").AndReturn(True)
self.mox.ReplayAll()
- self.assertRaises(exception.InvalidSharedStorage,
+ self.assertRaises(exception.InvalidLocalStorage,
conn.check_can_live_migrate_source,
self.context, instance_ref, dest_check_data)
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 7bb4cbc22..6207c6caf 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -2242,7 +2242,7 @@ class LibvirtDriver(driver.ComputeDriver):
"""
# Checking shared storage connectivity
# if block migration, instances_paths should not be on shared storage.
- dest = FLAGS.host
+ source = FLAGS.host
filename = dest_check_data["filename"]
block_migration = dest_check_data["block_migration"]
@@ -2252,12 +2252,12 @@ class LibvirtDriver(driver.ComputeDriver):
if shared:
reason = _("Block migration can not be used "
"with shared storage.")
- raise exception.InvalidSharedStorage(reason=reason, path=dest)
+ raise exception.InvalidLocalStorage(reason=reason, path=source)
elif not shared:
reason = _("Live migration can not be used "
"without shared storage.")
- raise exception.InvalidSharedStorage(reason=reason, path=dest)
+ raise exception.InvalidSharedStorage(reason=reason, path=source)
def _get_compute_info(self, context, host):
"""Get compute host's information specified by key"""