def clock(): LOG = logging.getLogger(__name__) LOG.debug("At %s heartbeat once" % time.asctime()) cn.heartbeat() time.sleep(CONF.heartbeat_interval) # TODO: the max depth of recursion clock()
#!/usr/bin/env python import os from virtman.utils import rootwrap from virtman.openstack.common import log as logging from openstack.common import processutils as putils LOG = logging.getLogger(__name__) def findloop(): # Licyh NOTE: openstack.common.processutils & subprocess.Popen only # supports 'ls' not 'cat a.py' but 'cat','a.py', (out, err) = putils.execute('losetup', '-f', run_as_root=True, root_helper=rootwrap.root_helper()) return out.strip() def try_linkloop(loop_dev): path = '/root/blocks/' if not os.path.exists(path): putils.execute('mkdir', '-p', path, run_as_root=True, root_helper=rootwrap.root_helper()) path = path + 'snap' + loop_dev[9:] + '.blk' if not os.path.exists(path): putils.execute('dd', 'if=/dev/zero', 'of=' + path, 'bs=1M', 'count=512', run_as_root=True, root_helper=rootwrap.root_helper()) linkloop(loop_dev, path)
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging import os import fixtures import mock from oslo.utils import strutils from oslotest import base from virtman.openstack.common import log as oslo_logging LOG = oslo_logging.getLogger(__name__) class TestCase(base.BaseTestCase): """Test case base class for all unit tests.""" def setUp(self): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0) try: test_timeout = int(test_timeout) except ValueError: # If timeout value is invalid do not set a timeout.