Skip to content

Commit

Permalink
Fix bug 1010581
Browse files Browse the repository at this point in the history
Set shutdown_terminate to False by default.
Fix related tests.

Change-Id: I194ea7f01e375a93ff73ee1560589f0eadc1b965
  • Loading branch information
maoy committed Jun 21, 2012
1 parent 470ccb8 commit 6041ad7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion nova/db/sqlalchemy/models.py
Expand Up @@ -272,7 +272,9 @@ def name(self):
# 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)
Expand Down
6 changes: 2 additions & 4 deletions nova/tests/api/ec2/test_cloud.py
Expand Up @@ -853,8 +853,6 @@ def test_instance_state(expected_code, expected_name,

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})
Expand Down Expand Up @@ -2311,7 +2309,7 @@ def test_dia_iisb(expected_result, **kwargs):
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'}]
Expand Down Expand Up @@ -2357,7 +2355,7 @@ def fake_show(self, context, id_):
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')

0 comments on commit 6041ad7

Please sign in to comment.