Fix bug 1010581

Set shutdown_terminate to False by default.
Fix related tests.

Change-Id: I194ea7f01e375a93ff73ee1560589f0eadc1b965
This commit is contained in:
Yun Mao
2012-06-08 11:27:20 -04:00
parent 470ccb85f2
commit 6041ad70d2
2 changed files with 5 additions and 5 deletions

View File

@@ -272,7 +272,9 @@ class Instance(BASE, NovaBase):
# EC2 instance_initiated_shutdown_teminate
# True: -> 'terminate'
# False: -> 'stop'
shutdown_terminate = Column(Boolean(), default=True, nullable=False)
# Note(maoy): currently Nova will always stop instead of terminate
# no matter what the flag says. So we set the default to False.
shutdown_terminate = Column(Boolean(), default=False, nullable=False)
# EC2 disable_api_termination
disable_terminate = Column(Boolean(), default=False, nullable=False)

View File

@@ -853,8 +853,6 @@ class CloudTestCase(test.TestCase):
test_instance_state(inst_state.RUNNING_CODE, inst_state.RUNNING,
power_state.RUNNING, vm_states.ACTIVE)
test_instance_state(inst_state.TERMINATED_CODE, inst_state.SHUTOFF,
power_state.NOSTATE, vm_states.SHUTOFF)
test_instance_state(inst_state.STOPPED_CODE, inst_state.STOPPED,
power_state.NOSTATE, vm_states.SHUTOFF,
{'shutdown_terminate': False})
@@ -2311,7 +2309,7 @@ class CloudTestCase(test.TestCase):
self.assertEqual(result, expected)
self._restart_compute_service()
test_dia_iisb('terminate', image_id='ami-1')
test_dia_iisb('stop', image_id='ami-1')
block_device_mapping = [{'device_name': '/dev/vdb',
'virtual_name': 'ephemeral0'}]
@@ -2357,7 +2355,7 @@ class CloudTestCase(test.TestCase):
self.stubs.UnsetAll()
self.stubs.Set(fake._FakeImageService, 'show', fake_show)
test_dia_iisb('terminate', image_id='ami-3')
test_dia_iisb('stop', image_id='ami-3')
test_dia_iisb('stop', image_id='ami-4')
test_dia_iisb('stop', image_id='ami-5')
test_dia_iisb('stop', image_id='ami-6')