@@ -446,12 +446,19 @@ def create_vms(request, host):
446
446
_import_vm (vm_def , host , vms , use_cache = CACHE_IMPORTED_VM )
447
447
yield vms
448
448
449
- # record this state
450
- for vm_def , vm in zip (vm_defs , vms ):
451
- # FIXME where to store?
452
- xva_name = f"{ shortened_nodeid (request .node .nodeid )} -{ vm_def ['name' ]} .xva"
453
- host .ssh (["rm -f" , xva_name ])
454
- vm .export (xva_name , "zstd" , use_cache = CACHE_IMPORTED_VM )
449
+ # request.node is an "item" because this fixture has "function" scope
450
+ report = request .node .stash [PHASE_REPORT_KEY ]
451
+ if report ["setup" ].failed :
452
+ logging .warning ("setting up a test failed or skipped: not exporting VMs" )
453
+ elif ("call" not in report ) or report ["call" ].failed :
454
+ logging .warning ("executing test failed or skipped: not exporting VMs" )
455
+ else :
456
+ # record this state
457
+ for vm_def , vm in zip (vm_defs , vms ):
458
+ # FIXME where to store?
459
+ xva_name = f"{ shortened_nodeid (request .node .nodeid )} -{ vm_def ['name' ]} .xva"
460
+ host .ssh (["rm -f" , xva_name ])
461
+ vm .export (xva_name , "zstd" , use_cache = CACHE_IMPORTED_VM )
455
462
456
463
except Exception :
457
464
logging .error ("exception caught..." )
0 commit comments