snapshot/backup in compute manager to use uuids
Related to blueprint internal-uuids. Changes shapshot in the computer manager to expect uuids instead of ids. Also updates some compute api fakes. Change-Id: I525754ea065c7df9dfe1d093e4c94c02bebf4c02
This commit is contained in:
@@ -197,11 +197,11 @@ class InstanceBusy(NovaException):
|
||||
|
||||
|
||||
class InstanceSnapshotting(InstanceBusy):
|
||||
message = _("Instance %(instance_id)s is currently snapshotting.")
|
||||
message = _("Instance %(instance_uuid)s is currently snapshotting.")
|
||||
|
||||
|
||||
class InstanceBackingUp(InstanceBusy):
|
||||
message = _("Instance %(instance_id)s is currently being backed up.")
|
||||
message = _("Instance %(instance_uuid)s is currently being backed up.")
|
||||
|
||||
|
||||
class Invalid(NovaException):
|
||||
|
||||
@@ -333,10 +333,12 @@ class ComputeTestCase(BaseTestCase):
|
||||
|
||||
def test_snapshot(self):
|
||||
"""Ensure instance can be snapshotted"""
|
||||
instance_id = self._create_instance()
|
||||
instance = self._create_fake_instance()
|
||||
instance_id = instance['id']
|
||||
instance_uuid = instance['uuid']
|
||||
name = "myfakesnapshot"
|
||||
self.compute.run_instance(self.context, instance_id)
|
||||
self.compute.snapshot_instance(self.context, instance_id, name)
|
||||
self.compute.snapshot_instance(self.context, instance_uuid, name)
|
||||
self.compute.terminate_instance(self.context, instance_id)
|
||||
|
||||
def test_console_output(self):
|
||||
@@ -1316,21 +1318,20 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
|
||||
def test_snapshot(self):
|
||||
"""Can't backup an instance which is already being backed up."""
|
||||
instance_id = self._create_instance()
|
||||
instance = self.compute_api.get(self.context, instance_id)
|
||||
instance = self._create_fake_instance()
|
||||
self.compute_api.snapshot(self.context, instance, None, None)
|
||||
db.instance_destroy(self.context, instance_id)
|
||||
db.instance_destroy(self.context, instance['id'])
|
||||
|
||||
def test_backup(self):
|
||||
"""Can't backup an instance which is already being backed up."""
|
||||
instance_id = self._create_instance()
|
||||
instance = self.compute_api.get(self.context, instance_id)
|
||||
instance = self._create_fake_instance()
|
||||
self.compute_api.backup(self.context, instance, None, None, None)
|
||||
db.instance_destroy(self.context, instance_id)
|
||||
db.instance_destroy(self.context, instance['id'])
|
||||
|
||||
def test_backup_conflict(self):
|
||||
"""Can't backup an instance which is already being backed up."""
|
||||
instance_id = self._create_instance()
|
||||
instance = self._create_fake_instance()
|
||||
instance_id = instance['id']
|
||||
instance_values = {'task_state': task_states.IMAGE_BACKUP}
|
||||
db.instance_update(self.context, instance_id, instance_values)
|
||||
instance = self.compute_api.get(self.context, instance_id)
|
||||
@@ -1347,7 +1348,8 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
|
||||
def test_snapshot_conflict(self):
|
||||
"""Can't snapshot an instance which is already being snapshotted."""
|
||||
instance_id = self._create_instance()
|
||||
instance = self._create_fake_instance()
|
||||
instance_id = instance['id']
|
||||
instance_values = {'task_state': task_states.IMAGE_SNAPSHOT}
|
||||
db.instance_update(self.context, instance_id, instance_values)
|
||||
instance = self.compute_api.get(self.context, instance_id)
|
||||
|
||||
Reference in New Issue
Block a user