summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-07-06 16:37:50 -0500
committerKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-07-06 16:37:50 -0500
commitaca9fc681eda3dca1b954b0ea22e56d669689cec (patch)
treeb074763c69bb79c6091833bb92c47b71c98f0e7c /plugins
parentd764a483497afc5d029a82db14cc5cc88f45f4c0 (diff)
parent6b5f32f78d8339a7bd1ab48dd520ca4076961f98 (diff)
downloadnova-aca9fc681eda3dca1b954b0ea22e56d669689cec.tar.gz
nova-aca9fc681eda3dca1b954b0ea22e56d669689cec.tar.xz
nova-aca9fc681eda3dca1b954b0ea22e56d669689cec.zip
Pull-up from trunk (post-multi_nic)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/xenserver/networking/etc/xensource/scripts/vif_5.6-fp1.patch6
-rwxr-xr-xplugins/xenserver/xenapi/contrib/build-rpm.sh20
-rw-r--r--plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec36
-rwxr-xr-xplugins/xenserver/xenapi/etc/xapi.d/plugins/agent36
-rw-r--r--plugins/xenserver/xenapi/etc/xapi.d/plugins/migration2
5 files changed, 92 insertions, 8 deletions
diff --git a/plugins/xenserver/networking/etc/xensource/scripts/vif_5.6-fp1.patch b/plugins/xenserver/networking/etc/xensource/scripts/vif_5.6-fp1.patch
index feaf1312d..d42a11eff 100644
--- a/plugins/xenserver/networking/etc/xensource/scripts/vif_5.6-fp1.patch
+++ b/plugins/xenserver/networking/etc/xensource/scripts/vif_5.6-fp1.patch
@@ -8,7 +8,7 @@
fi
;;
-@@ -224,9 +225,11 @@
+@@ -224,6 +225,7 @@
remove)
if [ "${TYPE}" = "vif" ] ;then
@@ -16,7 +16,3 @@
xenstore-rm "${HOTPLUG}/hotplug"
fi
logger -t scripts-vif "${dev} has been removed"
- remove_from_bridge
- ;;
- esac
-+
diff --git a/plugins/xenserver/xenapi/contrib/build-rpm.sh b/plugins/xenserver/xenapi/contrib/build-rpm.sh
new file mode 100755
index 000000000..f7bed4d84
--- /dev/null
+++ b/plugins/xenserver/xenapi/contrib/build-rpm.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+PACKAGE=openstack-xen-plugins
+RPMBUILD_DIR=$PWD/rpmbuild
+if [ ! -d $RPMBUILD_DIR ]; then
+ echo $RPMBUILD_DIR is missing
+ exit 1
+fi
+
+for dir in BUILD BUILDROOT SRPMS RPMS SOURCES; do
+ rm -rf $RPMBUILD_DIR/$dir
+ mkdir -p $RPMBUILD_DIR/$dir
+done
+
+rm -rf /tmp/$PACKAGE
+mkdir /tmp/$PACKAGE
+cp -r ../etc/xapi.d /tmp/$PACKAGE
+tar czf $RPMBUILD_DIR/SOURCES/$PACKAGE.tar.gz -C /tmp $PACKAGE
+
+rpmbuild -ba --nodeps --define "_topdir $RPMBUILD_DIR" \
+ $RPMBUILD_DIR/SPECS/$PACKAGE.spec
diff --git a/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec b/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec
new file mode 100644
index 000000000..91ff20e5f
--- /dev/null
+++ b/plugins/xenserver/xenapi/contrib/rpmbuild/SPECS/openstack-xen-plugins.spec
@@ -0,0 +1,36 @@
+Name: openstack-xen-plugins
+Version: 2011.3
+Release: 1
+Summary: Files for XenAPI support.
+License: ASL 2.0
+Group: Applications/Utilities
+Source0: openstack-xen-plugins.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Requires: parted
+
+%define debug_package %{nil}
+
+%description
+This package contains files that are required for XenAPI support for OpenStack.
+
+%prep
+%setup -q -n openstack-xen-plugins
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/etc
+cp -r xapi.d $RPM_BUILD_ROOT/etc
+chmod a+x $RPM_BUILD_ROOT/etc/xapi.d/plugins/*
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+/etc/xapi.d/plugins/agent
+/etc/xapi.d/plugins/glance
+/etc/xapi.d/plugins/migration
+/etc/xapi.d/plugins/objectstore
+/etc/xapi.d/plugins/pluginlib_nova.py
+/etc/xapi.d/plugins/xenhost
+/etc/xapi.d/plugins/xenstore.py
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent
index 9e761f264..b8a1b936a 100755
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent
@@ -53,6 +53,19 @@ class TimeoutError(StandardError):
pass
+def version(self, arg_dict):
+ """Get version of agent."""
+ arg_dict["value"] = json.dumps({"name": "version", "value": ""})
+ request_id = arg_dict["id"]
+ arg_dict["path"] = "data/host/%s" % request_id
+ xenstore.write_record(self, arg_dict)
+ try:
+ resp = _wait_for_agent(self, request_id, arg_dict)
+ except TimeoutError, e:
+ raise PluginError(e)
+ return resp
+
+
def key_init(self, arg_dict):
"""Handles the Diffie-Hellman key exchange with the agent to
establish the shared secret key used to encrypt/decrypt sensitive
@@ -144,6 +157,23 @@ def inject_file(self, arg_dict):
return resp
+def agent_update(self, arg_dict):
+ """Expects an URL and md5sum of the contents, then directs the agent to
+ update itself."""
+ request_id = arg_dict["id"]
+ url = arg_dict["url"]
+ md5sum = arg_dict["md5sum"]
+ arg_dict["value"] = json.dumps({"name": "agentupdate",
+ "value": {"url": url, "md5sum": md5sum}})
+ arg_dict["path"] = "data/host/%s" % request_id
+ xenstore.write_record(self, arg_dict)
+ try:
+ resp = _wait_for_agent(self, request_id, arg_dict)
+ except TimeoutError, e:
+ raise PluginError(e)
+ return resp
+
+
def _agent_has_method(self, method):
"""Check that the agent has a particular method by checking its
features. Cache the features so we don't have to query the agent
@@ -201,7 +231,9 @@ def _wait_for_agent(self, request_id, arg_dict):
if __name__ == "__main__":
XenAPIPlugin.dispatch(
- {"key_init": key_init,
+ {"version": version,
+ "key_init": key_init,
"password": password,
"resetnetwork": resetnetwork,
- "inject_file": inject_file})
+ "inject_file": inject_file,
+ "agentupdate": agent_update})
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration
index 75c653408..ac1c50ad9 100644
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration
@@ -44,7 +44,7 @@ def move_vhds_into_sr(session, args):
new_cow_uuid = params['new_cow_uuid']
sr_path = params['sr_path']
- sr_temp_path = "%s/images/" % sr_path
+ sr_temp_path = "%s/tmp/" % sr_path
# Discover the copied VHDs locally, and then set up paths to copy
# them to under the SR