[Ovirt-devel] [PATCH appliance] Handle errors for contacting host for local VM management better

Jim Meyering jim at meyering.net
Sun Sep 21 11:35:58 UTC 2008


Perry Myers <pmyers at redhat.com> wrote:
> Old rc.local snipped could possibly error out and cause cobbler setup to fail.
> This revised section always makes this section of code successful even if
> the local host is not setup as an ovirt-node.
>
> Signed-off-by: Perry Myers <pmyers at redhat.com>
> ---
>  ovirt-appliance.ks |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks
> index 3de32fb..ebaaba2 100644
> --- a/ovirt-appliance.ks
> +++ b/ovirt-appliance.ks
> @@ -41,10 +41,8 @@ lokkit
>    cat >> /etc/rc.d/rc.local << \EOF
>  # Try to contact the host we are running on; if we succeed, we'll use it as
>  # one of the managed nodes; if not, no big deal
> -exec 3<> /dev/tcp/192.168.50.1/7777
> -echo "AWAKE" 1>&3
> -exec 3<> /dev/tcp/192.168.50.1/7777
> -echo "IDENTIFY" 1>&3
> +(exec 3<> /dev/tcp/192.168.50.1/7777 && echo "AWAKE" 1>&3 \
> +      && exec 3<> /dev/tcp/192.168.50.1/7777 && echo "IDENTIFY" 1>&3) || :
>  EOF
>
>    # make sure to update the /etc/hosts with the list of all possible DHCP

That looks fine.
However, you can get the same effect, while saving a subshell
with {...;} in place of (...).

ACK either way.




More information about the ovirt-devel mailing list