47 lines
1.3 KiB
Diff
47 lines
1.3 KiB
Diff
|
From 29425375744cc04d85a1e25a839de47593913c87 Mon Sep 17 00:00:00 2001
|
||
|
From: Vincent Untz <vuntz@suse.com>
|
||
|
Date: Wed, 23 Mar 2016 11:03:24 +0100
|
||
|
Subject: [PATCH 2/9] fence_compute: Keep compatibility with python-novaclient
|
||
|
<= 2.26.0
|
||
|
|
||
|
---
|
||
|
fence/agents/compute/fence_compute.py | 15 ++++++++++++---
|
||
|
1 file changed, 12 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
|
||
|
index a4f62dc..265a347 100644
|
||
|
--- a/fence/agents/compute/fence_compute.py
|
||
|
+++ b/fence/agents/compute/fence_compute.py
|
||
|
@@ -324,7 +324,12 @@ def main():
|
||
|
run_delay(options)
|
||
|
|
||
|
try:
|
||
|
- from novaclient import client as nova_client
|
||
|
+ from distutils.version import LooseVersion
|
||
|
+ except ImportError:
|
||
|
+ fail_usage("distutils not found or not accessible")
|
||
|
+
|
||
|
+ try:
|
||
|
+ import novaclient
|
||
|
except ImportError:
|
||
|
fail_usage("nova not found or not accessible")
|
||
|
|
||
|
@@ -347,8 +352,12 @@ def main():
|
||
|
elif options["--action"] in ["monitor", "status"]:
|
||
|
sys.exit(0)
|
||
|
|
||
|
- # The first argument is the Nova client version
|
||
|
- nova = nova_client.Client('2.11',
|
||
|
+ if LooseVersion(novaclient.__version__) <= LooseVersion('2.26.0') :
|
||
|
+ api_version = '2'
|
||
|
+ else:
|
||
|
+ api_version = '2.11'
|
||
|
+
|
||
|
+ nova = novaclient.client.Client(api_version,
|
||
|
options["--username"],
|
||
|
options["--password"],
|
||
|
options["--tenant-name"],
|
||
|
--
|
||
|
2.8.3
|
||
|
|