diff options
| author | Ed Leafe <ed@leafe.com> | 2011-02-17 22:50:17 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-02-17 22:50:17 +0000 |
| commit | 76a82e57dfbca67e1e70a12db4f4b5c2111e4d93 (patch) | |
| tree | ad470c12b3650141ec74051386af8e87e6515999 /plugins | |
| parent | 5688fbd7a06ea47e18f38e4c900be4dbb50b921c (diff) | |
| parent | c0972233901774598fe6c836fcc3a0dd1f28f180 (diff) | |
| download | nova-76a82e57dfbca67e1e70a12db4f4b5c2111e4d93.tar.gz nova-76a82e57dfbca67e1e70a12db4f4b5c2111e4d93.tar.xz nova-76a82e57dfbca67e1e70a12db4f4b5c2111e4d93.zip | |
Added support for feature parity with the current Rackspace Cloud Servers practice of "injecting" files into newly-created instances for configuration, etc. However, this is in no way restricted to only writing files to the guest when it is first created.
Diffstat (limited to 'plugins')
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/agent | 5 | ||||
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent index f99ea4082..94eaabe73 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent @@ -93,9 +93,8 @@ def password(self, arg_dict): @jsonify def resetnetwork(self, arg_dict): - """ - Writes a resquest to xenstore that tells the agent to reset networking. - + """Writes a resquest to xenstore that tells the agent + to reset networking. """ arg_dict['value'] = json.dumps({'name': 'resetnetwork', 'value': ''}) request_id = arg_dict['id'] diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py index 695bf3448..a35ccd6ab 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/xenstore.py @@ -36,7 +36,15 @@ pluginlib.configure_logging("xenstore") def jsonify(fnc): def wrapper(*args, **kwargs): - return json.dumps(fnc(*args, **kwargs)) + ret = fnc(*args, **kwargs) + try: + json.loads(ret) + except ValueError: + # Value should already be JSON-encoded, but some operations + # may write raw sting values; this will catch those and + # properly encode them. + ret = json.dumps(ret) + return ret return wrapper |
