Revision 0b04b188

b/lib/constants.py
533 533
  EXPORT_MODE_REMOTE,
534 534
  ])
535 535

  
536
# Lock recalculate mode
537
LOCKS_REPLACE = "replace"
538
LOCKS_APPEND = "append"
539

  
540
# Lock timeout (sum) before we should go into blocking acquire (still
541
# can be reset by priority change); computed as max time (10 hours)
542
# before we should actually go into blocking acquire given that we
543
# start from default priority level; in seconds
544
LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / 20.0
545
LOCK_ATTEMPTS_MAXWAIT = 15.0
546
LOCK_ATTEMPTS_MINWAIT = 1.0
547

  
548 536
# instance creation modes
549 537
INSTANCE_CREATE = "create"
550 538
INSTANCE_IMPORT = "import"
......
1600 1588

  
1601 1589
OP_PRIO_DEFAULT = OP_PRIO_NORMAL
1602 1590

  
1591
# Lock recalculate mode
1592
LOCKS_REPLACE = "replace"
1593
LOCKS_APPEND = "append"
1594

  
1595
# Lock timeout (sum) before we should go into blocking acquire (still
1596
# can be reset by priority change); computed as max time (10 hours)
1597
# before we should actually go into blocking acquire given that we
1598
# start from default priority level; in seconds
1599
# TODO
1600
LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / (OP_PRIO_DEFAULT - OP_PRIO_HIGHEST)
1601
LOCK_ATTEMPTS_MAXWAIT = 15.0
1602
LOCK_ATTEMPTS_MINWAIT = 1.0
1603

  
1603 1604
# Execution log types
1604 1605
ELOG_MESSAGE = "message"
1605 1606
ELOG_PROGRESS = "progress"
b/test/ganeti.mcpu_unittest.py
40 40
    self.assert_(len(tpa) > LOCK_ATTEMPTS_TIMEOUT / LOCK_ATTEMPTS_MAXWAIT)
41 41
    self.assert_(sum(tpa) >= LOCK_ATTEMPTS_TIMEOUT)
42 42

  
43
    self.assertTrue(LOCK_ATTEMPTS_TIMEOUT >= 1800,
44
                    msg="Waiting less than half an hour per priority")
45
    self.assertTrue(LOCK_ATTEMPTS_TIMEOUT <= 3600,
46
                    msg="Waiting more than an hour per priority")
47

  
43 48
  def testSimple(self):
44 49
    strat = mcpu.LockAttemptTimeoutStrategy(_random_fn=lambda: 0.5,
45 50
                                            _time_fn=lambda: 0.0)

Also available in: Unified diff