Revision 849
Added by Borja Sotomayor over 13 years ago
vm_scheduler.py | ||
---|---|---|
1281 | 1281 |
if threshold != None: |
1282 | 1282 |
# If there is a hard-coded threshold, use that |
1283 | 1283 |
return threshold |
1284 |
else: |
|
1284 |
|
|
1285 |
if config.get("suspension") != constants.SUSPENSION_NONE: |
|
1285 | 1286 |
factor = config.get("scheduling-threshold-factor") |
1286 | 1287 |
|
1287 | 1288 |
# First, figure out the "safe duration" (the minimum duration |
... | ... | |
1293 | 1294 |
if lease.get_state() == Lease.STATE_SUSPENDED_QUEUED: |
1294 | 1295 |
resm_overhead = lease.estimate_resume_time() |
1295 | 1296 |
safe_duration += resm_overhead |
1297 |
else: |
|
1298 |
safe_duration = 0 |
|
1296 | 1299 |
|
1297 |
# TODO: Incorporate other overheads into the minimum duration
|
|
1298 |
min_duration = safe_duration
|
|
1299 |
|
|
1300 |
# At the very least, we want to allocate enough time for the
|
|
1301 |
# safe duration (otherwise, we'll end up with incorrect schedules,
|
|
1302 |
# where a lease is scheduled to suspend, but isn't even allocated
|
|
1303 |
# enough time to suspend).
|
|
1304 |
# The factor is assumed to be non-negative. i.e., a factor of 0
|
|
1305 |
# means we only allocate enough time for potential suspend/resume
|
|
1306 |
# operations, while a factor of 1 means the lease will get as much
|
|
1307 |
# running time as spend on the runtime overheads involved in setting
|
|
1308 |
# it up
|
|
1309 |
threshold = safe_duration + (min_duration * factor)
|
|
1310 |
return threshold
|
|
1300 |
# TODO: Incorporate other overheads into the minimum duration |
|
1301 |
min_duration = safe_duration |
|
1302 |
|
|
1303 |
# At the very least, we want to allocate enough time for the |
|
1304 |
# safe duration (otherwise, we'll end up with incorrect schedules, |
|
1305 |
# where a lease is scheduled to suspend, but isn't even allocated |
|
1306 |
# enough time to suspend). |
|
1307 |
# The factor is assumed to be non-negative. i.e., a factor of 0 |
|
1308 |
# means we only allocate enough time for potential suspend/resume |
|
1309 |
# operations, while a factor of 1 means the lease will get as much |
|
1310 |
# running time as spend on the runtime overheads involved in setting |
|
1311 |
# it up |
|
1312 |
threshold = safe_duration + (min_duration * factor) |
|
1313 |
return threshold |
|
1311 | 1314 |
|
1312 | 1315 |
|
1313 | 1316 |
#-------------------------------------------------------------------# |
Also available in: Unified diff
If we're not using suspension, set the scheduling threshold to 0.