From 1b14383998f80e4108167ef224a402a28e13f5bd Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 25 Aug 2009 14:56:54 +0100 Subject: xend: Add support for URI ('file:' and 'data:' scheme) for PV/kernel and PV/ramdisk Add support for 'file:' and 'data:' URI schemes for the parameters 'PV/kernel' and 'PV/ramdisk' in the VM.create() call. The 'data:' scheme handling enables using a file which is stored inside the management system (from where the XenAPI call is send) as kernel or ramdisk. Notes: o all included: a detailed description can be found in the xenapi documentation o bumped up the version of the API document to 1.0.8 (because of (minimal) interface extension) o Future enhancements (like http:, ftp: schemes) fit seamlessly into the current design / classes o Unittest cases and xm-test case included Signed-off-by: Andreas Florath --- .../tests/xapi/04_xapi-data_uri_handling.py | 65 ++++++++++++++++++++++ tools/xm-test/tests/xapi/Makefile.am | 3 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tools/xm-test/tests/xapi/04_xapi-data_uri_handling.py (limited to 'tools/xm-test') diff --git a/tools/xm-test/tests/xapi/04_xapi-data_uri_handling.py b/tools/xm-test/tests/xapi/04_xapi-data_uri_handling.py new file mode 100644 index 0000000000..7d1a39b503 --- /dev/null +++ b/tools/xm-test/tests/xapi/04_xapi-data_uri_handling.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +#============================================================================ +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#============================================================================ +# Copyright (C) 2009 flonatel GmbH & Co. KG +#============================================================================ +# +# This file contains test cases for checking the data URI +# functionality: +# kernel and ramdisk are both checked with original uri, +# file uri and data uri (in every constallation) +# + +import copy + +from xen.util.fileuri import schemes, scheme_data, scheme_file + +from XmTestLib import * +from XmTestLib.network_utils import * +from XmTestLib.XenAPIDomain import XmTestAPIDomain + +kernel_orig_uri = arch.configDefaults['kernel'] +ramdisk_orig_uri = arch.configDefaults['ramdisk'] +kernel_data_uri = scheme_data.create_from_file(kernel_orig_uri) +ramdisk_data_uri = scheme_data.create_from_file(ramdisk_orig_uri) +kernel_file_uri = scheme_file.encode(kernel_orig_uri) +ramdisk_file_uri = scheme_file.encode(ramdisk_orig_uri) + +config = copy.copy(arch.configDefaults) + +for kernel in (kernel_orig_uri, kernel_data_uri, kernel_file_uri): + for ramdisk in (ramdisk_orig_uri, ramdisk_data_uri, ramdisk_file_uri): + config['kernel'] = kernel + config['ramdisk'] = ramdisk + print("Using kernel='%s' ramdisk='%s'" % (kernel[:100], ramdisk[:100])) + try: + guest = XmTestAPIDomain(baseConfig = config) + console = guest.start() + except DomainError, e: + if verbose: + print("Failed to create test domain because: %s" % e.extra) + FAIL(str(e)) + + try: + run = console.runCmd("ls /") + if run['return'] > 0: + FAIL("Could not start host") + except ConsoleError, e: + saveLog(console.getHistory()) + FAIL(str(e)) + + guest.closeConsole() + guest.stop() + diff --git a/tools/xm-test/tests/xapi/Makefile.am b/tools/xm-test/tests/xapi/Makefile.am index 3ae8afffb0..bfdf27c660 100644 --- a/tools/xm-test/tests/xapi/Makefile.am +++ b/tools/xm-test/tests/xapi/Makefile.am @@ -2,7 +2,8 @@ SUBDIRS = TESTS = 01_xapi-vm_basic.test \ 02_xapi-vbd_basic.test \ - 03_xapi-network_pos.test + 03_xapi-network_pos.test \ + 04_xapi-data_uri_handling.test XFAIL_TESTS = -- cgit v1.2.3