[virt-tools-list] [virt-manager PATCH 02/12] unattended: Use make_unattended_cache_dir()

Cole Robinson crobinso at redhat.com
Fri Jun 7 00:51:35 UTC 2019


On 6/6/19 10:11 AM, Fabiano Fidêncio wrote:
> Let's use this util's method and avoid creating the cache dir by our
> own.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>  virtinst/unattended.py | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/virtinst/unattended.py b/virtinst/unattended.py
> index 11de2fed..e79c1a47 100644
> --- a/virtinst/unattended.py
> +++ b/virtinst/unattended.py
> @@ -264,10 +264,7 @@ def prepare_install_script(guest, unattended_data, url=None, os_media=None):
>  
>  
>  def generate_install_script(script):
> -    scratch = os.path.join(util.get_cache_dir(), "unattended")
> -    if not os.path.exists(scratch):
> -        os.makedirs(scratch, 0o751)
> -
> +    scratch = util.make_unattended_cache_dir()
>      script.generate_output(Gio.File.new_for_path(scratch))
>      path = os.path.join(scratch, script.get_expected_filename())
>      cmdline = script.generate_cmdline()
> 

Hmm I get where you are going for but I think the final result after all
patches is tough follow. The iso is created from the contents of
unattended_cache_dir, which is updated in multiple different parts of
the code including some that don't have anything to do with the cdrom
media (installertreemedia). The iso itself is also placed in that dir.

I think the perform_cdrom_injections should work like
perform_initrd_injections: it receives a list of host paths, creates its
own tempdir, copies the host paths into the tempdir, builds the iso from
it, deletes the tempdir. All the host paths (install script, driver
files), should just be regularly created temp files rooted at
scratchdir. That means we need to teach the initrd/floppy/cdrom inject
stuff that it needs to rename some files before copying them to the
tempdir, I don't think it should be too hard and the code to populate
the tempdir can be shared between the impls. Makes me think now that
cdrom/initrd/floppy code can all go into the same file, which will need
to be renamed of course, maybe just injections.py. If we
download/generate all files in regular old scratchdir we don't need to
do the pid hacking for unattended collisions

Given we are headed for a release soon, I think we should pause the
windows virtio driver stuff, especially since I imagine osinfo will have
a lot of changes in this area soon since you've been playing with it.
Let's just focus on switching the current code using cdrom instead of floppy

Thanks,
Cole




More information about the virt-tools-list mailing list