Beispiel #1
0
 def test_status_rebuild_from_state(self):
     for vm_state in (vm_states.ACTIVE, vm_states.STOPPED, vm_states.ERROR):
         for task_state in (task_states.REBUILDING,
                            task_states.REBUILD_BLOCK_DEVICE_MAPPING,
                            task_states.REBUILD_SPAWNING):
             actual = common.status_from_state(vm_state, task_state)
             expected = 'REBUILD'
             self.assertEqual(expected, actual)
Beispiel #2
0
 def test_status_from_state(self):
     for vm_state in (vm_states.ACTIVE, vm_states.STOPPED):
         for task_state in (task_states.RESIZE_PREP,
                            task_states.RESIZE_MIGRATING,
                            task_states.RESIZE_MIGRATED,
                            task_states.RESIZE_FINISH):
             actual = common.status_from_state(vm_state, task_state)
             expected = 'RESIZE'
             self.assertEqual(expected, actual)
Beispiel #3
0
 def test_status_rebuild_from_state(self):
     for vm_state in (vm_states.ACTIVE, vm_states.STOPPED,
                      vm_states.ERROR):
         for task_state in (task_states.REBUILDING,
                            task_states.REBUILD_BLOCK_DEVICE_MAPPING,
                            task_states.REBUILD_SPAWNING):
             actual = common.status_from_state(vm_state, task_state)
             expected = 'REBUILD'
             self.assertEqual(expected, actual)
Beispiel #4
0
 def test_status_from_state(self):
     for vm_state in (vm_states.ACTIVE, vm_states.STOPPED):
         for task_state in (task_states.RESIZE_PREP,
                            task_states.RESIZE_MIGRATING,
                            task_states.RESIZE_MIGRATED,
                            task_states.RESIZE_FINISH):
             actual = common.status_from_state(vm_state, task_state)
             expected = 'RESIZE'
             self.assertEqual(expected, actual)
Beispiel #5
0
 def _get_vm_status(instance):
     # If the instance is deleted the vm and task states don't really matter
     if instance.get("deleted"):
         return "DELETED"
     return common.status_from_state(instance.get("vm_state"),
                                     instance.get("task_state"))
Beispiel #6
0
 def test_status_migrating_from_state(self):
     for vm_state in (vm_states.ACTIVE, vm_states.PAUSED):
         task_state = task_states.MIGRATING
         actual = common.status_from_state(vm_state, task_state)
         expected = 'MIGRATING'
         self.assertEqual(expected, actual)
Beispiel #7
0
 def test_status_migrating_from_state(self):
     for vm_state in (vm_states.ACTIVE, vm_states.PAUSED):
         task_state = task_states.MIGRATING
         actual = common.status_from_state(vm_state, task_state)
         expected = 'MIGRATING'
         self.assertEqual(expected, actual)
Beispiel #8
0
 def _get_vm_status(instance):
     # If the instance is deleted the vm and task states don't really matter
     if instance.get("deleted"):
         return "DELETED"
     return common.status_from_state(instance.get("vm_state"),
                                     instance.get("task_state"))