[libvirt] [PATCH 4/6] qemu: Transfer migration statistics to destination

Jiri Denemark jdenemar at redhat.com
Tue Sep 9 09:14:39 UTC 2014


On Fri, Sep 05, 2014 at 14:47:09 -0400, John Ferlan wrote:
> 
> 
> On 09/01/2014 11:05 AM, Jiri Denemark wrote:
> > When migrating a transient domain or with VIR_MIGRATE_UNDEFINE_SOURCE
> > flag, the domain may disappear from source host. And so will migration
> > statistics associated with the domain. We need to transfer the
> > statistics at the end of a migration so that they can be queried at the
> > destination host.
> > 
> > Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> > ---
> >  src/qemu/qemu_migration.c | 190 +++++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 187 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> > index 208a21f..f1b3d50 100644
> > --- a/src/qemu/qemu_migration.c
> > +++ b/src/qemu/qemu_migration.c
...
> > @@ -589,6 +614,81 @@ qemuMigrationCookieNetworkXMLFormat(virBufferPtr buf,
> >  }
> >  
> >  
> > +static void
> > +qemuMigrationCookieStatisticsXMLFormat(virBufferPtr buf,
> > +                                       qemuDomainJobInfoPtr jobInfo)
> > +{
> > +    qemuMonitorMigrationStatus *status = &jobInfo->status;
> > +
> > +    virBufferAddLit(buf, "<statistics>\n");
> > +    virBufferAdjustIndent(buf, 2);
> > +
> > +    virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
> > +                      VIR_DOMAIN_JOB_TIME_ELAPSED,
> > +                      jobInfo->timeElapsed);
> > +    virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
> > +                      VIR_DOMAIN_JOB_TIME_REMAINING,
> > +                      jobInfo->timeRemaining);
> 
> qemuDomainJobInfoToParams will use jobInfo->type ==
> VIR_DOMAIN_JOB_BOUNDED when printing the above - dies this need to as well?

Not really, this just passes raw data from qemuDomainJobInfo and the
destination host will handle them in the same way. That is, it will
basically ignore this.

> I would suspect this would be zero anyway, right? Since the job is done.

Right. It's actually pretty useless but I just wanted to blindly
transfer anything that the source knows about without thinking whether
it's needed or not. The destination will interpret the data in the way
it needs to.

> > +    if (status->downtime_set)
> > +        virBufferAsprintf(buf, "<%1$s>%2$llu</%1$s>\n",
> > +                          VIR_DOMAIN_JOB_DOWNTIME,
> > +                          status->downtime);
> 
> What about the VIR_DOMAIN_JOB_DATA_* values? I know they are calculable,
> but since they're

Hmm, NMI in the middle of sentence? :-) Anyway, as I said the goal is to
transfer raw data from qemuDomainJobInfo rather than processed values
that the end user will get from virDomainGetJobStats. And
qemuDomainJobInfo only contains separated memory and disk data.

Jirka




More information about the libvir-list mailing list