add instance stop/start
This commit is contained in:
parent
4283cca63c
commit
3a9c757e46
4 changed files with 85 additions and 9 deletions
|
|
@ -20,6 +20,24 @@ class EC2Backend(BaseBackend):
|
|||
self.reservations[new_reservation.id] = new_reservation
|
||||
return new_reservation
|
||||
|
||||
def start_instances(self, instance_ids):
|
||||
started_instances = []
|
||||
for instance in self.all_instances():
|
||||
if instance.id in instance_ids:
|
||||
instance._state = InstanceState(0, 'pending')
|
||||
started_instances.append(instance)
|
||||
|
||||
return started_instances
|
||||
|
||||
def stop_instances(self, instance_ids):
|
||||
stopped_instances = []
|
||||
for instance in self.all_instances():
|
||||
if instance.id in instance_ids:
|
||||
instance._state = InstanceState(64, 'stopping')
|
||||
stopped_instances.append(instance)
|
||||
|
||||
return stopped_instances
|
||||
|
||||
def terminate_instances(self, instance_ids):
|
||||
terminated_instances = []
|
||||
for instance in self.all_instances():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue