libvirt/po
Michael Chapman 89a5e25d05 qemuBlockJobSync*: introduce sync block job helpers
qemuBlockJobSyncBegin and qemuBlockJobSyncEnd delimit a region of code
where block job events are processed "synchronously".
qemuBlockJobSyncWait and qemuBlockJobSyncWaitWithTimeout wait for an
event generated by a block job.

The Wait* functions may be called multiple times while the synchronous
block job is active. Any pending block job event will be processed by
only when Wait* or End is called.  disk->blockJobStatus is reset by
these functions, so if it is needed a pointer to a
virConnectDomainEventBlockJobStatus variable should be passed as the
last argument. It is safe to pass NULL if you do not care about the
block job status.

All functions assume the VM object is locked. The Wait* functions will
unlock the object for as long as they are waiting. They will return -1
and report an error if the domain exits before an event is received.

Typical use is as follows:

  virQEMUDriverPtr driver;
  virDomainObjPtr vm; /* locked */
  virDomainDiskDefPtr disk;
  virConnectDomainEventBlockJobStatus status;

  qemuBlockJobSyncBegin(disk);

  ... start block job ...

  if (qemuBlockJobSyncWait(driver, vm, disk, &status) < 0) {
      /* domain died while waiting for event */
      ret = -1;
      goto error;
  }

  ... possibly start other block jobs
      or wait for further events ...

  qemuBlockJobSyncEnd(driver, vm, disk, NULL);

To perform other tasks periodically while waiting for an event:

  virQEMUDriverPtr driver;
  virDomainObjPtr vm; /* locked */
  virDomainDiskDefPtr disk;
  virConnectDomainEventBlockJobStatus status;
  unsigned long long timeout = 500 * 1000ull; /* milliseconds */

  qemuBlockJobSyncBegin(disk);

  ... start block job ...

  do {
      ... do other task ...

      if (qemuBlockJobSyncWaitWithTimeout(driver, vm, disk,
                                          timeout, &status) < 0) {
          /* domain died while waiting for event */
          ret = -1;
          goto error;
      }
  } while (status == -1);

  qemuBlockJobSyncEnd(driver, vm, disk, NULL);

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
2015-04-29 13:11:42 +02:00
..
ar.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
as.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
bg.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
bn_IN.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
bn.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
bs.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ca.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
cs.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
cy.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
da.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
de.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
el.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
en_GB.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
es.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
et.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
fi.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
fr.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
gl.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
gu.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
he.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
hi.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
hu.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
id.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
is.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
it.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ja.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ka.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
kn.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ko.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
libvirt.pot Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
lt.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
lv.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
mk.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ml.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
mr.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ms.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
nb.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
nl.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
nn.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
nso.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
or.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
pa.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
pl.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
POTFILES.in qemuBlockJobSync*: introduce sync block job helpers 2015-04-29 13:11:42 +02:00
pt_BR.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
pt.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ro.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ru.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
si.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
sk.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
sl.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
sq.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
sr.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
sr@latin.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
sv.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ta.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
te.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
th.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
tr.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
uk.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
ur.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
vi.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
zanata.xml po: Add config file for zanata 2015-02-23 09:45:02 +00:00
zh_CN.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
zh_TW.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00
zu.po Release of libvirt-1.2.14 2015-04-02 15:48:08 +08:00