[virt-tools-list] [virt-install PATCH 3/4] guest: Deal with network install resources
Cole Robinson
crobinso at redhat.com
Mon Mar 11 20:51:28 UTC 2019
On 3/8/19 11:20 AM, Fabiano Fidêncio wrote:
> Let's add two new methods to deal with network install resources so
> those can be set from the installer.
>
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
> virtinst/guest.py | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/virtinst/guest.py b/virtinst/guest.py
> index 2cca3e8d..2bbc7809 100644
> --- a/virtinst/guest.py
> +++ b/virtinst/guest.py
> @@ -167,6 +167,9 @@ class Guest(XMLBuilder):
> self._capsinfo = None
> self._domcaps = None
>
> + self._running_memory = None
> + self._network_install_memory = None
> +
>
> ######################
> # Property accessors #
> @@ -645,6 +648,13 @@ class Guest(XMLBuilder):
> self._add_implied_controllers()
> self._add_spice_devices()
>
> + def set_network_install_resources(self):
> + if self._network_install_memory and self._network_install_memory > self.memory:
> + self.memory = self._network_install_memory
> +
> + def unset_network_install_resources(self):
> + self.memory = self._running_memory
> + self.maxmemory = self._running_memory
>
> ########################
> # Private xml routines #
> @@ -659,6 +669,10 @@ class Guest(XMLBuilder):
> if not self.vcpus:
> self.vcpus = res.get('n-cpus') if res and res.get('n-cpus') > 0 else 1
>
> + self._running_memory = self.memory
> + res = self.osinfo.get_network_install_resources(self)
> + if res and res.get('ram') > 0:
> + self._network_install_memory = res['ram'] // 1024
> > def _set_default_machine(self):
> if self.os.machine:
>
This should all live in installer.py. See _prepare_get_install_xml,
_finish_get_install_xml, and _get_install_xml, where we already have
some light infrastructure to set and restore changes to the guest XML.
Also log a message when we actually set and restore the XML so there's a
clear trail of it in the logs
Thanks,
Cole
More information about the virt-tools-list
mailing list