summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYun Mao <yunmao@gmail.com>2012-06-08 11:27:20 -0400
committerYun Mao <yunmao@gmail.com>2012-06-20 20:47:24 -0400
commit6041ad70d25aa4e015003e9df03d3f9759e09e6e (patch)
tree637d6c968f8881956c2ec3281c4177f052409a7f
parent470ccb85f2ecaff38973854e209f0fabdb117dc0 (diff)
downloadnova-6041ad70d25aa4e015003e9df03d3f9759e09e6e.tar.gz
nova-6041ad70d25aa4e015003e9df03d3f9759e09e6e.tar.xz
nova-6041ad70d25aa4e015003e9df03d3f9759e09e6e.zip
Fix bug 1010581
Set shutdown_terminate to False by default. Fix related tests. Change-Id: I194ea7f01e375a93ff73ee1560589f0eadc1b965
-rw-r--r--nova/db/sqlalchemy/models.py4
-rw-r--r--nova/tests/api/ec2/test_cloud.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index fc458e021..91dae5f0a 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -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)
diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py
index b981314dc..a6853a610 100644
--- a/nova/tests/api/ec2/test_cloud.py
+++ b/nova/tests/api/ec2/test_cloud.py
@@ -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')