libxl: wait for console path before firing console_available
PATCH v4 1/1 libxl: wait for console path before firing console_available
If the path doesn't become available after LIBXL_INIT_TIMEOUT seconds, fail the domain creation.
If we skip the bootloader, the TTY path will be set by xenconsoled. However, there is no guarantee that this will happen by the time we want to call the console_available callback, so we have to wait.
---
Changed since v3 (after review by Anthony Perard):
* use libxl__console_tty_path
* move console_xswait_callback to proper place in file
* refactor console_xswait_callback so that it has a single "out" section
* move xswait_init to proper function (initiate_domain_create)
* add xswait_stop to cleanup (domcreate_complete)
* mention in commit message that we fail after a timeout
Changed since v2 (after review by Marek Marczykowski-Górecki):
* replace hardcoded value with LIBXL_INIT_TIMEOUT
Changed since v1:
* use xswait mechanism to add a timeout
tools/libxl/libxl_console.c | 4 +-- tools/libxl/libxl_create.c | 50 ++++++++++++++++++++++++++++++++++-- tools/libxl/libxl_internal.h | 3 +++ 3 files changed, 53 insertions(+), 4 deletions(-)
tools/libxl/libxl_console.c +2 -2
@@ -16,8 +16,8 @@#include "libxl_internal.h" -static int libxl__console_tty_path (libxl__gc *gc,uint32_t domid,int cons_num, -libxl_console_type type,char **tty_path) +int libxl__console_tty_path (libxl__gc *gc,uint32_t domid,int cons_num, +libxl_console_type type,char **tty_path) {int rc;char *dom_path;
tools/libxl/libxl_create.c +48 -2
87 lines not on this page · raw message
tools/libxl/libxl_internal.h +3 -0
@@ -1517,6 +1517,8 @@ _hidden char *libxl__domain_device_libxl_path(libxl__gc *gc, uint32_t domid, uin libxl__device_kind device_kind); _hidden int libxl__parse_backend_path(libxl__gc *gc, const char *path,libxl__device *dev); +_hidden int libxl__console_tty_path(libxl__gc *gc, uint32_t domid, int cons_num, +libxl_console_type type,char **tty_path); _hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev); _hidden int libxl__wait_for_backend(libxl__gc *gc, const char *be_path,const char *state);
@@ -4180,6 +4182,7 @@ struct libxl__domain_create_state {/* necessary if the domain creation failed and we have to destroy it */ libxl__domain_destroy_state dds;libxl__multidev multidev; +libxl__xswait_state console_xswait; }; _hidden int libxl__device_nic_set_devids(libxl__gc *gc,
Signature · 7 lines
2.21.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Paweł Marczewski
If the path doesn't become available after
LIBXL_INIT_TIMEOUTseconds, fail the domain creation.If we skip the bootloader, the TTY path will be set by xenconsoled. However, there is no guarantee that this will happen by the time we want to call the
console_availablecallback, so we have to wait.Signed-off-by Paweł Marczewski <[email protected]>Reviewed-by Marek Marczykowski-Górecki <[email protected]>
Thanks!
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Wei Liu
AppliedQuoted 4 lines · Anthony PERARD
Quoted 3 lines · Paweł Marczewski
If the path doesn't become available after
LIBXL_INIT_TIMEOUTseconds, fail the domain creation.
Quoted 8 lines
Quoted 6 lines
If we skip the bootloader, the TTY path will be set by xenconsoled. However, there is no guarantee that this will happen by the time we want to call the
console_availablecallback, so we have to wait.Signed-off-by Paweł Marczewski <[email protected]>Reviewed-by Marek Marczykowski-Górecki <[email protected]>Reviewed-by Anthony PERARD <[email protected]>
Applied. Thanks.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel