def _create_domain_cleanup_lxc(self, instance):
    inst_path = libvirt_utils.get_instance_path(instance)
    container_dir = os.path.join(inst_path, 'rootfs')
    try:
        state = self.get_info(instance)['state']
    except exception.InstanceNotFound:
        state = None
    if (state == power_state.RUNNING):
        disk.clean_lxc_namespace(container_dir=container_dir)
    else:
        disk.teardown_container(container_dir=container_dir)
def _create_domain_cleanup_lxc(self, instance):
    inst_path = libvirt_utils.get_instance_path(instance)
    container_dir = os.path.join(inst_path, 'rootfs')
    try:
        state = self.get_info(instance)['state']
    except exception.InstanceNotFound:
        state = None
    if (state == power_state.RUNNING):
        disk.clean_lxc_namespace(container_dir=container_dir)
    else:
        disk.teardown_container(container_dir=container_dir)