Commit c6e0e9d
committed
fix(drivers): fix DOM child-removal and idempotent delete_machine
- document_set_tag/document_meta_set_tag used
root.getElementsByTagName(tag).removeChild(node), but
getElementsByTagName searches the whole subtree recursively; a match
found deeper than a direct child makes removeChild raise
xml.dom.NotFoundErr instead of removing anything (confirmed
empirically). New _remove_direct_children() only removes actual
direct children, shared by both methods.
- delete_machine() called lookupByUUIDString unguarded, crashing with
an uncaught libvirtError if the domain was already gone (e.g. a
retry after an earlier delete destroyed/undefined it but failed
later during volume cleanup). Now treats VIR_ERR_NO_DOMAIN as
nothing-to-do and proceeds straight to volume cleanup.
Tests use libvirt's built-in test:///default driver (real libvirt
calls, no daemon/VMs needed) for delete_machine, and minidom directly
for the child-removal regression. Also guards the test module's
libvirt-bound imports with pytest.importorskip so it skips cleanly
instead of failing collection where the libvirt bindings aren't
installed.1 parent ef31e66 commit c6e0e9d
2 files changed
Lines changed: 119 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
246 | 259 | | |
247 | 260 | | |
248 | 261 | | |
| |||
255 | 268 | | |
256 | 269 | | |
257 | 270 | | |
258 | | - | |
259 | | - | |
| 271 | + | |
260 | 272 | | |
261 | 273 | | |
262 | 274 | | |
263 | 275 | | |
264 | | - | |
265 | | - | |
| 276 | + | |
266 | 277 | | |
267 | 278 | | |
268 | 279 | | |
| |||
280 | 291 | | |
281 | 292 | | |
282 | 293 | | |
283 | | - | |
284 | | - | |
| 294 | + | |
285 | 295 | | |
286 | 296 | | |
287 | 297 | | |
| |||
1321 | 1331 | | |
1322 | 1332 | | |
1323 | 1333 | | |
1324 | | - | |
1325 | | - | |
1326 | | - | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1327 | 1338 | | |
1328 | | - | |
1329 | | - | |
1330 | | - | |
1331 | | - | |
1332 | | - | |
1333 | | - | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
1334 | 1354 | | |
1335 | 1355 | | |
1336 | 1356 | | |
| |||
Lines changed: 84 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
20 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
21 | 43 | | |
22 | 44 | | |
23 | 45 | | |
| |||
35 | 57 | | |
36 | 58 | | |
37 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
0 commit comments