From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: Re: [Autotest] [KVM-AUTOTEST PATCH 3/5] KVM test: Support for Parallel install of guest OS Date: Wed, 10 Feb 2010 15:22:04 -0200 Message-ID: <1265822524.2273.23.camel@localhost.localdomain> References: <1265818995.6747.25.camel@yogi-laptop> <1265819372.6747.29.camel@yogi-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: yogi Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754358Ab0BJRWJ (ORCPT ); Wed, 10 Feb 2010 12:22:09 -0500 In-Reply-To: <1265819372.6747.29.camel@yogi-laptop> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2010-02-10 at 21:59 +0530, yogi wrote: > >From 0aa8ed40de86eb8ad5b324177b2e0986e1c32c77 Mon Sep 17 00:00:00 2001 > From: yogananth subramanian > Date: Wed, 10 Feb 2010 09:45:58 -0500 > Subject: [PATCH 3/5] kvm test: unattended: add support for parallel > install of suse and other guest OS > > File extension of the unattended file ".suse", in case of Sles is > used to identify the guest OS. > Since the netboot image path and the kernel name differs for > both sles and Rhel, its important to identify the type of > guest being installed. Just some quick comments on this one, because those are important to complete what I asked, which is split the patchsets in 2. > The funtion "create_boot_floppy()" is called during initialization > ranther from the funtion "setup", since its important to indentify > the OS type being installed duiring initializatoin. > > Signed-off-by: yogananth subramanian > --- > client/tests/kvm/scripts/unattended.py | 30 > +++++++++++++++++++++++------- > 1 files changed, 23 insertions(+), 7 deletions(-) > > diff --git a/client/tests/kvm/scripts/unattended.py > b/client/tests/kvm/scripts/unattended.py > index 87a8973..2257abf 100755 > --- a/client/tests/kvm/scripts/unattended.py > +++ b/client/tests/kvm/scripts/unattended.py > @@ -59,8 +59,9 @@ class UnattendedInstall(object): > self.cdrom_iso = os.path.join(kvm_test_dir, cdrom_iso) > self.floppy_mount = tempfile.mkdtemp(prefix='floppy_', > dir='/tmp') > self.cdrom_mount = tempfile.mkdtemp(prefix='cdrom_', > dir='/tmp') > - self.floppy_img = os.path.join(images_dir, 'floppy.img') > - > + flopy_name = os.path.basename(os.environ['KVM_TEST_floppy']) > + self.floppy_img = os.path.join(images_dir, flopy_name) > + self.create_boot_floppy() > > def create_boot_floppy(self): > """ > @@ -93,8 +94,12 @@ class UnattendedInstall(object): > shutil.copyfile(setup_file_path, setup_file_dest) > elif self.unattended_file.endswith('.ks'): > dest_fname = 'ks.cfg' > + self.os = "redhat" > elif self.unattended_file.endswith('.xml'): > dest_fname = "autounattend.xml" > + elif self.unattended_file.endswith('.suse'): > + dest_fname = "autoinst.xml" > + self.os = "suse" Perhaps .suse as a file extension should be avoided, as having the XML extension will help people with their source code editors, let's keep it an .xml file and take advantage of the fact that windows unattended install does not use TFTP setup at all, so we can just verify if self.tftp_root contains a non-empty string to tell apart windows files and SUSE files. > dest = os.path.join(self.floppy_mount, dest_fname) > > @@ -160,10 +165,22 @@ class UnattendedInstall(object): > if os.system(m_cmd): > raise SetupError('Could not mount CD image %s.' % > self.cdrom_iso) > > - p = os.path.join('images', 'pxeboot') > - pxe_dir = os.path.join(self.cdrom_mount, p) > - pxe_image = os.path.join(pxe_dir, 'vmlinuz') > - pxe_initrd = os.path.join(pxe_dir, 'initrd.img') > + if self.os == "redhat": > + kernel = 'vmlinuz' > + initrd = 'initrd.img' > + p = os.path.join('images', 'pxeboot') > + pxe_dir = os.path.join(self.cdrom_mount, p) > + else : > + kernel = 'linux' > + initrd = 'initrd' > + p = os.path.join('boot/x86_64', 'loader') > + pxe_dir = os.path.join(self.cdrom_mount, p) > + if not os.path.isdir(pxe_dir): > + p = os.path.join('boot/i386', 'loader') > + pxe_dir = os.path.join(self.cdrom_mount, p) As Ryan pointed out, on the above block we could just make use of the configuration system and put the locations for kernel and initrd there, making the code generic. > + pxe_image = os.path.join(pxe_dir, kernel) > + pxe_initrd = os.path.join(pxe_dir, initrd) > > if not os.path.isdir(pxe_dir): > raise SetupError('The ISO image does not have a %s dir. The > script ' > @@ -229,7 +246,6 @@ class UnattendedInstall(object): > print " floppy_img: " + str(self.floppy_img) > print " finish_program: " + str(self.finish_program) > > - self.create_boot_floppy() > if self.tftp_root: > self.setup_pxe_boot() > self.cleanup()