[PATCH 4/5] virt: libvirt_vm: Avoid re-copying kernel and initrd on install

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <cevich@xxxxxxxxxx>
---
 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 <path>/images/pxeboot/<vmlinuz|initrd>
         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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux