Alan Pevec
2008-Aug-01 09:32 UTC
[Ovirt-devel] [PATCH] intitial standalone Managed Node suport
skip services which are not available in DNS SRV records Signed-off-by: Alan Pevec <apevec at redhat.com> --- ovirt-managed-node/src/scripts/ovirt | 44 +++++++++++++++++----------- ovirt-managed-node/src/scripts/ovirt-early | 2 +- ovirt-managed-node/src/scripts/ovirt-post | 6 +++- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/ovirt-managed-node/src/scripts/ovirt b/ovirt-managed-node/src/scripts/ovirt index 157f678..114ee1f 100755 --- a/ovirt-managed-node/src/scripts/ovirt +++ b/ovirt-managed-node/src/scripts/ovirt @@ -16,28 +16,38 @@ start() { iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT find_srv ipa tcp - krb5_conf=/etc/krb5.conf - if [ ! -s $krb5_conf ]; then - rm -f $krb5_conf - # FIXME this is IPA specific - wget -q \ - http://$SRV_HOST:$SRV_PORT/ipa/config/krb5.ini -O $krb5_conf \ - || (echo "Failed to get $krb5_conf" && return 1) + if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + krb5_conf=/etc/krb5.conf + if [ ! -s $krb5_conf ]; then + rm -f $krb5_conf + # FIXME this is IPA specific + wget -q \ + http://$SRV_HOST:$SRV_PORT/ipa/config/krb5.ini -O $krb5_conf \ + || (echo "Failed to get $krb5_conf" && return 1) + fi + else + echo "skipping Kerberos configuration, IPA service not available" fi - IPA_HOST=$SRV_HOST - IPA_PORT=$SRV_PORT find_srv identify tcp - krb5_tab=/etc/libvirt/krb5.tab - ovirt-awake start $krb5_tab $SRV_HOST $SRV_PORT + if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + krb5_tab=/etc/libvirt/krb5.tab + ovirt-awake start $krb5_tab $SRV_HOST $SRV_PORT + else + echo "skipping ovirt-awke, oVirt registration service not available" + fi find_srv collectd tcp - collectd_conf=/etc/collectd.conf - if [ -f $collectd_conf.in -a $SRV_HOST -a $SRV_PORT ]; then - sed -e "s/@COLLECTD_SERVER@/$SRV_HOST/" \ - -e "s/@COLLECTD_PORT@/$SRV_PORT/" $collectd_conf.in \ - > $collectd_conf \ - || (echo "Failed to write $collectd_conf" && return 1) + if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + if [ -f $collectd_conf.in ]; then + collectd_conf=/etc/collectd.conf + sed -e "s/@COLLECTD_SERVER@/$SRV_HOST/" \ + -e "s/@COLLECTD_PORT@/$SRV_PORT/" $collectd_conf.in \ + > $collectd_conf \ + || (echo "Failed to write $collectd_conf" && return 1) + fi + else + echo "skipping collectd configuration, collectd service not available" fi } diff --git a/ovirt-managed-node/src/scripts/ovirt-early b/ovirt-managed-node/src/scripts/ovirt-early index 6c7aaa3..aa0a49c 100755 --- a/ovirt-managed-node/src/scripts/ovirt-early +++ b/ovirt-managed-node/src/scripts/ovirt-early @@ -25,8 +25,8 @@ configure_from_network() { hostname $HOSTNAME # retrieve remote config find_srv ovirt tcp - printf . if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + printf . wget -q -O - "http://$SRV_HOST:$SRV_PORT/ovirt/cfgdb/$(hostname)" \ | augtool > /dev/null 2>&1 if [ $? -eq 0 ]; then diff --git a/ovirt-managed-node/src/scripts/ovirt-post b/ovirt-managed-node/src/scripts/ovirt-post index 310a41c..ecc6ff4 100755 --- a/ovirt-managed-node/src/scripts/ovirt-post +++ b/ovirt-managed-node/src/scripts/ovirt-post @@ -13,7 +13,11 @@ start() { find_srv identify tcp - ovirt-identify-node -s $SRV_HOST -p $SRV_PORT + if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then + ovirt-identify-node -s $SRV_HOST -p $SRV_PORT + else + echo "skipping ovirt-identify-node, oVirt registration service not available" + fi } case "$1" in -- 1.5.4.1