|
|
83de4b |
From 2735a4ee096f87fda2e94029db7f059d7be28464 Mon Sep 17 00:00:00 2001
|
|
|
83de4b |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
83de4b |
Date: Thu, 5 Sep 2019 10:28:18 +0200
|
|
|
83de4b |
Subject: [PATCH] fence_zvmip: fix Python 3 issues
|
|
|
83de4b |
|
|
|
83de4b |
---
|
|
|
83de4b |
agents/zvm/fence_zvmip.py | 8 ++++----
|
|
|
83de4b |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
83de4b |
|
|
|
83de4b |
diff --git a/agents/zvm/fence_zvmip.py b/agents/zvm/fence_zvmip.py
|
|
|
83de4b |
index 5fbe53e4..e6bb01d1 100644
|
|
|
83de4b |
--- a/agents/zvm/fence_zvmip.py
|
|
|
83de4b |
+++ b/agents/zvm/fence_zvmip.py
|
|
|
83de4b |
@@ -37,7 +37,7 @@ def open_socket(options):
|
|
|
83de4b |
return conn
|
|
|
83de4b |
|
|
|
83de4b |
def smapi_pack_string(string):
|
|
|
83de4b |
- return struct.pack("!i%ds" % (len(string)), len(string), string)
|
|
|
83de4b |
+ return struct.pack("!i%ds" % (len(string)), len(string), string.encode("UTF-8"))
|
|
|
83de4b |
|
|
|
83de4b |
def prepare_smapi_command(options, smapi_function, additional_args):
|
|
|
83de4b |
packet_size = 3*INT4 + len(smapi_function) + len(options["--username"]) + len(options["--password"])
|
|
|
83de4b |
@@ -126,7 +126,7 @@ def get_list_of_images(options, command, data_as_plug):
|
|
|
83de4b |
data = ""
|
|
|
83de4b |
|
|
|
83de4b |
while True:
|
|
|
83de4b |
- read_data = conn.recv(1024, socket.MSG_WAITALL)
|
|
|
83de4b |
+ read_data = conn.recv(1024, socket.MSG_WAITALL).decode("UTF-8")
|
|
|
83de4b |
data += read_data
|
|
|
83de4b |
if array_len == len(data):
|
|
|
83de4b |
break
|
|
|
83de4b |
@@ -136,9 +136,9 @@ def get_list_of_images(options, command, data_as_plug):
|
|
|
83de4b |
|
|
|
83de4b |
parsed_len = 0
|
|
|
83de4b |
while parsed_len < array_len:
|
|
|
83de4b |
- string_len = struct.unpack("!i", data[parsed_len:parsed_len+INT4])[0]
|
|
|
83de4b |
+ string_len = struct.unpack("!i", data[parsed_len:parsed_len+INT4].encode("UTF-8"))[0]
|
|
|
83de4b |
parsed_len += INT4
|
|
|
83de4b |
- image_name = struct.unpack("!%ds" % (string_len), data[parsed_len:parsed_len+string_len])[0]
|
|
|
83de4b |
+ image_name = struct.unpack("!%ds" % (string_len), data[parsed_len:parsed_len+string_len].encode("UTF-8"))[0].decode("UTF-8")
|
|
|
83de4b |
parsed_len += string_len
|
|
|
83de4b |
images.add(image_name)
|
|
|
83de4b |
|