Blame SOURCES/bz1287059-1-fence_rhevm-add-filter-header.patch

e4ffb1
From 03eee868ec5f3a07024a6b7c65572e54238106c6 Mon Sep 17 00:00:00 2001
e4ffb1
From: Rik Theys <Rik.Theys@esat.kuleuven.be>
e4ffb1
Date: Tue, 19 May 2015 13:24:09 +0200
e4ffb1
Subject: [PATCH 1/2] fence_rhevm: Add Filter header
e4ffb1
e4ffb1
oVirt users who only have the UserRole role don't have enough privileges
e4ffb1
to query the vm list, unless the Filter header is set to true.
e4ffb1
e4ffb1
See rhbz#1102801 for details.
e4ffb1
---
e4ffb1
 fence/agents/rhevm/fence_rhevm.py | 2 +-
e4ffb1
 1 file changed, 1 insertion(+), 1 deletion(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
e4ffb1
index 427bed5..cf85689 100644
e4ffb1
--- a/fence/agents/rhevm/fence_rhevm.py
e4ffb1
+++ b/fence/agents/rhevm/fence_rhevm.py
e4ffb1
@@ -87,7 +87,7 @@ def send_command(opt, command, method="GET"):
e4ffb1
 	conn = pycurl.Curl()
e4ffb1
 	web_buffer = StringIO.StringIO()
e4ffb1
 	conn.setopt(pycurl.URL, url)
e4ffb1
-	conn.setopt(pycurl.HTTPHEADER, ["Content-type: application/xml", "Accept: application/xml", "Prefer: persistent-auth"])
e4ffb1
+	conn.setopt(pycurl.HTTPHEADER, ["Content-type: application/xml", "Accept: application/xml", "Prefer: persistent-auth", "Filter: true"])
e4ffb1
 
e4ffb1
 	if opt.has_key("cookie"):
e4ffb1
 		conn.setopt(pycurl.COOKIE, opt["cookie"])
e4ffb1
-- 
e4ffb1
2.5.0
e4ffb1
e4ffb1
e4ffb1
From d19bb9b0e3ae285fbf36ef0fc0b76e7dccddb5d8 Mon Sep 17 00:00:00 2001
e4ffb1
From: Rik Theys <Rik.Theys@esat.kuleuven.be>
e4ffb1
Date: Tue, 19 May 2015 13:31:14 +0200
e4ffb1
Subject: [PATCH 2/2] fence_rhevm: Fill in outlet status in get_list
e4ffb1
e4ffb1
The outlet status was set to None for all outlets. This results in a
e4ffb1
traceback in fencing.py as it tries to execute the upper() function on
e4ffb1
the status. This is fine when the account that tries to access the data
e4ffb1
is an admin account as the list will be empty. If a UserRole user is
e4ffb1
used, the vm list is not empty and the error occurs.
e4ffb1
e4ffb1
Fill in the status of each vm in the outlet status to prevent the
e4ffb1
traceback.
e4ffb1
---
e4ffb1
 fence/agents/rhevm/fence_rhevm.py | 3 ++-
e4ffb1
 1 file changed, 2 insertions(+), 1 deletion(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
e4ffb1
index cf85689..3926f3b 100644
e4ffb1
--- a/fence/agents/rhevm/fence_rhevm.py
e4ffb1
+++ b/fence/agents/rhevm/fence_rhevm.py
e4ffb1
@@ -66,7 +66,8 @@ def get_list(conn, options):
e4ffb1
 		lines = res.split("
e4ffb1
 		for i in range(1, len(lines)):
e4ffb1
 			name = RE_GET_NAME.search(lines[i]).group(1)
e4ffb1
-			outlets[name] = ("", None)
e4ffb1
+			status = RE_STATUS.search(lines[i]).group(1)
e4ffb1
+			outlets[name] = ("", status)
e4ffb1
 	except AttributeError:
e4ffb1
 		return {}
e4ffb1
 	except IndexError:
e4ffb1
-- 
e4ffb1
2.5.0
e4ffb1