View | Details | Raw Unified | Return to bug 31371
Collapse All | Expand All

(-)a/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/45univention-management-console-module-uvmm.inst (+1 lines)
 Lines 41-46   eval "$(univention-config-registry shell)" Link Here 
41
41
42
umc_init
42
umc_init
43
umc_operation_create "uvmm-all" "UCS Virtual Machine Manager" "" "uvmm/*"
43
umc_operation_create "uvmm-all" "UCS Virtual Machine Manager" "" "uvmm/*"
44
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
44
umc_policy_append "default-umc-all" "uvmm-all"
45
umc_policy_append "default-umc-all" "uvmm-all"
45
46
46
joinscript_save_current_version
47
joinscript_save_current_version
(-)a/branches/ucs-3.1/ucs-3.1-2/virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/eventloop.py (-61 / +58 lines)
 Lines 73-80   class virEventLoopPure: Link Here 
73
            self.cb(self.handle,
73
            self.cb(self.handle,
74
                    self.fd,
74
                    self.fd,
75
                    events,
75
                    events,
76
                    self.opaque[0],
76
                    self.opaque)
77
                    self.opaque[1])
78
77
79
    class virEventLoopPureTimer:
78
    class virEventLoopPureTimer:
80
        """This class contains the data we need to track for a single periodic timer."""
79
        """This class contains the data we need to track for a single periodic timer."""
 Lines 102-109   class virEventLoopPure: Link Here 
102
101
103
        def dispatch(self):
102
        def dispatch(self):
104
            self.cb(self.timer,
103
            self.cb(self.timer,
105
                    self.opaque[0],
104
                    self.opaque)
106
                    self.opaque[1])
107
105
108
106
109
    def __init__(self, debug=False):
107
    def __init__(self, debug=False):
 Lines 192-245   class virEventLoopPure: Link Here 
192
        these pointless repeated tiny sleeps."""
190
        these pointless repeated tiny sleeps."""
193
        sleep = -1
191
        sleep = -1
194
        self.runningPoll = True
192
        self.runningPoll = True
195
        next = self.next_timeout()
193
        try:
196
        self.debug("Next timeout due at %d" % next)
194
            next = self.next_timeout()
197
        if next > 0:
195
            self.debug("Next timeout due at %d" % next)
198
            now = int(time.time() * 1000)
196
            if next > 0:
199
            if now >= next:
197
                now = int(time.time() * 1000)
200
                sleep = 0
198
                if now >= next:
201
            else:
199
                    sleep = 0
202
                sleep = (next - now) / 1000.0
200
                else:
203
201
                    sleep = (next - now) / 1000.0
204
        self.debug("Poll with a sleep of %d" % sleep)
202
205
        while True:
203
            self.debug("Poll with a sleep of %d" % sleep)
206
            try:
204
            events = self.poll.poll(sleep)
207
                events = self.poll.poll(sleep)
205
208
                break
206
            # Dispatch any file handle events that occurred
209
            except select.error, (err, msg):
207
            for (fd, revents) in events:
210
                if err != errno.EINTR:
208
                # See if the events was from the self-pipe
211
                    raise
209
                # telling us to wakup. if so, then discard
212
210
                # the data just continue
213
        # Dispatch any file handle events that occurred
211
                if fd == self.pipetrick[0]:
214
        for (fd, revents) in events:
212
                    self.pendingWakeup = False
215
            # See if the events was from the self-pipe
213
                    data = os.read(fd, 1)
216
            # telling us to wakup. if so, then discard
214
                    continue
217
            # the data just continue
215
218
            if fd == self.pipetrick[0]:
216
                h = self.get_handle_by_fd(fd)
219
                self.pendingWakeup = False
217
                if h:
220
                data = os.read(fd, 1)
218
                    self.debug("Dispatch fd %d handle %d events %d" % (fd, h.get_id(), revents))
221
                continue
219
                    h.dispatch(self.events_from_poll(revents))
222
223
            h = self.get_handle_by_fd(fd)
224
            if h:
225
                self.debug("Dispatch fd %d handle %d events %d" % (fd, h.get_id(), revents))
226
                h.dispatch(self.events_from_poll(revents))
227
228
        now = int(time.time() * 1000)
