Add version

Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2015-02-20 13:27:26 -05:00
parent c8413b34a5
commit 1523de6a37
3 changed files with 25 additions and 11 deletions

View File

@ -17,7 +17,7 @@ import os
import lxc
from oslo.config import cfg
from oslo.utils import units
from oslo.utils import units, excutils
from nova.i18n import _, _LW, _LE, _LI
from nova.openstack.common import log as logging
@ -69,19 +69,30 @@ class Container(object):
admin_password, network_info, block_device_info, flavor):
LOG.info(_LI('Starting new instance'), instance=instance)
# Setup the LXC instance
instance_name = instance['uuid']
container = lxc.Container(instance_name)
container.set_config_path(CONF.lxd.lxd_root_dir)
try:
# Setup the LXC instance
instance_name = instance['uuid']
container = lxc.Container(instance_name)
container.set_config_path(CONF.lxd.lxd_root_dir)
''' Fetch the image from glance '''
self._fetch_image(context, instance, image_meta)
''' Fetch the image from glance '''
self._fetch_image(context, instance, image_meta)
''' Set up the configuration file '''
self._write_config(container, instance, network_info, image_meta)
''' Set up the configuration file '''
self._write_config(container, instance, network_info, image_meta)
''' Start the container '''
self._start_container(context, instance, network_info, image_meta)
''' Start the container '''
self._start_container(context, instance, network_info, image_meta)
except Exception as ex:
with excutils.save_and_reraise_exception():
self.destroy_container(context, instance, network_info,
block_device_info)
def destroy_container(self, context, instance, network_info, block_device_info,
destroy_disks=None, migrate_data=None):
self.client.stop(instance['uuid'])
self.client.destroy(instance['uuid'])
self.teardown_network(instance, network_info)
def get_container_info(self, instance):
instance_name = instance['uuid']

View File

@ -175,6 +175,8 @@ class LXDDriver(driver.ComputeDriver):
def destroy(self, context, instance, network_info, block_device_info=None,
destroy_disks=True, migrate_data=None):
return self.container.destroy_container(context, instance, network_info, block_device_info,
destroy_disks, migrate_data)
self.client.stop(instance['uuid'])
self.client.destroy(instance['uuid'])
self.cleanup(context, instance, network_info, block_device_info)

View File

@ -3,6 +3,7 @@ name = nclxd
summary = native lxd driver for openstack
description-file =
README.rst
version - 0.1
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/