[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] new commands "xl reboot" & "xl shutdown"



On Sat, 8 May 2010, Gihan Munasinghe wrote:
> Guys
> 
> I patched xl to have "reboot" and "shutdown" commands.
> I tested this with hvm domains with and and without pv drivers seems to 
> work, of course the os level reboot and shutdown will only happen if 
> there are pv drivers with the dom U.
> 
> Also the libxl_domain_shutdown was not working for hvm guests without pv 
> drivers, I did a small patch to that as well. (same way xend shutdown 
> works used || instead of a && ). I would appreciate if someone can test 
> this more with hvm and pv domains.
> 
> Let me know what  you think
> 

Thanks for the patch!
It is mostly correct, however libxenlight changed quite a bit since xen
4.0 so could you please port your changes to xen-unstable?


> diff -Naur vanila/xen-4.0.0/tools/libxl/libxl.c 
> xen4patch/xen-4.0.0/tools/libxl/libxl.c
> --- vanila/xen-4.0.0/tools/libxl/libxl.c      2010-04-07 17:12:04.000000000 
> +0100
> +++ xen4patch/xen-4.0.0/tools/libxl/libxl.c   2010-05-07 23:14:26.000000000 
> +0100
> @@ -400,12 +400,12 @@
>      shutdown_path = libxl_sprintf(ctx, "%s/control/shutdown", dom_path);
>  
>      xs_write(ctx->xsh, XBT_NULL, shutdown_path, req_table[req], 
> strlen(req_table[req]));
> -    if (/* hvm */ 0) {
> +    if (/* hvm */ 1) {
>          unsigned long acpi_s_state = 0;
>          unsigned long pvdriver = 0;
>          xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_ACPI_S_STATE, 
> &acpi_s_state);
>          xc_get_hvm_param(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, &pvdriver);
> -        if (!pvdriver && acpi_s_state != 0)
> +        if (!pvdriver || acpi_s_state != 0)
>              xc_domain_shutdown(ctx->xch, domid, req);
>      }
>      return 0;

this should be correct

> diff -Naur vanila/xen-4.0.0/tools/libxl/xl.c 
> xen4patch/xen-4.0.0/tools/libxl/xl.c
> --- vanila/xen-4.0.0/tools/libxl/xl.c 2010-04-07 17:12:04.000000000 +0100
> +++ xen4patch/xen-4.0.0/tools/libxl/xl.c      2010-05-08 00:19:51.000000000 
> +0100
> @@ -702,9 +702,6 @@
>      if (debug)
>          printf_info(&info1, &info2, disks, num_disks, vifs, num_vifs, 
> pcidevs, num_pcidevs, vfbs, num_vfbs, vkbs, num_vkbs, &dm_info);
>  
> -start:
> -    domid = 0;
> -
>      if (libxl_ctx_init(&ctx, LIBXL_VERSION)) {
>          fprintf(stderr, "cannot init xl context\n");
>          return;
> @@ -712,6 +709,9 @@
>  
>      libxl_ctx_set_log(&ctx, log_callback, NULL);
>  
> +start:
> +    domid = 0;
> +
>      ret = libxl_domain_make(&ctx, &info1, &domid);
>      if (ret) {
>          fprintf(stderr, "cannot make domain: %d\n", ret);

this is probably not needed anymore

> @@ -830,8 +830,9 @@
>                              libxl_free_waiter(w2);
>                              free(w1);
>                              free(w2);
> -                            libxl_ctx_free(&ctx);
>                              LOG("Done. Rebooting now");
> +                            sleep(2);/*Fix Me: The sleep is put here to 
> slowdown the recreation of the domain 
> +                                       If this sleep it not there, 
> hvm_domain creation failes sometimes*/
>                              goto start;
>                          }
>                          LOG("Done. Exiting now");

since we don't free the ctx anymore here, it might be unnecessary.
The other changes look OK but we have a command table now, so they need
to be adapted.




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.