[PATCH 0/4] Introduce jobs for storage driver

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

 



Disk operations can take ages to finish. Therefore users
might want to abort such job, e.g. because host is going
down for maintenance. This patch set is trying to allow
this kind of behaviour. The inspiration was taken from
qemu driver.

How it works:
An API that is known to run for a long time, e.g. volume
allocation, wiping, have to find a pool which volume
belongs to. If the pool was found it is locked. During
this time the storage driver is locked. Now the API is
preparing for taking the operation. Ideally, it would be
sufficient to have only volume locked, but it requires
far more changes to code.

Just before the API is about to take the long term action,
storageBeginJob[WithPool] is called. This wait on a condition
specific for a volume. Similar to QEMU driver, wait is
limited in time. Timeout is set to 30 seconds.
Upon successful job acquire, a counter in the pool 
is incremented so the pool is prevented from destroy,
undef; Then the pool is unlocked.

After API finishes it's work, it calls storageEndJob[WithPool]
which reset job structure in the volume, re-locks
the pool, decrement the counter and broadcasts on
the condition.

Meanwhile, if the long term action is done internally,
it should be done in a cycle so we can check if job abort
wasn't signalized. If it is done by external program,
we can virCommandAbort() it.

Several improvements can be made, but I think this is
good for start.

NB, I've implemented job aborting for the both APIs using
streams, however wasn't very successful with aborting
a stream from the daemon site.

Michal Privoznik (4):
  storage: Introduce virStorageVolAbortJob
  virsh: Expose virStorageVolAbortJob
  storage: Implement jobs for storage driver
  storage: Implement virStorageVolAbortJob

 include/libvirt/libvirt.h.in     |    3 +
 src/conf/storage_conf.c          |   12 ++
 src/conf/storage_conf.h          |   29 +++-
 src/driver.h                     |    5 +
 src/libvirt.c                    |   49 +++++
 src/libvirt_private.syms         |    4 +
 src/libvirt_public.syms          |    1 +
 src/remote/remote_driver.c       |    1 +
 src/remote/remote_protocol.x     |    8 +-
 src/remote_protocol-structs      |    5 +
 src/storage/storage_backend.c    |   53 +++---
 src/storage/storage_backend_fs.c |    8 +-
 src/storage/storage_driver.c     |  408 ++++++++++++++++++++++++++++++--------
 src/storage/storage_driver.h     |    7 +
 tools/virsh.c                    |   39 ++++
 15 files changed, 516 insertions(+), 116 deletions(-)

-- 
1.7.8.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]