2
#============================================================================
3
# This library is free software; you can redistribute it and/or
4
# modify it under the terms of version 2.1 of the GNU Lesser General Public
5
# License as published by the Free Software Foundation.
7
# This library is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
# Lesser General Public License for more details.
12
# You should have received a copy of the GNU Lesser General Public
13
# License along with this library; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
#============================================================================
16
# Copyright (C) 2009 flonatel GmbH & Co. KG
17
#============================================================================
19
# This file contains test cases for checking the data URI
21
# kernel and ramdisk are both checked with original uri,
22
# file uri and data uri (in every constallation)
27
from xen.util.fileuri import schemes, scheme_data, scheme_file
29
from XmTestLib import *
30
from XmTestLib.network_utils import *
31
from XmTestLib.XenAPIDomain import XmTestAPIDomain
33
kernel_orig_uri = arch.configDefaults['kernel']
34
ramdisk_orig_uri = arch.configDefaults['ramdisk']
35
kernel_data_uri = scheme_data.create_from_file(kernel_orig_uri)
36
ramdisk_data_uri = scheme_data.create_from_file(ramdisk_orig_uri)
37
kernel_file_uri = scheme_file.encode(kernel_orig_uri)
38
ramdisk_file_uri = scheme_file.encode(ramdisk_orig_uri)
40
config = copy.copy(arch.configDefaults)
42
for kernel in (kernel_orig_uri, kernel_data_uri, kernel_file_uri):
43
for ramdisk in (ramdisk_orig_uri, ramdisk_data_uri, ramdisk_file_uri):
44
config['kernel'] = kernel
45
config['ramdisk'] = ramdisk
46
print("Using kernel='%s' ramdisk='%s'" % (kernel[:100], ramdisk[:100]))
48
guest = XmTestAPIDomain(baseConfig = config)
49
console = guest.start()
50
except DomainError, e:
52
print("Failed to create test domain because: %s" % e.extra)
56
run = console.runCmd("ls /")
58
FAIL("Could not start host")
59
except ConsoleError, e:
60
saveLog(console.getHistory())