From: Lucas Meneghel Rodrigues Subject: [PATCH 4/5] virt: libvirt_vm: Avoid re-copying kernel and initrd on install Date: Fri, 30 Dec 2011 02:41:56 -0200 Message-ID: <1325220117-10430-5-git-send-email-lmr@redhat.com> References: <1325220117-10430-1-git-send-email-lmr@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: autotest@test.kernel.org Return-path: In-Reply-To: <1325220117-10430-1-git-send-email-lmr@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Added simple workaround for virt-install's insistence on re-copying kernel and initrd files from a specific directory layout. Added a note that this code should be cleaned up if/when corresponding part of unattended_install test is cleaned. Signed-off-by: Chris Evich --- client/virt/libvirt_vm.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py index 65db338..97b9f8b 100644 --- a/client/virt/libvirt_vm.py +++ b/client/virt/libvirt_vm.py @@ -601,7 +601,7 @@ class VM(virt_vm.BaseVM): if smp: virt_install_cmd += add_smp(help, smp) - # TODO: directory location for vmlinuz/kernel for cdrom install ? + # libvirt expects --location /images/pxeboot/ location = None if params.get("medium") == 'url': if params.get("url") == 'auto': @@ -620,7 +620,16 @@ class VM(virt_vm.BaseVM): if params.get("use_libvirt_cdrom_switch") == 'yes': virt_install_cmd += add_cdrom(help, params.get("cdrom_cd1")) else: - location = params.get("image_dir") + # Fake images/pxeboot using relative symlinks + # Assumes kernel and initrd were copied to same dir + # TODO: This and cooresponding add_cdrom() in unattended_install test + # should be much cleaner. + location = os.path.dirname(params.get("kernel")) + try: + os.symlink( ".", os.path.join(location, "images") ) + os.symlink( ".", os.path.join(location, "pxeboot") ) + except OSError: + pass # ignore if already exists if location: virt_install_cmd += add_location(help, location) -- 1.7.7.4