Change in vdsm[master]: yajsonrpc: switch to concurrent.thread()
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: yajsonrpc: switch to concurrent.thread()
......................................................................
yajsonrpc: switch to concurrent.thread()
This patch:
1. replaces good usages of threading.Thread() with
more modern concurrent.thread()
2. replaces bad usages of threading.Thread() - inheritance
with composition, leveraging concurrent.thread()
there are no intended changes in behaviour.
Change-Id: I42841c79e70755c0be5455949e33b84006930af0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/yajsonrpc/stompreactor.py
1 file changed, 3 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/61462/1
diff --git a/lib/yajsonrpc/stompreactor.py b/lib/yajsonrpc/stompreactor.py
index 509e251..9f4ad30 100644
--- a/lib/yajsonrpc/stompreactor.py
+++ b/lib/yajsonrpc/stompreactor.py
@@ -18,8 +18,8 @@
from collections import deque
from uuid import uuid4
import functools
-import threading
+from vdsm import concurrent
from vdsm import utils
from vdsm.config import config
from vdsm.compat import json
@@ -586,9 +586,8 @@
reactor = Reactor()
def start():
- thread = threading.Thread(target=reactor.process_requests,
- name='Client %s:%s' % (host, port))
- thread.setDaemon(True)
+ thread = concurrent.thread(reactor.process_requests,
+ name='Client %s:%s' % (host, port))
thread.start()
client = StompClient(utils.create_connected_socket(host, port, sslctx),
--
To view, visit https://gerrit.ovirt.org/61462
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I42841c79e70755c0be5455949e33b84006930af0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: spec: Require sanlock version handling EINTR
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: spec: Require sanlock version handling EINTR
......................................................................
spec: Require sanlock version handling EINTR
libsanlock was not handling EINTR, causing failures in sanlock calls if vdsm
received a signal while libsnalock was block in a syscall. A typical case is
when child process terminates and vdsm receive a SIGCHLD.
When this happens, the vdsm operation fails with this error:
SanlockException: (4, 'Sanlock ...', 'Interrupted system call')
The fix is not available yet on Fedora, so we only update to require the
current version, as we used to require an ancient version which is not relevant
for many releases.
Change-Id: I1203ad58f0f0ed1789a1e85d7f0b364891ef5864
Bug-Url: https://bugzilla.redhat.com/1356676
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/61200/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index d1f91cf..63c1e76 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -187,7 +187,17 @@
Requires: iscsi-initiator-utils >= 6.2.0.873-21
%endif
-Requires: sanlock >= 2.8-2, sanlock-python
+# sanlock
+
+%if 0%{rhel}
+Requires: sanlock >= sanlock-3.2.4-3.el7_2
+%endif
+
+%if 0%{fedora}
+Requires: sanlock >= 3.3.0-2
+%endif
+
+Requires: sanlock-python
# device-mapper-multipath
--
To view, visit https://gerrit.ovirt.org/61200
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1203ad58f0f0ed1789a1e85d7f0b364891ef5864
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: vdsm: add eventfd and EventFile synchronization
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: vdsm: add eventfd and EventFile synchronization
......................................................................
vdsm: add eventfd and EventFile synchronization
Change-Id: I0d237f13c42b1f4505c90d30c6d3c3ecbd1e9fa7
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M lib/vdsm/Makefile.am
A lib/vdsm/eventfd.py
M tests/Makefile.am
A tests/eventfdTests.py
4 files changed, 251 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/33687/1
diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am
index 4bebf28..e712cad 100644
--- a/lib/vdsm/Makefile.am
+++ b/lib/vdsm/Makefile.am
@@ -25,6 +25,7 @@
__init__.py \
compat.py \
define.py \
+ eventfd.py \
exception.py \
ipwrapper.py \
libvirtconnection.py \
diff --git a/lib/vdsm/eventfd.py b/lib/vdsm/eventfd.py
new file mode 100644
index 0000000..b2a7084
--- /dev/null
+++ b/lib/vdsm/eventfd.py
@@ -0,0 +1,140 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+"""\
+This module provides the support for eventfd(2).
+
+More information about eventfd and usage examples can be found in the
+eventfd(2) man page.
+
+The EventFile class provides a single synchronization object exposing
+the python Event interface and associated eventfds.
+
+The eventfd() context manager returns a file descriptor that can be
+used to provide the event notice to select, poll and epoll, e.g.
+
+ import os
+ import sys
+ import select
+ import threading
+ import time
+ from vdsm.eventfd import EventFile, DATASIZE
+
+ e = EventFile()
+ p = select.epoll()
+
+ threading.Timer(5, e.set).start()
+
+ with e.eventfd() as efd:
+ p.register(efd, select.EPOLLIN)
+ p.register(sys.stdin.fileno(), select.EPOLLIN)
+
+ print "Echoing lines until event is received"
+ event_received = False
+
+ while not event_received:
+ for fileno, event in p.poll():
+ if not event & select.EPOLLIN:
+ continue
+
+ if fileno == efd:
+ os.read(efd, DATASIZE)
+ event_received = True
+ elif fileno == sys.stdin.fileno():
+ print os.read(sys.stdin.fileno(), 1024),
+
+ print "Event received!"
+
+
+The Event set() semantic is preserved in the eventfd context manager:
+if the event is set then the eventfd already contains the notification.
+This is both to maintain the semantic and to avoid possible races as:
+
+ if not e.is_set():
+ with e.eventfd() as efd:
+ ...
+"""
+
+import os
+import ctypes
+import threading
+
+from contextlib import contextmanager
+
+_libc = ctypes.CDLL('libc.so.6', use_errno=True)
+
+EFD_NONBLOCK = os.O_NONBLOCK
+EFD_CLOEXEC = 02000000 # os.O_CLOEXEC in python 3.3
+EFD_SEMAPHORE = 00000001
+
+DATASIZE = ctypes.sizeof(ctypes.c_ulonglong)
+
+
+def eventfd(initval, flags):
+ return _libc.eventfd(initval, flags)
+
+
+class EventFile(object):
+ def __init__(self, event=None):
+ self.__lock = threading.Lock()
+ self.__fds = set()
+ self.__event = event or threading.Event()
+
+ @staticmethod
+ def __fire_event(fd):
+ os.write(fd, ctypes.c_ulonglong(1))
+
+ def open_eventfd(self):
+ with self.__lock:
+ fd = eventfd(0, 0)
+
+ self.__fds.add(fd)
+
+ if self.__event.is_set():
+ self.__fire_event(fd)
+
+ return fd
+
+ @contextmanager
+ def eventfd(self):
+ fd = self.open_eventfd()
+
+ yield fd
+
+ with self.__lock:
+ self.__fds.remove(fd)
+ os.close(fd)
+
+ def isSet(self):
+ return self.__event.isSet()
+
+ is_set = isSet
+
+ def set(self):
+ with self.__lock:
+ self.__event.set()
+ for fd in self.__fds:
+ self.__fire_event(fd)
+
+ def clear(self):
+ self.__event.clear()
+
+ def wait(self, timeout=None, balancing=True):
+ self.__event.wait(timeout)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 449d7b1..120712e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,6 +31,7 @@
clientifTests.py \
configNetworkTests.py \
domainMonitorTests.py \
+ eventfdTests.py \
fileVolumeTests.py \
fileUtilTests.py \
fuserTests.py \
diff --git a/tests/eventfdTests.py b/tests/eventfdTests.py
new file mode 100644
index 0000000..be15248
--- /dev/null
+++ b/tests/eventfdTests.py
@@ -0,0 +1,109 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import os
+import select
+from vdsm.eventfd import EventFile, DATASIZE
+from nose.tools import timed, raises, TimeExpired
+
+TEST_TIMEOUT = 1
+WAIT_TIMEOUT = 2
+
+
+def test_set():
+ e = EventFile()
+ e.set()
+ assert e.is_set()
+ assert e.isSet()
+
+
+def text_clear():
+ e = EventFile()
+ e.set()
+ assert e.is_set()
+ e.clear()
+ assert not e.is_set()
+
+
+@timed(TEST_TIMEOUT)
+def test_wait_set():
+ e = EventFile()
+ e.set()
+ e.wait(WAIT_TIMEOUT)
+
+
+@raises(TimeExpired)
+@timed(TEST_TIMEOUT)
+def test_wait_noset():
+ e = EventFile()
+ e.wait(WAIT_TIMEOUT)
+
+
+@timed(TEST_TIMEOUT)
+def test_eventfd_earlyset():
+ e = EventFile()
+ e.set()
+ with e.eventfd() as fd:
+ assert len(__select_and_read(fd)) == DATASIZE
+
+
+@timed(TEST_TIMEOUT)
+def test_eventfd_lateset():
+ e = EventFile()
+ with e.eventfd() as fd:
+ e.set()
+ assert len(__select_and_read(fd)) == DATASIZE
+
+
+@raises(TimeExpired)
+@timed(TEST_TIMEOUT)
+def test_eventfd_noset():
+ e = EventFile()
+ with e.eventfd() as fd:
+ assert len(__select_and_read(fd)) != DATASIZE
+
+
+@timed(TEST_TIMEOUT)
+def test_eventfd_multiple():
+ e = EventFile()
+ e.set()
+ with e.eventfd() as fd1:
+ assert len(__select_and_read(fd1)) == DATASIZE
+ with e.eventfd() as fd2:
+ assert len(__select_and_read(fd2)) == DATASIZE
+ with e.eventfd() as fd3:
+ assert len(__select_and_read(fd3)) == DATASIZE
+
+
+@raises(TimeExpired)
+@timed(TEST_TIMEOUT)
+def test_eventfd_clear():
+ e = EventFile()
+ e.set()
+ e.clear()
+ with e.eventfd() as fd:
+ assert len(__select_and_read(fd)) != DATASIZE
+
+
+def __select_and_read(fd):
+ rd, wr, ex = select.select((fd,), (), (), WAIT_TIMEOUT)
+ if fd in rd:
+ return os.read(fd, DATASIZE)
+ return ''
--
To view, visit http://gerrit.ovirt.org/33687
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d237f13c42b1f4505c90d30c6d3c3ecbd1e9fa7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: jobs: Move _run from sdm.base.Job to jobs.Job
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: jobs: Move _run from sdm.base.Job to jobs.Job
......................................................................
jobs: Move _run from sdm.base.Job to jobs.Job
The _run implementation in sdm.base.Job is generally useful. It performs state
checking and error handling that can be applicable to all job types. Move it
to job.Job. The tests associated with this functionality need to move to
jobsTests.py which means we no longer need storage_sdm_api_test.py or
sdmtestlib.py
Change-Id: I194eb154d70e846b7ec5d462faa26b3aa35d2ff6
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M lib/vdsm/jobs.py
M tests/Makefile.am
M tests/jobsTests.py
D tests/sdmtestlib.py
D tests/storage_sdm_api_test.py
M tests/storage_sdm_copy_data_test.py
M tests/storage_sdm_create_volume_test.py
M tests/testlib.py
M vdsm/storage/sdm/api/base.py
9 files changed, 73 insertions(+), 127 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/62001/1
diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py
index 2669c85..21b6cb0 100644
--- a/lib/vdsm/jobs.py
+++ b/lib/vdsm/jobs.py
@@ -22,7 +22,10 @@
import logging
import threading
+from vdsm import exception
from vdsm import response
+
+from vdsm.storage.threadlocal import vars
_lock = threading.Lock()
@@ -119,12 +122,35 @@
logging.info('Job %r aborting...', self._id)
self._abort()
+ def run(self):
+ self._status = STATUS.RUNNING
+ vars.job_id = self.id
+ try:
+ self._run()
+ except Exception as e:
+ logging.exception("Job (id=%s desc=%s) failed",
+ self.id, self.description)
+ if not isinstance(e, exception.VdsmException):
+ e = exception.GeneralException(str(e))
+ self._error = e
+ self._status = STATUS.FAILED
+ else:
+ self._status = STATUS.DONE
+ finally:
+ vars.job_id = None
+
def _abort(self):
"""
May be implemented by child class
"""
raise AbortNotSupported()
+ def _run(self):
+ """
+ Must be implemented by child class
+ """
+ raise NotImplementedError()
+
def __repr__(self):
s = "<{self.__class__.__name__} id={self.id} status={self.status} "
if self.progress is not None:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 467f2d4..f58a319 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -125,7 +125,6 @@
storage_hsm_test.py \
storage_monitor_test.py \
storage_rwlock_test.py \
- storage_sdm_api_test.py \
storage_sdm_copy_data_test.py \
storage_sdm_create_volume_test.py \
storage_volume_artifacts_test.py \
@@ -226,7 +225,6 @@
storageServerTests.py \
storage_rwlock_test.py \
storage_blkdiscard_test.py \
- storage_sdm_api_test.py \
storage_sdm_create_volume_test.py \
storage_sdm_copy_data_test.py \
storage_volume_artifacts_test.py \
@@ -338,7 +336,6 @@
fake-ssh-add \
fake-ssh-agent \
monkeypatch.py \
- sdmtestlib.py \
storagefakelib.py \
storagetestlib.py \
testlib.py \
diff --git a/tests/jobsTests.py b/tests/jobsTests.py
index bc5baef..dce6535 100644
--- a/tests/jobsTests.py
+++ b/tests/jobsTests.py
@@ -20,20 +20,29 @@
import uuid
from vdsm import exception, jobs, response, schedule
+from vdsm.storage.threadlocal import vars
from testlib import VdsmTestCase, expandPermutations, permutations
+from testlib import wait_for_job
class TestingJob(jobs.Job):
_JOB_TYPE = 'testing'
- def __init__(self, status=jobs.STATUS.PENDING):
+ def __init__(self, status=jobs.STATUS.PENDING, exception=None):
jobs.Job.__init__(self, str(uuid.uuid4()))
self._aborted = False
self._status = status
+ self._exception = exception
def _abort(self):
self._aborted = True
+
+ def _run(self):
+ assert(self.status == jobs.STATUS.RUNNING)
+ assert(vars.job_id == self.id)
+ if self._exception:
+ raise self._exception
class FooJob(TestingJob):
@@ -69,6 +78,13 @@
def tearDown(self):
jobs.stop()
+
+ def run_job(self, job):
+ self.assertEqual(jobs.STATUS.PENDING, job.status)
+ self.assertIsNone(getattr(vars, 'job_id', None))
+ job.run()
+ wait_for_job(job)
+ self.assertIsNone(getattr(vars, 'job_id', None))
def test_job_initial_state(self):
job = TestingJob()
@@ -231,3 +247,22 @@
job.progress = 32
rep = repr(job)
self.assertIn("progress=32%", rep)
+
+ def test_running_states(self):
+ job = TestingJob()
+ self.run_job(job)
+ self.assertEqual(jobs.STATUS.DONE, job.status)
+
+ def test_default_exception(self):
+ message = "testing failure"
+ job = TestingJob(exception=Exception(message))
+ self.run_job(job)
+ self.assertEqual(jobs.STATUS.FAILED, job.status)
+ self.assertIsInstance(job.error, exception.GeneralException)
+ self.assertIn(message, str(job.error))
+
+ def test_vdsm_exception(self):
+ job = TestingJob(exception=exception.VdsmException())
+ self.run_job(job)
+ self.assertEqual(jobs.STATUS.FAILED, job.status)
+ self.assertIsInstance(job.error, exception.VdsmException)
diff --git a/tests/sdmtestlib.py b/tests/sdmtestlib.py
deleted file mode 100644
index 8f95218..0000000
--- a/tests/sdmtestlib.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2015 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-import time
-
-
-def wait_for_job(job):
- while job.active:
- time.sleep(1)
diff --git a/tests/storage_sdm_api_test.py b/tests/storage_sdm_api_test.py
deleted file mode 100644
index c8d93d2..0000000
--- a/tests/storage_sdm_api_test.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Copyright 2016 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-import uuid
-
-from testlib import VdsmTestCase
-from sdmtestlib import wait_for_job
-
-from vdsm import jobs
-from vdsm import exception
-from vdsm.storage.threadlocal import vars
-
-from storage.sdm.api import base
-
-
-class ApiBaseTests(VdsmTestCase):
-
- def run_job(self, job):
- self.assertEqual(jobs.STATUS.PENDING, job.status)
- self.assertIsNone(getattr(vars, 'job_id', None))
- job.run()
- wait_for_job(job)
- self.assertIsNone(getattr(vars, 'job_id', None))
-
- def test_states(self):
- job = TestingJob()
- self.run_job(job)
- self.assertEqual(jobs.STATUS.DONE, job.status)
-
- def test_default_exception(self):
- message = "testing failure"
- job = TestingJob(Exception(message))
- self.run_job(job)
- self.assertEqual(jobs.STATUS.FAILED, job.status)
- self.assertIsInstance(job.error, exception.GeneralException)
- self.assertIn(message, str(job.error))
-
- def test_vdsm_exception(self):
- job = TestingJob(exception.VdsmException())
- self.run_job(job)
- self.assertEqual(jobs.STATUS.FAILED, job.status)
- self.assertIsInstance(job.error, exception.VdsmException)
-
-
-class TestingJob(base.Job):
-
- def __init__(self, exception=None):
- job_id = str(uuid.uuid4())
- super(TestingJob, self).__init__(job_id, 'testing_job', 'host_id')
- self.exception = exception
-
- def _run(self):
- assert(self.status == jobs.STATUS.RUNNING)
- assert(vars.job_id == self.id)
- if self.exception:
- raise self.exception
diff --git a/tests/storage_sdm_copy_data_test.py b/tests/storage_sdm_copy_data_test.py
index def8934..a92fa2c 100644
--- a/tests/storage_sdm_copy_data_test.py
+++ b/tests/storage_sdm_copy_data_test.py
@@ -28,7 +28,7 @@
from storagetestlib import make_qemu_chain, write_qemu_chain, verify_qemu_chain
from storagetestlib import ChainVerificationError
from testlib import VdsmTestCase, expandPermutations, permutations
-from sdmtestlib import wait_for_job
+from testlib import wait_for_job
from vdsm import jobs
from vdsm import qemuimg
diff --git a/tests/storage_sdm_create_volume_test.py b/tests/storage_sdm_create_volume_test.py
index 92f5e9f..ec6b065 100644
--- a/tests/storage_sdm_create_volume_test.py
+++ b/tests/storage_sdm_create_volume_test.py
@@ -25,7 +25,7 @@
from monkeypatch import MonkeyPatchScope
from storagefakelib import FakeResourceManager
from testlib import VdsmTestCase, recorded, expandPermutations, permutations
-from sdmtestlib import wait_for_job
+from testlib import wait_for_job
from vdsm import exception
from vdsm import jobs
diff --git a/tests/testlib.py b/tests/testlib.py
index aa44737..1f0cef6 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -35,6 +35,7 @@
from six.moves import range
import tempfile
import threading
+import time
from contextlib import contextmanager
import xml.etree.ElementTree as ET
@@ -577,3 +578,11 @@
path = os.path.join(dir_name, 'data', filename)
with open(path) as src:
return src.read()
+
+
+def wait_for_job(job):
+ """
+ Wait for a jobs.Job to complete (either success or failure)
+ """
+ while job.active:
+ time.sleep(1)
diff --git a/vdsm/storage/sdm/api/base.py b/vdsm/storage/sdm/api/base.py
index a342300..760f050 100644
--- a/vdsm/storage/sdm/api/base.py
+++ b/vdsm/storage/sdm/api/base.py
@@ -20,35 +20,12 @@
from __future__ import absolute_import
-import logging
-
from vdsm import jobs
-from vdsm import exception
-from vdsm.storage.threadlocal import vars
class Job(jobs.Job):
_JOB_TYPE = "storage"
- log = logging.getLogger('storage.sdmjob')
def __init__(self, job_id, desc, host_id):
super(Job, self).__init__(job_id, desc)
- self._status = jobs.STATUS.PENDING
self.host_id = host_id
-
- def run(self):
- self._status = jobs.STATUS.RUNNING
- vars.job_id = self.id
- try:
- self._run()
- except Exception as e:
- self.log.exception("Job (id=%s desc=%s) failed",
- self.id, self.description)
- if not isinstance(e, exception.VdsmException):
- e = exception.GeneralException(str(e))
- self._error = e
- self._status = jobs.STATUS.FAILED
- else:
- self._status = jobs.STATUS.DONE
- finally:
- vars.job_id = None
--
To view, visit https://gerrit.ovirt.org/62001
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I194eb154d70e846b7ec5d462faa26b3aa35d2ff6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: sdm: Drop support for thread-local job_id
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: sdm: Drop support for thread-local job_id
......................................................................
sdm: Drop support for thread-local job_id
sdm.api.base.Job currently has support for setting the job_id in the
thread-local variables. We are not using this feature so let's remove
it and simplify our _run code and tests. This will also _run (and
associated tests) to move to the general vdsm.jobs.Job class without
dragging in storage-specific interfaces.
Change-Id: Ia4697f2d3f5e6826e0e95e03a10445c2df2abddf
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/storage_sdm_api_test.py
M vdsm/storage/sdm/api/base.py
2 files changed, 1 insertion(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/62083/1
diff --git a/tests/storage_sdm_api_test.py b/tests/storage_sdm_api_test.py
index c8d93d2..5e0bce5 100644
--- a/tests/storage_sdm_api_test.py
+++ b/tests/storage_sdm_api_test.py
@@ -25,7 +25,6 @@
from vdsm import jobs
from vdsm import exception
-from vdsm.storage.threadlocal import vars
from storage.sdm.api import base
@@ -34,10 +33,8 @@
def run_job(self, job):
self.assertEqual(jobs.STATUS.PENDING, job.status)
- self.assertIsNone(getattr(vars, 'job_id', None))
job.run()
wait_for_job(job)
- self.assertIsNone(getattr(vars, 'job_id', None))
def test_states(self):
job = TestingJob()
@@ -68,6 +65,5 @@
def _run(self):
assert(self.status == jobs.STATUS.RUNNING)
- assert(vars.job_id == self.id)
if self.exception:
raise self.exception
diff --git a/vdsm/storage/sdm/api/base.py b/vdsm/storage/sdm/api/base.py
index a342300..79c46fc 100644
--- a/vdsm/storage/sdm/api/base.py
+++ b/vdsm/storage/sdm/api/base.py
@@ -24,7 +24,6 @@
from vdsm import jobs
from vdsm import exception
-from vdsm.storage.threadlocal import vars
class Job(jobs.Job):
@@ -38,7 +37,6 @@
def run(self):
self._status = jobs.STATUS.RUNNING
- vars.job_id = self.id
try:
self._run()
except Exception as e:
@@ -50,5 +48,4 @@
self._status = jobs.STATUS.FAILED
else:
self._status = jobs.STATUS.DONE
- finally:
- vars.job_id = None
+
--
To view, visit https://gerrit.ovirt.org/62083
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4697f2d3f5e6826e0e95e03a10445c2df2abddf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: Pass scheduler to jobs.start
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: Pass scheduler to jobs.start
......................................................................
Pass scheduler to jobs.start
In a subsequent patch the jobs module will want to defer calls to delete by
using the program's scheduler instance. Pass this scheduler into the jobs
module when calling start().
Change-Id: I5004b49b992ae0f7171a0f0549465cc8782d05da
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M lib/vdsm/jobs.py
M tests/jobsTests.py
M vdsm/vdsm
3 files changed, 8 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/62000/1
diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py
index 8f44059..2669c85 100644
--- a/lib/vdsm/jobs.py
+++ b/lib/vdsm/jobs.py
@@ -27,6 +27,7 @@
_lock = threading.Lock()
_jobs = {}
+_scheduler = None
class STATUS:
@@ -132,8 +133,9 @@
return s.format(self=self, id=id(self))
-def start():
- pass
+def start(scheduler):
+ global _scheduler
+ _scheduler = scheduler
def stop():
diff --git a/tests/jobsTests.py b/tests/jobsTests.py
index 5665d82..bc5baef 100644
--- a/tests/jobsTests.py
+++ b/tests/jobsTests.py
@@ -19,7 +19,7 @@
import uuid
-from vdsm import jobs, response, exception
+from vdsm import exception, jobs, response, schedule
from testlib import VdsmTestCase, expandPermutations, permutations
@@ -64,7 +64,8 @@
TIMEOUT = 1
def setUp(self):
- jobs.start()
+ scheduler = schedule.Scheduler()
+ jobs.start(scheduler)
def tearDown(self):
jobs.stop()
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 9c6367a..0c78795 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -100,7 +100,7 @@
scheduler = schedule.Scheduler(name="vdsm.Scheduler",
clock=utils.monotonic_time)
scheduler.start()
- jobs.start()
+ jobs.start(scheduler)
from clientIF import clientIF # must import after config is read
cif = clientIF.getInstance(irs, log, scheduler)
--
To view, visit https://gerrit.ovirt.org/62000
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5004b49b992ae0f7171a0f0549465cc8782d05da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: tests: Add GuardedLocks checking utility
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: tests: Add GuardedLocks checking utility
......................................................................
tests: Add GuardedLocks checking utility
We want to validate that sdm verbs are taking the proper locks in the
proper order. To make this validation easy to add to new sdm verbs we
introduce LockingChecker and the checked_locks context manager. The
context manager Monkeypatches the real lock implementations so that
acquire and release calls do nothing more than log the calls. It yields
a LockingChecker which can be used to verify the locking order against a
given list.
Change-Id: I9a2b78e6439b75cd60f99f8e756306297cfe51c0
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/storagetestlib.py
M tests/storagetestlibTests.py
2 files changed, 79 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/62467/1
diff --git a/tests/storagetestlib.py b/tests/storagetestlib.py
index 9559d68..0d256e5 100644
--- a/tests/storagetestlib.py
+++ b/tests/storagetestlib.py
@@ -387,3 +387,42 @@
if self._log is not None:
entry = ('release', self._ns, self._name, self._mode)
self._log.append(entry)
+
+
+class LockingChecker(object):
+ def __init__(self):
+ self._calls = []
+
+ @property
+ def calls(self):
+ return [c[1] for c in self._calls]
+
+ def acquire(self, name):
+ self._calls.append(('a', name))
+
+ def release(self, name):
+ self._calls.append(('r', name))
+
+ def validate(self, locks):
+ calls = [('a', l) for l in locks] + [('r', l) for l in reversed(locks)]
+ if calls != self._calls:
+ raise AssertionError("Locking order validation failed: "
+ "expecting %r, got %r", calls, self._calls)
+
+
+@contextmanager
+def checked_locks():
+ def checked_acquire(lock):
+ checker.acquire(lock.name)
+
+ def checked_release(lock):
+ checker.release(lock.name)
+
+ checker = LockingChecker()
+ with MonkeyPatchScope([
+ (guarded.ResourceManagerLock, 'acquire', checked_acquire),
+ (guarded.ResourceManagerLock, 'release', checked_release),
+ (guarded.VolumeLease, 'acquire', checked_acquire),
+ (guarded.VolumeLease, 'release', checked_release),
+ ]):
+ yield checker
diff --git a/tests/storagetestlibTests.py b/tests/storagetestlibTests.py
index 0dd160a..0a6f2b0 100644
--- a/tests/storagetestlibTests.py
+++ b/tests/storagetestlibTests.py
@@ -32,12 +32,15 @@
from storagetestlib import qemu_pattern_write, qemu_pattern_verify
from storagetestlib import make_qemu_chain, write_qemu_chain, verify_qemu_chain
from storagetestlib import ChainVerificationError
+from storagetestlib import LockingChecker
+from storagetestlib import checked_locks
from storage import blockSD, fileSD, fileVolume, sd
from vdsm import qemuimg
from vdsm import utils
from vdsm.storage import constants as sc
+from vdsm.storage import guarded
MB = 1024 ** 2
@@ -271,3 +274,40 @@
# XXX: Replace calls to this function with the proper manifest APIs once
# the set* methods are moved from StorageDomain to StorageDomainManifest.
manifest._metadata.update(params)
+
+
+class LockingCheckerTest(VdsmTestCase):
+
+ def test_no_calls(self):
+ checker = LockingChecker()
+ checker.validate([])
+
+ def test_validate(self):
+ checker = LockingChecker()
+ locks = ('A', 'B', 'C')
+ for l in locks:
+ checker.acquire(l)
+ for l in reversed(locks):
+ checker.release(l)
+ checker.validate(locks)
+
+ def test_out_of_order_raises(self):
+ checker = LockingChecker()
+ locks = ('A', 'B', 'C')
+ for l in locks:
+ checker.acquire(l)
+ for l in locks:
+ checker.release(l)
+ self.assertRaises(AssertionError, checker.validate, locks)
+
+
+class CheckedLocksTest(VdsmTestCase):
+ def test_context(self):
+ res_lock = guarded.ResourceManagerLock('r_ns', 'r_name', 'r_mode')
+ vol_lease = guarded.VolumeLease('host_id', 'sd', 'img', 'vol')
+ with checked_locks() as checker:
+ res_lock.acquire()
+ vol_lease.acquire()
+ vol_lease.release()
+ res_lock.release()
+ checker.validate(['r_name', 'vol'])
--
To view, visit https://gerrit.ovirt.org/62467
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a2b78e6439b75cd60f99f8e756306297cfe51c0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: yml: schema validation tests
by Piotr Kliczewski
Piotr Kliczewski has uploaded a new change for review.
Change subject: yml: schema validation tests
......................................................................
yml: schema validation tests
Change-Id: I2420908ebb39136339a5a52daf12f359836c5291
Signed-off-by: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
---
M tests/vdsmapi_test.py
1 file changed, 216 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/60071/1
diff --git a/tests/vdsmapi_test.py b/tests/vdsmapi_test.py
index 9ae1668..30f5c9a 100644
--- a/tests/vdsmapi_test.py
+++ b/tests/vdsmapi_test.py
@@ -458,3 +458,219 @@
sub_id = '|virt|VM_status|426aef82-ea1d-4442-91d3-fd876540e0f0'
_events_schema.events_schema().verify_event_params(sub_id, params)
+
+ def test_connect_server(self):
+ params = {u'connectionParams':
+ [{u'id': u'a454a600-b3b7-46ea-8032-717deedcd219',
+ u'connection': u'10.35.0.99',
+ u'iqn': u'iqn.2003-01.org.dumbo.target1',
+ u'user': u'',
+ u'tpgt': u'1',
+ u'password': '********',
+ u'port': u'3260'},
+ {u'id': u'48b086ae-6d80-4d6f-96ac-43c6ffcaab3e',
+ u'connection': u'10.35.0.99',
+ u'iqn': u'iqn.2003-01.org.dumbo.target2',
+ u'user': u'',
+ u'tpgt': u'1',
+ u'password': '********',
+ u'port': u'3260'}],
+ u'storagepoolID': u'636d9c59-f7ba-4115-87a1-44d6563a9610',
+ u'domainType': 3}
+
+ _schema.schema().verify_args(
+ vdsmapi.MethodRep('StoragePool', 'connectStorageServer'),
+ params)
+
+ def test_sp_connect(self):
+ params = {u'masterVersion': 33,
+ u'domainDict':
+ {u'0900c0cd-8422-497a-85c5-1bb34b2b6b65': u'active',
+ u'794dc113-315f-43e3-ae47-0b7b1bf56427': u'active',
+ u'1d8235ee-c2ce-4c06-abd5-63b655fd66c5': u'active'},
+ u'storagepoolID': u'636d9c59-f7ba-4115-87a1-44d6563a9610',
+ u'scsiKey': u'636d9c59-f7ba-4115-87a1-44d6563a9610',
+ u'masterSdUUID': u'3d4accf7-74af-4ea0-b59b-eb9f10eedb83',
+ u'hostID': 1}
+
+ _schema.schema().verify_args(
+ vdsmapi.MethodRep('StoragePool', 'connect'), params)
+
+ def test_host_list_caps(self):
+ ret = {'net_eth0_52_54_00_56_00_39':
+ {'params': {'capability': 'net',
+ 'interface': 'eth0',
+ 'parent': 'pci_0000_00_03_0',
+ 'is_assignable': 'true'}},
+ 'computer':
+ {'params': {'capability': 'system',
+ 'is_assignable': 'true',
+ 'product': 'Standard PC (i440FX + PIIX, 1996)'}},
+ 'usb_1_1_1_0':
+ {'params': {'capability': 'usb',
+ 'is_assignable': 'true',
+ 'driver': 'usbhid',
+ 'parent': 'usb_1_1'}},
+ 'scsi_target7_0_0':
+ {'params': {'capability': 'scsi_target',
+ 'is_assignable': 'true',
+ 'parent': 'scsi_host7'}},
+ 'usb_usb1':
+ {'params': {'product': '2.0 root hub',
+ 'vendor': 'Linux Foundation',
+ 'product_id': '0x0002',
+ 'parent': 'pci_0000_00_05_7',
+ 'vendor_id': '0x1d6b',
+ 'driver': 'usb',
+ 'capability': 'usb_device',
+ 'is_assignable': 'true',
+ 'address': {'device': '1', 'bus': '1'}}},
+ 'pci_0000_00_02_0':
+ {'params': {'product': 'QXL paravirtual graphic card',
+ 'vendor': 'Red Hat, Inc.',
+ 'product_id': '0x0100',
+ 'parent': 'computer',
+ 'vendor_id': '0x1b36',
+ 'driver': 'qxl',
+ 'capability': 'pci',
+ 'is_assignable': 'true',
+ 'address': {'slot': '2',
+ 'bus': '0',
+ 'domain': '0',
+ 'function': '0'}}},
+ 'scsi_5_0_0_18':
+ {'params': {'product': 'target1-18',
+ 'vendor': 'LIO-ORG',
+ 'parent': 'scsi_target5_0_0',
+ 'driver': 'sd',
+ 'capability': 'scsi',
+ 'is_assignable': 'true',
+ 'udev_path': '/dev/sg2',
+ 'address': {'bus': '0',
+ 'host': '5',
+ 'target': '0',
+ 'lun': '18'}}},
+ 'scsi_host5':
+ {'params': {'capability': 'scsi_host',
+ 'is_assignable': 'true',
+ 'parent': 'computer'}},
+ 'scsi_generic_sg26':
+ {'params': {'capability': 'scsi_generic',
+ 'is_assignable': 'true',
+ 'udev_path': '/dev/sg26',
+ 'parent': 'scsi_6_0_0_14'}},
+ 'scsi_6_0_0_14':
+ {'params': {'product': 'target2-14',
+ 'vendor': 'LIO-ORG',
+ 'parent': 'scsi_target6_0_0',
+ 'driver': 'sd',
+ 'capability': 'scsi',
+ 'is_assignable': 'true',
+ 'udev_path': '/dev/sg26',
+ 'address': {'bus': '0',
+ 'host': '6',
+ 'target': '0',
+ 'lun': '14'}}},
+ 'block_sdr_36001405292bb96f19064f81b884fa63f':
+ {'params': {'capability': 'storage',
+ 'is_assignable': 'true',
+ 'product': 'target1-03',
+ 'vendor': 'LIO-ORG',
+ 'parent': 'scsi_5_0_0_3'}}}
+
+ _schema.schema().verify_retval(
+ vdsmapi.MethodRep('Host', 'hostdevListByCaps'), ret)
+
+ def test_start_spm(self):
+ params = {u'prevLver': u'-1',
+ u'enableScsiFencing': u'false',
+ u'storagepoolID': u'636d9c59-f7ba-4115-87a1-44d6563a9610',
+ u'prevID': -1,
+ u'domVersion': u'3',
+ u'maxHostID': 250}
+
+ _schema.schema().verify_args(
+ vdsmapi.MethodRep('StoragePool', 'spmStart'), params)
+
+ def test_task_status(self):
+ ret = {'code': 0,
+ 'message': 'running job 1 of 1',
+ 'taskState': 'running',
+ 'taskResult': '',
+ 'taskID': '72fdf1ca-8826-4688-9c8c-e175d4253e2a'}
+
+ _schema.schema().verify_retval(
+ vdsmapi.MethodRep('Task', 'getStatus'), ret)
+
+ def test_spm_status(self):
+ ret = {'spmId': 1, 'spmStatus': 'SPM', 'spmLver': 10}
+
+ _schema.schema().verify_retval(
+ vdsmapi.MethodRep('StoragePool', 'getSpmStatus'), ret)
+
+ def test_info_storage(self):
+ ret = {'info':
+ {'name': 'No Description',
+ 'isoprefix': '',
+ 'pool_status': 'connected',
+ 'lver': 10,
+ 'domains': u'0900c0cd-8422-497a-85c5-1bb34b2b6b65:Active,794d',
+ 'master_uuid': '3d4accf7-74af-4ea0-b59b-eb9f10eedb83',
+ 'version': '3',
+ 'spm_id': 1,
+ 'type': 'ISCSI',
+ 'master_ver': 33},
+ 'dominfo': {u'0900c0cd-8422-497a-85c5-1bb34b2b6b65':
+ {'status': u'Active',
+ 'diskfree': '48855252992',
+ 'isoprefix': '',
+ 'alerts': [],
+ 'disktotal': '53284438016',
+ 'version': 3},
+ u'794dc113-315f-43e3-ae47-0b7b1bf56427':
+ {'status': u'Active',
+ 'diskfree': '48855252992',
+ 'isoprefix': '',
+ 'alerts': [],
+ 'disktotal': '53284438016',
+ 'version': 3}}}
+
+ _schema.schema().verify_retval(
+ vdsmapi.MethodRep('StoragePool', 'getInfo'), ret)
+
+ def test_volume_group_info(self):
+ ret = {'state': 'OK',
+ 'vgsize': '53284438016',
+ 'name': 'b0d9c2e8-00e9-4e0e-a5d9-f9e17bb59974',
+ 'vgfree': '48855252992',
+ 'vgUUID': 'aE6hIQ-WY4M-yvgK-rNQi-YN4G-mauM-1xKp56',
+ 'pvlist': [{'vendorID': 'LIO-ORG',
+ 'capacity': '53284438016',
+ 'fwrev': '0000',
+ 'vgUUID': 'aE6hIQ-WY4M-yvgK-rNQi-YN4G-mauM-1xKp56',
+ 'pathlist': [{'connection': '10.35.0.99',
+ 'iqn': 'iqn.2003-01.org.dumbo.target',
+ 'portal': '1',
+ 'port': '3260',
+ 'initiatorname': 'default'}],
+ 'pathstatus': [{'type': 'iSCSI',
+ 'physdev': 'sdbh',
+ 'capacity': '53687091200',
+ 'state': 'active',
+ 'lun': '1'}],
+ 'devtype': 'iSCSI',
+ 'pvUUID': 'mzQhIy-eyno-YUaE-eFod-9JQU-AYeA-xgy0ma',
+ 'serial': 'SLIO-ORG_target3-01_77f3fd04-8038-4383-',
+ 'GUID': '3600140577f3fd048038438393cce45de',
+ 'devcapacity': '53687091200',
+ 'productID': 'target3-01'}],
+ 'type': 3,
+ 'attr': {'allocation': 'n',
+ 'partial': '-',
+ 'exported': '-',
+ 'permission': 'w',
+ 'clustered': '-',
+ 'resizeable': 'z'}}
+
+ _schema.schema().verify_retval(
+ vdsmapi.MethodRep('LVMVolumeGroup', 'getInfo'), ret)
--
To view, visit https://gerrit.ovirt.org/60071
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2420908ebb39136339a5a52daf12f359836c5291
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
7 years, 8 months
Change in vdsm[master]: Add start/stop interface to jobs module
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: Add start/stop interface to jobs module
......................................................................
Add start/stop interface to jobs module
Add interfaces similar to virt.periodic and other subsystems for initializing a
module with parameters. In a future patch we want to set the scheduler that
the jobs module will use. The stop() interface will clear all jobs.
Change-Id: I5e67018fa45bcae9aedf74a9b4587230f6118024
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M lib/vdsm/jobs.py
M tests/jobsTests.py
M vdsm/vdsm
3 files changed, 12 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/61999/1
diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py
index 232981c..8f44059 100644
--- a/lib/vdsm/jobs.py
+++ b/lib/vdsm/jobs.py
@@ -132,9 +132,11 @@
return s.format(self=self, id=id(self))
-# This helper should only be called by test code. Everything else should be
-# using the public APIs.
-def _clear():
+def start():
+ pass
+
+
+def stop():
with _lock:
_jobs.clear()
diff --git a/tests/jobsTests.py b/tests/jobsTests.py
index cb1cb89..5665d82 100644
--- a/tests/jobsTests.py
+++ b/tests/jobsTests.py
@@ -64,7 +64,10 @@
TIMEOUT = 1
def setUp(self):
- jobs._clear()
+ jobs.start()
+
+ def tearDown(self):
+ jobs.stop()
def test_job_initial_state(self):
job = TestingJob()
diff --git a/vdsm/vdsm b/vdsm/vdsm
index a6dc727..9c6367a 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -34,6 +34,7 @@
from vdsm import constants
from vdsm import dsaversion
from vdsm import health
+from vdsm import jobs
from vdsm import schedule
from vdsm import utils
from vdsm import libvirtconnection
@@ -99,6 +100,7 @@
scheduler = schedule.Scheduler(name="vdsm.Scheduler",
clock=utils.monotonic_time)
scheduler.start()
+ jobs.start()
from clientIF import clientIF # must import after config is read
cif = clientIF.getInstance(irs, log, scheduler)
@@ -119,6 +121,7 @@
periodic.stop()
cif.prepareForShutdown()
scheduler.stop()
+ jobs.stop()
finally:
libvirtconnection.stop_event_loop(wait=False)
--
To view, visit https://gerrit.ovirt.org/61999
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e67018fa45bcae9aedf74a9b4587230f6118024
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: build: Proving that error_code job is useless
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: build: Proving that error_code job is useless
......................................................................
build: Proving that error_code job is useless
Adding new error to vdsm must pass the build. If this patch will fail
the error_codes job, it proves that this job is useless, and it should
be removed.
Checking vdsm error code may be needed as part of engine build, not
vdsm. We do not care if our clients updated their error codes.
Change-Id: Iaf4148cdf286ac694d0aa5fa96e6b302a0fefad9
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/exception.py
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/61056/1
diff --git a/lib/vdsm/exception.py b/lib/vdsm/exception.py
index 40d13f5..f173ab3 100644
--- a/lib/vdsm/exception.py
+++ b/lib/vdsm/exception.py
@@ -376,3 +376,8 @@
class HookError(GeneralException):
code = 1500
message = "Hook Error"
+
+
+class FooBarError(GeneralException):
+ code = 1501
+ message = "Foo bar error"
--
To view, visit https://gerrit.ovirt.org/61056
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf4148cdf286ac694d0aa5fa96e6b302a0fefad9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months