def setUp(self): super(IsoMount, self).setUp() self.iso = iso9660.Iso9660Mount(self.iso_path)
def setup_cdrom(self): """ Mount cdrom and copy vmlinuz and initrd.img. """ error_context.context( "Copying vmlinuz and initrd.img from install cdrom %s" % self.cdrom_cd1) if not os.path.isdir(self.image_path): os.makedirs(self.image_path) if (self.params.get('unattended_delivery_method') in ['integrated', 'url']): i = iso9660.Iso9660Mount(self.cdrom_cd1) self.cdrom_cd1_mount = i.mnt_dir else: i = iso9660.iso9660(self.cdrom_cd1) if i is None: raise exceptions.TestFail("Could not instantiate an iso9660 class") i.copy(os.path.join(self.boot_path, os.path.basename(self.kernel)), self.kernel) assert (os.path.getsize(self.kernel) > 0) i.copy(os.path.join(self.boot_path, os.path.basename(self.initrd)), self.initrd) assert (os.path.getsize(self.initrd) > 0) if self.unattended_file.endswith('.preseed'): self.preseed_initrd() if self.params.get("vm_type") == "libvirt": if self.vm.driver_type == 'qemu': # Virtinstall command needs files "vmlinuz" and "initrd.img" os.chdir(self.image_path) base_kernel = os.path.basename(self.kernel) base_initrd = os.path.basename(self.initrd) if base_kernel != 'vmlinuz': process.run("mv %s vmlinuz" % base_kernel, verbose=DEBUG) if base_initrd != 'initrd.img': process.run("mv %s initrd.img" % base_initrd, verbose=DEBUG) if (self.params.get('unattended_delivery_method') != 'integrated'): i.close() utils_disk.cleanup(self.cdrom_cd1_mount) elif ((self.vm.driver_type == 'xen') and (self.params.get('hvm_or_pv') == 'pv')): logging.debug("starting unattended content web server") self.url_auto_content_port = utils_misc.find_free_port( 8100, 8199, self.url_auto_content_ip) start_auto_content_server_thread(self.url_auto_content_port, self.cdrom_cd1_mount) self.medium = 'url' self.url = ( 'http://%s:%s' % (self.url_auto_content_ip, self.url_auto_content_port)) pxe_path = os.path.join(os.path.dirname(self.image_path), 'xen') if not os.path.isdir(pxe_path): os.makedirs(pxe_path) pxe_kernel = os.path.join(pxe_path, os.path.basename(self.kernel)) pxe_initrd = os.path.join(pxe_path, os.path.basename(self.initrd)) process.run("cp %s %s" % (self.kernel, pxe_kernel)) process.run("cp %s %s" % (self.initrd, pxe_initrd)) if 'repo=cdrom' in self.kernel_params: # Red Hat self.kernel_params = re.sub( 'repo\=[\:\w\d\/]*', 'repo=http://%s:%s' % (self.url_auto_content_ip, self.url_auto_content_port), self.kernel_params)