Milan Zamazal
2017-Feb-10 20:50 UTC
[libvirt-users] Determining domain job kind from job stats?
Hi, is there a reliable way to find out to what kind of job does the information returned from virDomainGetJobStats or provided in VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event callback belong to? I'm specifically interested in distinguishing host-to-host migration jobs (e.g. those started by virDomainMigrateToUri* functions) from other jobs. If there is no better way, I'm thinking about examining presence or values of certain fields in the stats. I'd be fine with that as long as I can be sure it's a reliable way to identify the job kind. Thanks, Milan
Jiri Denemark
2017-Feb-16 10:06 UTC
Re: [libvirt-users] Determining domain job kind from job stats?
On Fri, Feb 10, 2017 at 21:50:19 +0100, Milan Zamazal wrote:> Hi, is there a reliable way to find out to what kind of job does the > information returned from virDomainGetJobStats or provided in > VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event callback belong to?No, libvirt expects that the caller knows what job it started. All jobs currently reported using virDomainGetJobStats API or VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event are internally implemented as migration in QEMU driver (either to a file or to a network socket), which may confuse any heuristics for detecting the job type from the set of fields returned by libvirt. What is the problem you are trying to solve? Jirka
Milan Zamazal
2017-Feb-17 11:38 UTC
Re: [libvirt-users] Determining domain job kind from job stats?
Jiri Denemark <jdenemar@redhat.com> writes:> On Fri, Feb 10, 2017 at 21:50:19 +0100, Milan Zamazal wrote: >> Hi, is there a reliable way to find out to what kind of job does the >> information returned from virDomainGetJobStats or provided in >> VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event callback belong to? > > No, libvirt expects that the caller knows what job it started. All jobs > currently reported using virDomainGetJobStats API or > VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event are internally implemented as > migration in QEMU driver (either to a file or to a network socket), > which may confuse any heuristics for detecting the job type from the set > of fields returned by libvirt.I see, thank you for explanation.> What is the problem you are trying to solve?There are basically two problems: - When the job completion callback is called, I need to distinguish what kind of job was it to perform the appropriate actions. It would be easier if I knew the job type directly in the callback (no need to coordinate anything), but "external" job tracking is also possible. - If I lost track of my jobs (e.g. because of a crash and restart), I'd like to find out whether a given VM is migrating. Examining the job looked like a good candidate to get the information, but apparently it's not. Again, I can probably arrange things to handle that, but to get the information directly from libvirt (not necessarily via job info) would be easier and more reliable. Thanks, Milan