def check_cff_ok(self): "util.fileuri.scheme_data - create from file - ok" tmppath = "/tmp/scheme_data_check_cff_ok" f = open(tmppath, "w") f.write("huhuhu") f.close() d = scheme_data.create_from_file(tmppath) os.unlink(tmppath) self.assertEqual(d, "data:application/octet-stream;base64,aHVodWh1")
# 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:
# 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: