예제 #1
0
    def test_launch_instance(self):

        self.vmsconn.set_return_val("launch", None)
        launched_uuid = utils.create_pre_launched_instance(self.context)

        pre_launch_time = datetime.utcnow()
        self.gridcentric.launch_instance(self.context, instance_uuid=launched_uuid)

        launched_instance = db.instance_get_by_uuid(self.context, launched_uuid)
        self.assertNotEquals(None, launched_instance['power_state'])
        self.assertEquals("active", launched_instance['vm_state'])
        self.assertTrue(pre_launch_time <= launched_instance['launched_at'])
        self.assertEquals(None, launched_instance['task_state'])
        self.assertEquals(self.gridcentric.host, launched_instance['host'])
예제 #2
0
    def test_launch_instance(self):

        self.vmsconn.set_return_val("launch", None)
        launched_uuid = utils.create_pre_launched_instance(self.context)

        pre_launch_time = datetime.utcnow()
        self.gridcentric.launch_instance(self.context,
                                         instance_uuid=launched_uuid)

        launched_instance = db.instance_get_by_uuid(self.context,
                                                    launched_uuid)
        self.assertNotEquals(None, launched_instance['power_state'])
        self.assertEquals("active", launched_instance['vm_state'])
        self.assertTrue(pre_launch_time <= launched_instance['launched_at'])
        self.assertEquals(None, launched_instance['task_state'])
        self.assertEquals(self.gridcentric.host, launched_instance['host'])
예제 #3
0
    def test_launch_instance_exception(self):

        self.vmsconn.set_return_val("launch", utils.TestInducedException())
        launched_uuid = utils.create_pre_launched_instance(self.context)

        try:
            self.gridcentric.launch_instance(self.context, instance_uuid=launched_uuid)
            self.fail("The exception from launch should be re-raised up.")
        except utils.TestInducedException:
            pass

        launched_instance = db.instance_get_by_uuid(self.context, launched_uuid)
        self.assertEquals("error", launched_instance['vm_state'])
        self.assertEquals(None, launched_instance['task_state'])
        self.assertEquals(None, launched_instance['launched_at'])
        self.assertEquals(self.gridcentric.host, launched_instance['host'])
예제 #4
0
    def test_launch_instance_exception(self):

        self.vmsconn.set_return_val("launch", utils.TestInducedException())
        launched_uuid = utils.create_pre_launched_instance(self.context)

        try:
            self.gridcentric.launch_instance(self.context,
                                             instance_uuid=launched_uuid)
            self.fail("The exception from launch should be re-raised up.")
        except utils.TestInducedException:
            pass

        launched_instance = db.instance_get_by_uuid(self.context,
                                                    launched_uuid)
        self.assertEquals("error", launched_instance['vm_state'])
        self.assertEquals(None, launched_instance['task_state'])
        self.assertEquals(None, launched_instance['launched_at'])
        self.assertEquals(self.gridcentric.host, launched_instance['host'])