From d7c3d82d8ececa5b4b12547b5a00f8f206f06a37 Mon Sep 17 00:00:00 2001 From: Sonika Brahma Date: Thu, 18 Sep 2025 12:49:15 +0530 Subject: [PATCH] Made changes in smtclient.py Signed-off-by: Sonika Brahma --- zvmsdk/smtclient.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/zvmsdk/smtclient.py b/zvmsdk/smtclient.py index 9a014d6c3..db973a4f5 100644 --- a/zvmsdk/smtclient.py +++ b/zvmsdk/smtclient.py @@ -534,8 +534,27 @@ def get_power_state(self, userid): with zvmutils.log_and_reraise_smt_request_failed(action): results = self._request(requestData) with zvmutils.expect_invalid_resp_data(results): - status = results['response'][0].partition(': ')[2] - return status + vmcp_status = results['response'][0].partition(': ')[2] + if vmcp_status == "off": + return vmcp_status + cmd = ["/opt/zthin/bin/IUCV/iucvclnt", userid, "date"] + try: + result_iucv = subprocess.check_output(cmd, + close_fds=True, + stderr=subprocess.STDOUT) + IUCV_status = "on" + except subprocess.CalledProcessError as err: + rc = err.returncode + output = err.output + output = output.decode('utf-8').strip() + if "UNAUTHORIZED_ERROR" in output: + return vmcp_status + IUCV_status = "off" + except Exception as err: + msg = ("Could not find the userid of the smt server: %s") % err + LOG.error(msg) + IUCV_status = "off" + return IUCV_status def _check_power_state(self, userid, action): # Get the vm status