[virt-tools-list] [PATCH virt-install] virtinst: Add --transient flag.

Pavel Hrdina phrdina at redhat.com
Thu Jun 2 09:00:16 UTC 2016


On Wed, Jun 01, 2016 at 02:32:56PM +0100, Richard W.M. Jones wrote:
> If this flag is specified, --import|--boot will create a transient
> libvirt domain, ie. one which goes away when the guest shuts down or
> the host is rebooted.
> ---
>  man/virt-install.pod | 9 +++++++++
>  virt-install         | 4 ++++
>  virtinst/guest.py    | 4 +++-
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/man/virt-install.pod b/man/virt-install.pod
> index 0537693..01ba5ab 100644
> --- a/man/virt-install.pod
> +++ b/man/virt-install.pod
> @@ -1559,6 +1559,15 @@ Show program's version number and exit
>  Set the autostart flag for a domain. This causes the domain to be started
>  on host boot up.
>  
> +=item B<--transient>
> +
> +Use --import or --boot and --transient if you want a transient libvirt
> +VM.  These VMs exist only until the domain is shut down or the host
> +server is restarted.  Libvirt forgets the XML configuration of the VM
> +after either of these events.  Note that the VM's disks will not be
> +deleted.  See:
> +L<http://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains>
> +
>  =item B<--print-xml> [STEP] 
>
>  Print the generated XML of the guest, instead of defining it. By default this WILL do storage creation (can be disabled with --dry-run). This option implies --quiet.
> diff --git a/virt-install b/virt-install
> index 6d1aa96..da74a25 100755
> --- a/virt-install
> +++ b/virt-install
> @@ -594,6 +594,7 @@ def build_guest_instance(conn, options, parsermap):
>      guest.installer.extraargs = options.extra_args or []
>      guest.installer.initrd_injections = options.initrd_inject
>      guest.autostart = options.autostart
> +    guest.transient = options.transient

We should forbid to use --transient with all other types of install methods
because it doesn't make any sense and it doesn't work.  Unfortunately we need to
add a check "if options.transient and (options.pxe or options.cdrom or ....), we
cannot simply check for --import or --boot because --boot can be combined with
any other install method.  

Otherwise it looks good and sounds like a nice feature.

Pavel




More information about the virt-tools-list mailing list