libxl: don't end job for ephemeal domain on start failure
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 17 lines · Ian Campbell
commit
4b53d0d4ac9c"libxl: don't remove persistent domain on start failure" cleans up the vm object and sets it to NULL if the vm is not persistent, however at end job vm (now NULL) is dereferenced via the call to libxlDomainObjEndJob. Avoid this by skipping "endjob" and going straight to "cleanup" in this case.Signed-off-by Ian Campbell <[email protected]>--- src/libxl/libxl_driver.c | 1 + 1 file changed, 1 insertion(+)src/libxl/libxl_driver.c +0
-0
src/libxl/libxl_driver.c libxlDomainCreateXML(virConnectPtr conn, const char *xml, · line 998
Quoted 7 lines
src/libxl/libxl_driver.c +1
-0@@ -992,6 +992,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,if (!vm->persistent) {virDomainObjListRemove (driver->domains, vm); vm =NULL ; + goto cleanup; } goto endjob; }
While usually having cleanup label in between BeginJob and EndJob is causing troubles, here it is desired.
ACKed and pushed.
Although, looking at the code, maybe it's time to make it look more like qemu driver. I mean, wrapping EndJob(); vm= NULL; into one function. Do proper refcounting, etc.
Michal
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 28 lines · Michal Privoznik
Quoted 17 lines · Ian Campbell
commit
4b53d0d4ac9c"libxl: don't remove persistent domain on start failure" cleans up the vm object and sets it to NULL if the vm is not persistent, however at end job vm (now NULL) is dereferenced via the call to libxlDomainObjEndJob. Avoid this by skipping "endjob" and going straight to "cleanup" in this case.Signed-off-by Ian Campbell <[email protected]>--- src/libxl/libxl_driver.c | 1 + 1 file changed, 1 insertion(+)src/libxl/libxl_driver.c +0
-0src/libxl/libxl_driver.c libxlDomainCreateXML(virConnectPtr conn, const char *xml, · line 998
Quoted 7 lines
src/libxl/libxl_driver.c +1
-0@@ -992,6 +992,7 @@ libxlDomainCreateXML(virConnectPtr conn, const char *xml,if (!vm->persistent) {virDomainObjListRemove (driver->domains, vm); vm =NULL ; + goto cleanup; } goto endjob; }While usually having cleanup label in between BeginJob and EndJob is causing troubles, here it is desired.
Quoted 5 lines
ACKed and pushed.
Although, looking at the code, maybe it's time to make it look more like qemu driver. I mean, wrapping
EndJob(); vm= NULL; into one function. Do proper refcounting, etc.
I have a patch to do just that
https://www.redhat.com/archives/libvir-list/2015-June/msg00711.html
Sadly, I haven't found time to address Martin's latest comments, do another round of testing, and submit a V2.
Regards,
Jim