Check the return code when forcing TCG mode with libguestfs

According to the guestfs docs:

http://libguestfs.org/guestfs.3.html#guestfs_set_backend_settings

This method returns a 0 on success and -1 on failure. We suspect
we might not be calling this correctly, so log a warning if it
returns a non-zero return code.

Change-Id: I14a5969667a6f6f4ae529aaf0f6b9475fdf25496
Related-Bug: #1735823
This commit is contained in:
Matt Riedemann 2017-12-01 15:56:34 -05:00
parent b6a245f042
commit ec5c27a8af
1 changed files with 5 additions and 1 deletions

View File

@ -192,7 +192,11 @@ class VFSGuestFS(vfs.VFS):
try:
if forceTCG:
self.handle.set_backend_settings("force_tcg")
ret = self.handle.set_backend_settings("force_tcg")
if ret != 0:
LOG.warning('Failed to force guestfs TCG mode. '
'guestfs_set_backend_settings returned: %s',
ret)
except AttributeError as ex:
# set_backend_settings method doesn't exist in older
# libguestfs versions, so nothing we can do but ignore