[Ovirt-devel] create-wui-appliance.sh: useful script!

Jim Meyering jim at meyering.net
Fri Apr 4 21:44:29 UTC 2008


Alan Pevec <apevec at redhat.com> wrote:

> Jim Meyering wrote:
>> Thanks for the create-wui-appliance.sh script.
>> It nicely eliminates several annoyingly manual steps.
>> Here are some small changes.  I've tested the result.
>
> Here's one more to create dummybridge via libvirt. You must remove manually created dummybridge first:
> - stop VMs
> - ifdown dummybridge; brctl delbr dummybridge; find /etc/sysconfig/ -name ifcfg-dummybridge -exec rm {} \;
>
> diff --git a/wui-appliance/create-wui-appliance.sh b/wui-appliance/create-wui-appliance.sh
> index 0167576..b152cc5 100755
> --- a/wui-appliance/create-wui-appliance.sh
> +++ b/wui-appliance/create-wui-appliance.sh
> @@ -55,6 +55,15 @@ if [ -n $MAC ]; then
>     MAC="-m $MAC"
> fi
>
> +TMPXML=$(mktemp) || exit 1
> +cat > $TMPXML <<EOF
> +<network> <name>dummy</name> <bridge name="dummybridge" stp="off" forwardDelay="0" /> <ip address="192.168.50.1" netmask="255.255.255.0"/> </network>
> +EOF
> +virsh net-define $TMPXML
> +rm $TMPXML
> +virsh net-start dummy
> +virsh net-autostart dummy
> +

Hi Alan,

Looks good.
At first, I was going to suggest removing $TMPXML via a 'trap'
so we're sure not to leave around the temporary, but we can
do even better and eliminate the temporary file completely.
Instead use bash's process substitution; untested:

gen_dummy() {
cat <<\EOF
<network>
  <name>dummy</name>
  <bridge name="dummybridge" stp="off" forwardDelay="0" />
  <ip address="192.168.50.1" netmask="255.255.255.0"/>
</network>
EOF
}

virsh net-define <(gen_dummy)
virsh net-start dummy
virsh net-autostart dummy




More information about the ovirt-devel mailing list