mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmdbusd: Long running operations use own thread
Anything that ends up using polld will be done in a unique thread so that we don't hold off other operations from running concurrently.
This commit is contained in:
parent
fa444906bb
commit
72a943f720
@ -13,6 +13,7 @@ from .cmdhandler import options_to_cli_args
|
||||
import dbus
|
||||
from .utils import pv_range_append, pv_dest_ranges, log_error, log_debug
|
||||
import os
|
||||
import threading
|
||||
|
||||
|
||||
def pv_move_lv_cmd(move_options, lv_full_name,
|
||||
@ -126,3 +127,16 @@ def merge(interface_name, lv_uuid, lv_name, merge_options, job_state):
|
||||
raise dbus.exceptions.DBusException(
|
||||
interface_name,
|
||||
'LV with uuid %s and name %s not present!' % (lv_uuid, lv_name))
|
||||
|
||||
|
||||
def _run_cmd(req):
|
||||
log_debug(
|
||||
"_run_cmd: Running method: %s with args %s" %
|
||||
(str(req.method), str(req.arguments)))
|
||||
req.run_cmd()
|
||||
log_debug("_run_cmd: complete!")
|
||||
|
||||
|
||||
def cmd_runner(request):
|
||||
t = threading.Thread(target=_run_cmd, args=(request,))
|
||||
t.start()
|
||||
|
@ -108,7 +108,9 @@ class StateUpdate(object):
|
||||
except queue.Empty:
|
||||
pass
|
||||
|
||||
log_debug("Processing %d updates!" % len(queued_requests))
|
||||
if len(queued_requests) > 1:
|
||||
log_debug("Processing %d updates!" % len(queued_requests),
|
||||
'bg_black', 'fg_light_green')
|
||||
|
||||
# We have what we can, run the update with the needed options
|
||||
for i in queued_requests:
|
||||
|
@ -494,7 +494,7 @@ class Lv(LvCommon):
|
||||
pv_dests_and_ranges, move_options, job_state), cb, cbe, False,
|
||||
job_state)
|
||||
|
||||
cfg.worker_q.put(r)
|
||||
background.cmd_runner(r)
|
||||
|
||||
@staticmethod
|
||||
def _snap_shot(lv_uuid, lv_name, name, optional_size,
|
||||
@ -916,4 +916,4 @@ class LvSnapShot(Lv):
|
||||
(SNAPSHOT_INTERFACE, self.Uuid, self.lvm_id,
|
||||
merge_options, job_state), cb, cbe, False,
|
||||
job_state)
|
||||
cfg.worker_q.put(r)
|
||||
background.cmd_runner(r)
|
||||
|
@ -87,8 +87,6 @@ def main():
|
||||
log_error("You cannot specify --lvmshell and --nojson")
|
||||
sys.exit(1)
|
||||
|
||||
cmdhandler.set_execution(cfg.args.use_lvm_shell)
|
||||
|
||||
# List of threads that we start up
|
||||
thread_list = []
|
||||
|
||||
@ -102,6 +100,8 @@ def main():
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
dbus.mainloop.glib.threads_init()
|
||||
|
||||
cmdhandler.set_execution(cfg.args.use_lvm_shell)
|
||||
|
||||
if use_session:
|
||||
cfg.bus = dbus.SessionBus()
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user