WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] xen: introduce xen_change_state_handler

To: Alexander Graf <agraf@xxxxxxx>
Subject: [Xen-devel] Re: [PATCH] xen: introduce xen_change_state_handler
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Thu, 30 Jun 2011 15:37:56 +0100
Cc: Anthony, Perard <anthony.perard@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "qemu-devel@xxxxxxxxxx" <qemu-devel@xxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Thu, 30 Jun 2011 07:34:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4E0C6802.6080200@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1309346169-14554-1-git-send-email-stefano.stabellini@xxxxxxxxxxxxx> <4E0C6802.6080200@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Thu, 30 Jun 2011, Alexander Graf wrote:
> On 06/29/2011 01:16 PM, stefano.stabellini@xxxxxxxxxxxxx wrote:
> > From: Anthony PERARD<anthony.perard@xxxxxxxxxx>
> >
> > Remove the call to xenstore_record_dm_state from xen_main_loop_prepare
> > that is HVM specific.
> > Add a new vm_change_state_handler shared between xen_pv and xen_hvm
> > machines to record the VM state to xenstore.
> >
> > Signed-off-by: Anthony PERARD<anthony.perard@xxxxxxxxxx>
> > Signed-off-by: Stefano Stabellini<stefano.stabellini@xxxxxxxxxxxxx>
> > ---
> >   xen-all.c |   25 ++++++++++++++++++-------
> >   1 files changed, 18 insertions(+), 7 deletions(-)
> >
> > diff --git a/xen-all.c b/xen-all.c
> > index 3fd04ef..e8da35f 100644
> > --- a/xen-all.c
> > +++ b/xen-all.c
> > @@ -797,12 +797,17 @@ void xenstore_store_pv_console_info(int i, 
> > CharDriverState *chr)
> >       }
> >   }
> >
> > -static void xenstore_record_dm_state(XenIOState *s, const char *state)
> > +static void xenstore_record_dm_state(struct xs_handle *xs, const char 
> > *state)
> >   {
> >       char path[50];
> >
> > +    if (xs == NULL) {
> > +        fprintf(stderr, "xenstore connection not initialized\n");
> > +        exit(1);
> > +    }
> > +
> >       snprintf(path, sizeof (path), 
> > "/local/domain/0/device-model/%u/state", xen_domid);
> > -    if (!xs_write(s->xenstore, XBT_NULL, path, state, strlen(state))) {
> > +    if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) {
> >           fprintf(stderr, "error recording dm state\n");
> >           exit(1);
> >       }
> > @@ -823,15 +828,20 @@ static void xen_main_loop_prepare(XenIOState *state)
> >       if (evtchn_fd != -1) {
> >           qemu_set_fd_handler(evtchn_fd, cpu_handle_ioreq, NULL, state);
> >       }
> > -
> > -    /* record state running */
> > -    xenstore_record_dm_state(state, "running");
> >   }
> >
> >
> >   /* Initialise Xen */
> >
> > -static void xen_vm_change_state_handler(void *opaque, int running, int 
> > reason)
> > +static void xen_change_state_handler(void *opaque, int running, int reason)
> > +{
> > +    if (running) {
> > +        /* record state running */
> > +        xenstore_record_dm_state(xenstore, "running");
> > +    }
> 
> So where is this ever executed in the PV case?
 
qemu_add_vm_change_state_handler(xen_change_state_handler, NULL) is now
called by xen_init, that is common between xen_pv and xen_fv machines

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