[Libguestfs] [p2v PATCH] make-disk: set p2v.local as hostname

Richard W.M. Jones rjones at redhat.com
Sat Sep 28 11:23:56 UTC 2019


On Thu, Sep 26, 2019 at 05:32:54PM +0200, Pino Toscano wrote:
> Set p2v.local as hostname for the p2v disk image, so it will be fixed,
> instead of whatever is set in the used templates.  This is also somewhat
> important during the distribution update, and installation of our
> packages: there may be distribution packages actually using the hostname
> to initialize stuff (e.g. configuration values), and thus the unset
> value "(none)" triggers errors.
> 
> The additional command to set the hostname is for the appliance itself:
> the hostname will be set on the running kernel, which is the appliance
> own, so getting it later on with hostname(1) works.

I think you mean "appliance’s own" in this sentence?

> ---
>  virt-p2v-make-disk.in | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/virt-p2v-make-disk.in b/virt-p2v-make-disk.in
> index 1bec4e3..132211d 100644
> --- a/virt-p2v-make-disk.in
> +++ b/virt-p2v-make-disk.in
> @@ -233,11 +233,16 @@ fi
>  
>  # Run virt-builder.  Note we controversially assume systemd here.  We
>  # could provide a sysvinit fallback if required.
> +# The manual 'hostname' invocation is needed to set the hostname
> +# also for the appliance itself, so scriptlets can properly use
> +# the hostname we want.
>  virt-builder "$osversion"                                       \
>      $verbose_option						\
>      --output "$output"                                          \
>      $arch_option						\
>      $preinstall_args                                            \
> +    --hostname p2v.local                                        \
> +    --run-command 'hostname p2v.local'                          \
>      --update                                                    \
>      --install "$install"                                        \
>      --root-password password:p2v                                \
> -- 

I thought I'd ACKed this already ...

Anyhow, ACK

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list