On Mon, Dec 10, 2018 at 10:36 AM Fabiano Fidêncio <fidencio@xxxxxxxxxx> wrote: > > If no disk options are passed, let's fallback to the libosinfo > recommended disk size for the OS variant. > > The guest.set_capabilities_default(), build_installer() and the set of > the distro variant have been moved earlier in the code in order to 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@xxxxxxxxxx> > --- > virt-install | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/virt-install b/virt-install > index 4e16d4c8..61dcbe39 100755 > --- a/virt-install > +++ b/virt-install > @@ -524,19 +524,23 @@ def build_guest_instance(conn, options): > if options.machine: > guest.os.machine = options.machine > > + guest.set_capabilities_defaults() > + 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.get('storage') > 0: > + options.disk = ['size=%d' % (res.get('storage') // (1024 **3))] > + > cli.parse_option_strings(options, guest, None) > > # cli specific disk validation > for disk in guest.devices.disk: > cli.validate_disk(disk) > > - # Do this a bit early so we have os_type/arch checks for installer > - # 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 > Argh! And this fixup will be needed as I forgot to run ./setup pylint before sending the patches. :-/ Without the fixup we'd get: running pycodestyle virt-install:534: [E222] multiple spaces after operator virt-install:535: [E225] missing whitespace around operator [fidencio@dahmer virt-manager]$ git diff HEAD~1 diff --git a/virt-install b/virt-install index 61dcbe39..cf6f7d78 100755 --- a/virt-install +++ b/virt-install @@ -531,8 +531,8 @@ def build_guest_instance(conn, options): if not options.disk: res = guest.osinfo.get_recommended_resources(guest) - if res and res.get('storage') > 0: - options.disk = ['size=%d' % (res.get('storage') // (1024 **3))] + if res and res.get('storage') > 0: + options.disk = ['size=%d' % (res.get('storage') // (1024 ** 3))] cli.parse_option_strings(options, guest, None) _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list