[virt-tools-list] [virt-manager PATCH 2/2] virt-install: Default to libosnfo recommended disk size

Pavel Hrdina phrdina at redhat.com
Mon Dec 10 02:35:21 UTC 2018


On Wed, Dec 05, 2018 at 09:15:19AM +0100, Fabiano Fidêncio wrote:
> If no disk options are passed, let's fallback to the libosinfo
> recommended disk size for the OS variant.
> 
> The build_installer call and the set of the distro variant have been
> moved earlier in the code in order to let's fetch the correct
> information from libosinfo and then set the recommended disk size
> without changing much of build_guest_instance() logic.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>  virt-install | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/virt-install b/virt-install
> index 4e16d4c8..241cdeab 100755
> --- a/virt-install
> +++ b/virt-install
> @@ -509,6 +509,15 @@ def build_installer(options, guest):
>  def build_guest_instance(conn, options):
>      guest = virtinst.Guest(conn)
>  
> +    installer = build_installer(options, guest)
> +    if installer:
> +        set_distro_variant(options, guest, installer)
> +
> +    if not options.disk:
> +        res = guest.osinfo.get_recommended_resources(guest)
> +        if res and res['storage']:
> +            options.disk = ['size=%d' % (res['storage'] // (1024 **3))]
> +

This doesn't look correct.  As you can see, the original code called
'guest.set_capabilities_defaults()' which configures the os type and
in the 'build_installer' function we call 'guest.os.is_container()'
which checks whether the os type is 'exe'.

Pavel

>      if options.name:
>          guest.name = options.name
>      if options.uuid:
> @@ -534,9 +543,7 @@ def build_guest_instance(conn, options):
>      # building, and distro variant detection
>      guest.set_capabilities_defaults()
>  
> -    installer = build_installer(options, guest)
>      if installer:
> -        set_distro_variant(options, guest, installer)
>          installer.set_install_defaults(guest)
>  
>      validate_required_options(options, guest, installer)
> -- 
> 2.19.1
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20181210/e58c02de/attachment.sig>


More information about the virt-tools-list mailing list