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

Re: [libvirt] [PATCH 08/11] qemu: process: Refresh virtio channel guest state when connecting to mon



On Thu, Nov 20, 2014 at 22:22:56 +0100, Jiri Denemark wrote:
> On Wed, Nov 19, 2014 at 11:23:21 +0100, Peter Krempa wrote:
> > Use data provided by "query-chardev" to refresh the guest frontend state
> > of virtio channels.
> > ---
> >  src/qemu/qemu_process.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 66 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> > index f19963c..3c3ff66 100644
> > --- a/src/qemu/qemu_process.c
> > +++ b/src/qemu/qemu_process.c
> > @@ -2068,6 +2068,61 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm,
> > 
> > 
> >  static int
> > +qemuProcessRefreshChannelVirtioState(virDomainObjPtr vm,
> > +                                     virHashTablePtr info)
> > +{
> > +    size_t i;
> > +    qemuMonitorChardevInfoPtr entry;
> > +    char id[32];
> > +
> > +    for (i = 0; i < vm->def->nchannels; i++) {
> > +        virDomainChrDefPtr chr = vm->def->channels[i];
> > +        if (chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
> > +            if (snprintf(id, sizeof(id), "char%s",
> > +                         chr->info.alias) >= sizeof(id)) {
> > +                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > +                               _("failed to format device alias "
> > +                                 "for PTY retrieval"));
> > +                return -1;
> > +            }
> > +
> > +            /* port state not reported */
> > +            if (!(entry = virHashLookup(info, id)))
> > +                continue;

But of course, this should be changed to

                 if (!(entry = virHashLookup(info, id)) ||
                     !entry->state)

in case you decide to store all devices in the hash as I suggested in my
review to 7/11.

Jirka


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