Univention Bugzilla – Attachment 5228 Details for
Bug 31371
UVMM event loop resync/replacement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Event loop resync
31371_UVMM-event-loop-cleanup.diff (text/plain), 7.59 KB, created by
Philipp Hahn
on 2013-05-16 08:48 CEST
(
hide
)
Description:
Event loop resync
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2013-05-16 08:48 CEST
Size:
7.59 KB
patch
obsolete
>diff --git a/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/45univention-management-console-module-uvmm.inst b/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/45univention-management-console-module-uvmm.inst >index 8ede938..86a9cc1 100755 >--- a/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/45univention-management-console-module-uvmm.inst >+++ b/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/45univention-management-console-module-uvmm.inst >@@ -41,6 +41,7 @@ eval "$(univention-config-registry shell)" > > umc_init > umc_operation_create "uvmm-all" "UCS Virtual Machine Manager" "" "uvmm/*" >+umc_operation_create "uvmm-ro" "UCS Virtual Machine Manager" "" uvmm/domain/get uvmm/domain/state uvmm/node/query uvmm/profile/get uvmm/profile/query uvmm/query uvmm/storage/pool/query uvmm/storage/volume/query > umc_policy_append "default-umc-all" "uvmm-all" > > joinscript_save_current_version >diff --git a/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/eventloop.py b/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/eventloop.py >index f4fe3ca..6d05b0d 100644 >--- a/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/eventloop.py >+++ b/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/eventloop.py >@@ -73,8 +73,7 @@ class virEventLoopPure: > self.cb(self.handle, > self.fd, > events, >- self.opaque[0], >- self.opaque[1]) >+ self.opaque) > > class virEventLoopPureTimer: > """This class contains the data we need to track for a single periodic timer.""" >@@ -102,8 +101,7 @@ class virEventLoopPure: > > def dispatch(self): > self.cb(self.timer, >- self.opaque[0], >- self.opaque[1]) >+ self.opaque) > > > def __init__(self, debug=False): >@@ -192,54 +190,53 @@ class virEventLoopPure: > these pointless repeated tiny sleeps.""" > sleep = -1 > self.runningPoll = True >- next = self.next_timeout() >- self.debug("Next timeout due at %d" % next) >- if next > 0: >- now = int(time.time() * 1000) >- if now >= next: >- sleep = 0 >- else: >- sleep = (next - now) / 1000.0 >- >- self.debug("Poll with a sleep of %d" % sleep) >- while True: >- try: >- events = self.poll.poll(sleep) >- break >- except select.error, (err, msg): >- if err != errno.EINTR: >- raise >- >- # Dispatch any file handle events that occurred >- for (fd, revents) in events: >- # See if the events was from the self-pipe >- # telling us to wakup. if so, then discard >- # the data just continue >- if fd == self.pipetrick[0]: >- self.pendingWakeup = False >- data = os.read(fd, 1) >- continue >- >- h = self.get_handle_by_fd(fd) >- if h: >- self.debug("Dispatch fd %d handle %d events %d" % (fd, h.get_id(), revents)) >- h.dispatch(self.events_from_poll(revents)) >- >- now = int(time.time() * 1000) >- for t in self.timers: >- interval = t.get_interval() >- if interval < 0: >- continue >- >- want = t.get_last_fired() + interval >- # Deduct 20ms, since schedular timeslice >- # means we could be ever so slightly early >- if now >= (want-20): >- self.debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want))) >- t.set_last_fired(now) >- t.dispatch() >+ try: >+ next = self.next_timeout() >+ self.debug("Next timeout due at %d" % next) >+ if next > 0: >+ now = int(time.time() * 1000) >+ if now >= next: >+ sleep = 0 >+ else: >+ sleep = (next - now) / 1000.0 >+ >+ self.debug("Poll with a sleep of %d" % sleep) >+ events = self.poll.poll(sleep) >+ >+ # Dispatch any file handle events that occurred >+ for (fd, revents) in events: >+ # See if the events was from the self-pipe >+ # telling us to wakup. if so, then discard >+ # the data just continue >+ if fd == self.pipetrick[0]: >+ self.pendingWakeup = False >+ data = os.read(fd, 1) >+ continue >+ >+ h = self.get_handle_by_fd(fd) >+ if h: >+ self.debug("Dispatch fd %d handle %d events %d" % (fd, h.get_id(), revents)) >+ h.dispatch(self.events_from_poll(revents)) > >- self.runningPoll = False >+ now = int(time.time() * 1000) >+ for t in self.timers: >+ interval = t.get_interval() >+ if interval < 0: >+ continue >+ >+ want = t.get_last_fired() + interval >+ # Deduct 20ms, since scheduler timeslice >+ # means we could be ever so slightly early >+ if now >= (want-20): >+ self.debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want))) >+ t.set_last_fired(now) >+ t.dispatch() >+ >+ except (os.error, select.error), e: >+ if e.args[0] != errno.EINTR: >+ raise >+ finally: >+ self.runningPoll = False > > def run_loop(self): > """Actually the event loop forever.""" >@@ -305,7 +302,7 @@ class virEventLoopPure: > """Change the periodic frequency of the timer.""" > for h in self.timers: > if h.get_id() == timerID: >- h.set_interval(interval); >+ h.set_interval(interval) > self.interrupt() > > self.debug("Update timer %d interval %d" % (timerID, interval)) >@@ -341,25 +338,25 @@ class virEventLoopPure: > if events & libvirt.VIR_EVENT_HANDLE_WRITABLE: > ret |= select.POLLOUT > if events & libvirt.VIR_EVENT_HANDLE_ERROR: >- ret |= select.POLLERR; >+ ret |= select.POLLERR > if events & libvirt.VIR_EVENT_HANDLE_HANGUP: >- ret |= select.POLLHUP; >+ ret |= select.POLLHUP > return ret > > def events_from_poll(self, events): > """Convert from poll() event constants, to libvirt events constants.""" >- ret = 0; >+ ret = 0 > if events & select.POLLIN: >- ret |= libvirt.VIR_EVENT_HANDLE_READABLE; >+ ret |= libvirt.VIR_EVENT_HANDLE_READABLE > if events & select.POLLOUT: >- ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE; >+ ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE > if events & select.POLLNVAL: >- ret |= libvirt.VIR_EVENT_HANDLE_ERROR; >+ ret |= libvirt.VIR_EVENT_HANDLE_ERROR > if events & select.POLLERR: >- ret |= libvirt.VIR_EVENT_HANDLE_ERROR; >+ ret |= libvirt.VIR_EVENT_HANDLE_ERROR > if events & select.POLLHUP: >- ret |= libvirt.VIR_EVENT_HANDLE_HANGUP; >- return ret; >+ ret |= libvirt.VIR_EVENT_HANDLE_HANGUP >+ return ret > > > ###########################################################################
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 31371
: 5228