From ec5c27a8afec53f167d30d8f81e23c1b42465d54 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 1 Dec 2017 15:56:34 -0500 Subject: [PATCH] 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 --- nova/virt/disk/vfs/guestfs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/virt/disk/vfs/guestfs.py b/nova/virt/disk/vfs/guestfs.py index 6e848bb72d82..135df6bec477 100644 --- a/nova/virt/disk/vfs/guestfs.py +++ b/nova/virt/disk/vfs/guestfs.py @@ -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