Skip to content

Commit

Permalink
libvirt_keywrap: handle hexdump when token unavailable
Browse files Browse the repository at this point in the history
Commit 3bcc957 switched to usage
of `hexdump`. Unfortunately, `hexdump` doesn't set error code
if no token can be read and instead just notifies
"hexdump: /sys/devices/virtual/misc/pkey/protkey/protkey_aes_128: No
such device".

Check for substring in output to handle this as if error code was set.

Signed-off-by: Sebastian Mitterle <[email protected]>
  • Loading branch information
smitterl committed Aug 9, 2021
1 parent 6143b1b commit 80bda1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virttest/utils_libvirt/libvirt_keywrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_some_aes_key_token(self):
attr_path = os.path.join(self.sysfs, some_key_attribute)
error, output = cmd_status_output(cmd="hexdump %s" % attr_path,
session=self.session)
if error:
if error or "No such device" in output:
logging.debug("Error reading from %s: %s", attr_path, output)
return None
return output
Expand Down

0 comments on commit 80bda1b

Please sign in to comment.