[lxc-devel] [nova-lxd/master] Fix driver loading in newton
zulcss on Github
lxc-bot at linuxcontainers.org
Mon May 2 16:35:38 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 821 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160502/0bf85645/attachment.bin>
-------------- next part --------------
From a69911cf1c9369e358a4a4a663cdc3e25092a96f Mon Sep 17 00:00:00 2001
From: Chuck Short <chuck.short at canonical.com>
Date: Mon, 2 May 2016 12:28:37 -0400
Subject: [PATCH] Fix driver loading in newton
Recent nova commit 8eb03de1eb83a6cd2d4d41804e1b8253f94e5400 removed the
mechanism by which nova-powervm was loading its ComputeDriver from out
of tree.
With Change-Id: I78c0ca85cb6ee2e370214a89a203f6f099748930 we can now add
to the nova.virt namespace from the nova-lxd package.
This change set restores the ability to load the driver by creating a
thin shim into nova.virt.lxd.driver, passing through all public
symbols from nova_lxd.virt.lxd.driver.
Signed-off-by: Chuck Short <chuck.short at canonical.com>
---
devstack/plugin.sh | 2 +-
nova/__init__.py | 16 ++++++++++++++++
nova/virt/__init__.py | 18 ++++++++++++++++++
nova/virt/lxd/__init__.py | 0
nova/virt/lxd/driver.py | 17 +++++++++++++++++
setup.cfg | 3 +--
6 files changed, 53 insertions(+), 3 deletions(-)
create mode 100644 nova/__init__.py
create mode 100644 nova/virt/__init__.py
create mode 100644 nova/virt/lxd/__init__.py
create mode 100644 nova/virt/lxd/driver.py
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index bab1818..1a8cddc 100755
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -31,7 +31,7 @@ function install_nova-lxd() {
function configure_nova-lxd() {
# Configure the service.
- iniset $NOVA_CONF DEFAULT compute_driver nova_lxd.nova.virt.lxd.LXDDriver
+ iniset $NOVA_CONF DEFAULT compute_driver lxd.driver.LXDDriver
}
function init_nova-lxd() {
diff --git a/nova/__init__.py b/nova/__init__.py
new file mode 100644
index 0000000..3afd61b
--- /dev/null
+++ b/nova/__init__.py
@@ -0,0 +1,16 @@
+# Copyright 2016 Canonical Ltd
+#
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/nova/virt/__init__.py b/nova/virt/__init__.py
new file mode 100644
index 0000000..e7936dd
--- /dev/null
+++ b/nova/virt/__init__.py
@@ -0,0 +1,18 @@
+# Copyright 2016 Canonical Ltd.
+#
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# Allow composition of nova.virt namespace from disparate packages.
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/nova/virt/lxd/__init__.py b/nova/virt/lxd/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/nova/virt/lxd/driver.py b/nova/virt/lxd/driver.py
new file mode 100644
index 0000000..922937f
--- /dev/null
+++ b/nova/virt/lxd/driver.py
@@ -0,0 +1,17 @@
+# Copyright 2016 Canonical Ltd
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+import nova_lxd.nova.virt.lxd.driver as real_driver
+
+LXDDriver = real_driver.LXDDriver
diff --git a/setup.cfg b/setup.cfg
index fd84427..ad81a62 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -24,8 +24,7 @@ classifier =
[files]
packages =
nova_lxd
-namespace_packages =
- nova_lxd
+ nova.virt.lxd
[entry_points]
console_scripts =
More information about the lxc-devel
mailing list