Skip to content
This repository was archived by the owner on Sep 26, 2019. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions novadocker/virt/docker/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,9 @@ def reboot(self, context, instance, network_info, reboot_type,
container_id = self._find_container_by_name(instance['name']).get('id')
if not container_id:
return
if not self.docker.stop_container(container_id):
LOG.warning(_('Cannot stop the container, '
'please check docker logs'))
if not self.docker.start_container(container_id):
LOG.warning(_('Cannot restart the container, '
'please check docker logs'))

self.power_off(instance)
self.power_on(context, instance, network_info, block_device_info)

def power_on(self, context, instance, network_info, block_device_info):
container_id = self._find_container_by_name(instance['name']).get('id')
Expand All @@ -356,12 +353,15 @@ def power_on(self, context, instance, network_info, block_device_info):
raise exception.InstanceDeployFailure(msg.format(e),
instance_id=instance['name'])

def power_off(self, instance):
def power_off(self, instance, network_info=None):
container_id = self._find_container_by_name(instance['name']).get('id')
if not container_id:
return
self.docker.stop_container(container_id)

if network_info:
self.unplug_vifs(instance, network_info)

def pause(self, instance):
"""Pause the specified instance.

Expand Down