From: Ryan Harper Subject: Re: [Autotest] [PATCH 4/6] KVM test: Add unattended install script Date: Tue, 13 Oct 2009 15:52:08 -0500 Message-ID: <20091013205208.GR27824@us.ibm.com> References: <1255120824-13481-1-git-send-email-lmr@redhat.com> <1255120824-13481-2-git-send-email-lmr@redhat.com> <1255120824-13481-3-git-send-email-lmr@redhat.com> <1255120824-13481-4-git-send-email-lmr@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Lucas Meneghel Rodrigues Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:35675 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761303AbZJMUxA (ORCPT ); Tue, 13 Oct 2009 16:53:00 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e5.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id n9DKgiBr027593 for ; Tue, 13 Oct 2009 16:42:44 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n9DKqMr3249396 for ; Tue, 13 Oct 2009 16:52:22 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n9DKqKFE005128 for ; Tue, 13 Oct 2009 16:52:21 -0400 Content-Disposition: inline In-Reply-To: <1255120824-13481-4-git-send-email-lmr@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: * Lucas Meneghel Rodrigues [2009-10-09 15:41]: > In order to make it possible to prepare the environment > for the guests installation, we have to: > > > +class UnattendedInstall(object): > + """ > + Creates a floppy disk image that will contain a config file for unattended > + OS install. Optionally, sets up a PXE install server using qemu built in > + TFTP and DHCP servers to install a particular operating system. The > + parameters to the script are retrieved from environment variables. > + """ > + def __init__(self): > + """ > + Gets params from environment variables and sets class attributes. > + """ > + script_dir = os.path.dirname(sys.modules[__name__].__file__) > + kvm_test_dir = os.path.abspath(os.path.join(script_dir, "..")) > + images_dir = os.path.join(kvm_test_dir, 'images') > + self.deps_dir = os.path.join(kvm_test_dir, 'deps') > + self.unattended_dir = os.path.join(kvm_test_dir, 'unattended') > + > + try: > + tftp_root = os.environ['KVM_TEST_tftp'] > + self.tftp_root = os.path.join(images_dir, tftp_root) Testing this out, the directory is just slightly wrong. My tftp_root value ends up being: /home/rharper/work/git/autotest/client/tests/kvm/images/images/tftpboot The tftp param is built in kvm_vm.py by combining root_dir (/home/rharper/work/git/autotest/client/tests/kvm) + the tftp value from kvm_tests.cfg (defaults to 'images/tftpboot'). So if we want to keep the relative tftp path in kvm_tests.cfg, then I think we need update the unattended script. I think want we want instead is: self.tftp_root = os.path.join(kvm_test_dir, tftp_root) I made this small change and I can now run the fc11 unattended install. diff --git a/client/tests/kvm/scripts/unattended.py b/client/tests/kvm/scripts/unattended.py index 6ceeef1..febea6e 100755 --- a/client/tests/kvm/scripts/unattended.py +++ b/client/tests/kvm/scripts/unattended.py @@ -33,7 +33,7 @@ class UnattendedInstall(object): try: tftp_root = os.environ['KVM_TEST_tftp'] - self.tftp_root = os.path.join(images_dir, tftp_root) + self.tftp_root = os.path.join(kvm_test_dir, tftp_root) if not os.path.isdir(self.tftp_root): os.makedirs(self.tftp_root) except KeyError: -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com