XenAPI: Monitor the GC when coalescing

Add a new host plugin to monitor whether the garbage collector is running.
This is then used by the wait_for_vhd_coalesce function to know whether
waiting any more is likely to produce the expected results.

Increased the number of times we loop waiting for coalesce as the loop
now has knowledge that something is still happening.

DocImpact
Change to parameter default.

Change-Id: Idcc0738945bd1aee8cdb52c9cfabd798f85c31db
Closes-bug: 1258169
This commit is contained in:
Bob Ball
2013-12-05 14:35:14 +00:00
parent 3d6f50e4d3
commit 270d4f1d6b
8 changed files with 111 additions and 21 deletions

View File

@@ -23,7 +23,8 @@ import utils
# MINOR VERSION: Compatible changes, new plugins, etc
# 1.0 - Initial version.
PLUGIN_VERSION = "1.0"
# 1.1 - New call to check GC status
PLUGIN_VERSION = "1.1"
def get_version(session):
return PLUGIN_VERSION

View File

@@ -28,6 +28,8 @@ except ImportError:
import logging
import re
import time
import sys
import xmlrpclib
import utils
@@ -395,8 +397,18 @@ def cleanup(dct):
# "external-auth-service-name", "")
return out
def query_gc(session, sr_uuid, vdi_uuid):
result = _run_command(["/opt/xensource/sm/cleanup.py",
"-q", "-u", sr_uuid])
# Example output: "Currently running: True"
return result[19:].strip() == "True"
if __name__ == "__main__":
# Support both serialized and non-serialized plugin approaches
_, methodname = xmlrpclib.loads(sys.argv[1])
if methodname in ['query_gc']:
utils.register_plugin_calls(query_gc)
XenAPIPlugin.dispatch(
{"host_data": host_data,
"set_host_enabled": set_host_enabled,