Joey Boggs
2009-Oct-23 19:53 UTC
[Ovirt-devel] [PATCH node] Add iSCSI initiator setup option
This add an iscsi initiator name setup option to the main menu in ovirt-config-setup and can also be accessed via ovirt-config-iscsi. Also accepts AUTO setup by running ovirt-config-iscsi AUTO and generates a random name as before --- Makefile.am | 1 + ovirt-node.spec.in | 3 ++ scripts/ovirt-config-boot | 4 --- scripts/ovirt-config-iscsi | 56 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100755 scripts/ovirt-config-iscsi diff --git a/Makefile.am b/Makefile.am index abb7c33..b2419cd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,6 +58,7 @@ EXTRA_DIST = \ scripts/ovirt-config-boot-wrapper \ scripts/ovirt-config-collectd \ scripts/ovirt-config-hostname \ + scripts/ovirt-config-iscsi \ scripts/ovirt-config-logging \ scripts/ovirt-config-networking \ scripts/ovirt-config-password \ diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 2a6b7b6..4a68c44 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -160,6 +160,7 @@ cd - %{__install} -p -m0755 scripts/ovirt-config-boot-wrapper %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-collectd %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-hostname %{buildroot}%{_sbindir} +%{__install} -p -m0755 scripts/ovirt-config-iscsi %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir} %{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir} @@ -265,6 +266,7 @@ ln -s ovirt-release %{buildroot}/etc/system-release %{__ln_s} ../..%{_sbindir}/ovirt-config-storage %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"00_Disk Partitioning" %{__ln_s} ../..%{_sbindir}/ovirt-config-password %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"05_Administrator Password" %{__ln_s} ../..%{_sbindir}/ovirt-config-hostname %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"10_Set Hostname" +%{__ln_s} ../..%{_sbindir}/ovirt-config-iscsi %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"12_iSCSI Initiator Setup" %{__ln_s} ../..%{_sbindir}/ovirt-config-networking %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"15_Networking Setup" %{__ln_s} ../..%{_sbindir}/ovirt-config-logging %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"30_Logging Setup" %{__ln_s} ../..%{_sbindir}/ovirt-config-collectd %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"35_Collectd Setup" @@ -334,6 +336,7 @@ fi %{_sbindir}/ovirt-config-boot %{_sbindir}/ovirt-config-boot-wrapper %{_sbindir}/ovirt-config-collectd +%{_sbindir}/ovirt-config-iscsi %{_sbindir}/ovirt-config-hostname %{_sbindir}/ovirt-config-logging %{_sbindir}/ovirt-config-networking diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot index dd53988..b2efe71 100755 --- a/scripts/ovirt-config-boot +++ b/scripts/ovirt-config-boot @@ -170,10 +170,6 @@ EOF return $rc fi - # install iscsi initiator name for this machine - echo "InitiatorName=$(iscsi-iname)" > /etc/iscsi/initiatorname.iscsi - ovirt_store_config /etc/iscsi/initiatorname.iscsi - umount /liveos umount /boot # mark new Root ready to go, reboot() in ovirt-function switches it to active diff --git a/scripts/ovirt-config-iscsi b/scripts/ovirt-config-iscsi new file mode 100755 index 0000000..8e1bbaf --- /dev/null +++ b/scripts/ovirt-config-iscsi @@ -0,0 +1,56 @@ +#!/bin/bash +# +# Configures the hostname file based on kernel cmdline or user prompt +# Source functions library +. /etc/init.d/functions +. /etc/init.d/ovirt-functions + +trap '__st=$?; stop_log; exit $__st' 0 +trap 'exit $?' 1 2 13 15 + +warn() { printf '%s\n' "$*" >&2; } + +if ! is_local_storage_configured; then + warn "Local storage must be configured prior to setting the iSCSI Initiator Name." + exit 99 +fi + +INITIATOR_FILE="/etc/iscsi/initiatorname.iscsi" + +function prompt_user { + printf "\n" + printf "Enter iSCSI Initiator Name (If blank one will be automatically generated)\n" + printf "Enter Q to quit\n" + read REPLY + if [[ $REPLY == "q" || $REPLY == "Q" ]]; then + printf "Aborting due to user request" + return + fi + + set_initiator $REPLY +} + +function set_initiator { + if [ -z "$1" ]; then + INITIATOR_NAME=$(iscsi-iname) + else + INITIATOR_NAME=$1 + fi + + echo "InitiatorName=$INITIATOR_NAME" > $INITIATOR_FILE + ovirt_store_config $INITIATOR_FILE + rc=$? + if [ $rc = 0 ]; then + printf "Initiator name set as: $INITIATOR_NAME\n" + else + printf "Setting initiator name failed\n" + fi +} + +# AUTO for auto-install +if [ "$1" = "AUTO" ]; then + set_initiator +else + printf "\n\n iSCSI Initiator Configuration\n\n" + prompt_user +fi -- 1.6.2.5
Darryl L. Pierce
2009-Nov-09 15:59 UTC
[Ovirt-devel] [PATCH node] Add iSCSI initiator setup option
On Fri, Oct 23, 2009 at 03:53:33PM -0400, Joey Boggs wrote:> This add an iscsi initiator name setup option to the main menu in ovirt-config-setup and can also be accessed via ovirt-config-iscsi. > > Also accepts AUTO setup by running ovirt-config-iscsi AUTO and generates a random name as before > > ---ACK. The iscsi-iname tool generates a differently formated name; i.e., it produces something like "iqn.1994-05.com.fedora:e02b3f52c90". But I'm told that those differences aren't that import. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20091109/028c3c11/attachment.sig>
Apparently Analagous Threads
- [PATCH node] Disables SSH by default, and allows for enabling at firstboot. rhbz#509842
- [PATCH node] Users can view log files on the node. bz#506289
- [PATCH ovirt-node] Removed subpackages, stateful, stateless, logos, and selinux for inclusuion in Fedora
- [PATCH node] drop collectd startup reordering hack
- [PATCH server] oVirt server single network installer