@@ -20,11 +20,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import copy
+import json
import os
import re
+from subprocess import CalledProcessError
+
import iotests
-import copy
-import json
from iotests import qemu_img, qemu_io
hd_path = [
@@ -216,11 +218,14 @@ class TestBlockdevReopen(iotests.QMPTestCase):
# Reopen an image several times changing some of its options
def test_reopen(self):
- # Check whether the filesystem supports O_DIRECT
- if 'O_DIRECT' in qemu_io('-f', 'raw', '-t', 'none', '-c', 'quit', hd_path[0]):
- supports_direct = False
- else:
+ try:
+ qemu_io('-f', 'raw', '-t', 'none', '-c', 'quit', hd_path[0])
supports_direct = True
+ except CalledProcessError as exc:
+ if 'O_DIRECT' in exc.stdout:
+ supports_direct = False
+ else:
+ raise
# Open the hd1 image passing all backing options
opts = hd_opts(1)
Merge with prior. This is a little more involved, now, but maybe it's a small price to pay for the better debug information being deployed universally. Signed-off-by: John Snow <jsnow@redhat.com> --- tests/qemu-iotests/245 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)