229
        for t in self.timers:
230
            interval = t.get_interval()
231
            if interval < 0:
232
                continue
233
234
            want = t.get_last_fired() + interval
235
            # Deduct 20ms, since schedular timeslice
236
            # means we could be ever so slightly early
237
            if now >= (want-20):
238
                self.debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want)))
239
                t.set_last_fired(now)
240
                t.dispatch()
241
220
242
        self.runningPoll = False
221
            now = int(time.time() * 1000)
222
            for t in self.timers:
223
                interval = t.get_interval()
224
                if interval < 0:
225
                    continue
226
227
                want = t.get_last_fired() + interval
228
                # Deduct 20ms, since scheduler timeslice
229
                # means we could be ever so slightly early
230
                if now >= (want-20):
231
                    self.debug("Dispatch timer %d now %s want %s" % (t.get_id(), str(now), str(want)))
232
                    t.set_last_fired(now)
233
                    t.dispatch()
234
235
        except (os.error, select.error), e:
236
            if e.args[0] != errno.EINTR:
237
                raise
238
        finally:
239
            self.runningPoll = False
243
240
244
    def run_loop(self):
241
    def run_loop(self):
245
        """Actually the event loop forever."""
242
        """Actually the event loop forever."""
 Lines 305-311   class virEventLoopPure: Link Here 
305
        """Change the periodic frequency of the timer."""
302
        """Change the periodic frequency of the timer."""
306
        for h in self.timers:
303
        for h in self.timers:
307
            if h.get_id() == timerID:
304
            if h.get_id() == timerID:
308
                h.set_interval(interval);
305
                h.set_interval(interval)
309
                self.interrupt()
306
                self.interrupt()
310
307
311
                self.debug("Update timer %d interval %d"  % (timerID, interval))
308
                self.debug("Update timer %d interval %d"  % (timerID, interval))
 Lines 341-365   class virEventLoopPure: Link Here 
341
        if events & libvirt.VIR_EVENT_HANDLE_WRITABLE:
338
        if events & libvirt.VIR_EVENT_HANDLE_WRITABLE:
342
            ret |= select.POLLOUT
339
            ret |= select.POLLOUT
343
        if events & libvirt.VIR_EVENT_HANDLE_ERROR:
340
        if events & libvirt.VIR_EVENT_HANDLE_ERROR:
344
            ret |= select.POLLERR;
341
            ret |= select.POLLERR
345
        if events & libvirt.VIR_EVENT_HANDLE_HANGUP:
342
        if events & libvirt.VIR_EVENT_HANDLE_HANGUP:
346
            ret |= select.POLLHUP;
343
            ret |= select.POLLHUP
347
        return ret
344
        return ret
348
345
349
    def events_from_poll(self, events):
346
    def events_from_poll(self, events):
350
        """Convert from poll() event constants, to libvirt events constants."""
347
        """Convert from poll() event constants, to libvirt events constants."""
351
        ret = 0;
348
        ret = 0
352
        if events & select.POLLIN:
349
        if events & select.POLLIN:
353
            ret |= libvirt.VIR_EVENT_HANDLE_READABLE;
350
            ret |= libvirt.VIR_EVENT_HANDLE_READABLE
354
        if events & select.POLLOUT:
351
        if events & select.POLLOUT:
355
            ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE;
352
            ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE
356
        if events & select.POLLNVAL:
353
        if events & select.POLLNVAL:
357
            ret |= libvirt.VIR_EVENT_HANDLE_ERROR;
354
            ret |= libvirt.VIR_EVENT_HANDLE_ERROR
358
        if events & select.POLLERR:
355
        if events & select.POLLERR:
359
            ret |= libvirt.VIR_EVENT_HANDLE_ERROR;
356
            ret |= libvirt.VIR_EVENT_HANDLE_ERROR
360
        if events & select.POLLHUP:
357
        if events & select.POLLHUP:
361
            ret |= libvirt.VIR_EVENT_HANDLE_HANGUP;
358
            ret |= libvirt.VIR_EVENT_HANDLE_HANGUP
362
        return ret;
359
        return ret
363
360
364
361
365
###########################################################################
362
###########################################################################

Return to bug 31371