[Ovirt-devel] [PATCH server] updated appliance configuration for iscsi/nfs support
Joey Boggs
jboggs at redhat.com
Fri Feb 27 23:15:52 UTC 2009
This adds back in appliance iscsi/nfs functionality that has been missing since the switch to the new installer. Adds an appliance::bundled puppet class that is only used by the appliance installation configuration.
---
.../appliances/ovirt-appliance/ovirt-appliance.pp | 1 +
.../modules/ovirt/files/ovirt-appliance-setup | 4 +
installer/modules/ovirt/files/ovirt-storage | 73 +++++++++
installer/modules/ovirt/manifests/appliance.pp | 160 ++++++++++++++++++++
installer/modules/ovirt/manifests/init.pp | 2 +-
5 files changed, 239 insertions(+), 1 deletions(-)
create mode 100755 installer/modules/ovirt/files/ovirt-appliance-setup
create mode 100755 installer/modules/ovirt/files/ovirt-storage
create mode 100644 installer/modules/ovirt/manifests/appliance.pp
diff --git a/installer/appliances/ovirt-appliance/ovirt-appliance.pp b/installer/appliances/ovirt-appliance/ovirt-appliance.pp
index 125edf9..ffeceba 100644
--- a/installer/appliances/ovirt-appliance/ovirt-appliance.pp
+++ b/installer/appliances/ovirt-appliance/ovirt-appliance.pp
@@ -44,3 +44,4 @@ include tftp::bundled
include postgres::bundled
include freeipa::bundled
include ovirt::setup
+include appliance::bundled
diff --git a/installer/modules/ovirt/files/ovirt-appliance-setup b/installer/modules/ovirt/files/ovirt-appliance-setup
new file mode 100755
index 0000000..e3ab63d
--- /dev/null
+++ b/installer/modules/ovirt/files/ovirt-appliance-setup
@@ -0,0 +1,4 @@
+for i in `seq 1 5`; do; /bin/dd if=/dev/null of=/ovirtiscsi/iSCSI$i bs=1 count=1 seek=5G; done"
+
+for i in `seq 1 5`; do; /bin/dd if=/dev/zero of=/ovirtnfs/disk$i.dsk bs=1 count=1 seek=5G;done",
+
diff --git a/installer/modules/ovirt/files/ovirt-storage b/installer/modules/ovirt/files/ovirt-storage
new file mode 100755
index 0000000..e923500
--- /dev/null
+++ b/installer/modules/ovirt/files/ovirt-storage
@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# ovirt-storage Set up storage for oVirt Server Appliance
+#
+# chkconfig: 3 96 4
+# description: oVirt Appliance Storage Services
+#
+
+# Source functions library
+. /etc/init.d/functions
+TARGET_ID=32101
+
+prog="ovirt-storage"
+num_iscsi_luns=5
+
+start() {
+ echo -n "Starting $prog: "
+
+ # Set up the fake iscsi target
+ tgtadm --lld iscsi --op new --mode target --tid $TARGET_ID \
+ -T ovirtpriv:storage
+
+ #
+ # Now associate them to the LVs
+ #
+ for i in `seq 1 $num_iscsi_luns` ; do
+ tgtadm --lld iscsi --op new --mode logicalunit --tid $TARGET_ID \
+ --lun $i -b /ovirtiscsi/iSCSI$i
+ done
+
+ #
+ # Now make them available
+ #
+ tgtadm --lld iscsi --op bind --mode target --tid $TARGET_ID -I ALL
+
+ echo_success
+ echo
+}
+
+stop() {
+ echo -n "Stopping $prog: "
+
+ # stop access to the iscsi target
+ tgtadm --lld iscsi --op unbind --mode target --tid $TARGET_ID -I ALL
+
+ # unbind the LUNs
+ for i in `seq 1 $num_iscsi_luns` ; do
+ tgtadm --lld iscsi --op delete --mode logicalunit --tid $TARGET_ID --lun $i
+ done
+
+ # shutdown the target
+ tgtadm --lld iscsi --op delete --mode target --tid $TARGET_ID
+
+ echo_success
+ echo
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 2
+esac
+
diff --git a/installer/modules/ovirt/manifests/appliance.pp b/installer/modules/ovirt/manifests/appliance.pp
new file mode 100644
index 0000000..9579837
--- /dev/null
+++ b/installer/modules/ovirt/manifests/appliance.pp
@@ -0,0 +1,160 @@
+#--
+# Copyright (C) 2008 Red Hat Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Joey Boggs <jboggs at redhat.com>
+#--
+
+class appliance::bundled {
+
+$nfs_changes = [
+ "set /files/etc/sysconfig/nfs/MOUNTD_PORT 892"
+]
+
+augeas {"nfs_config":
+ changes => $nfs_changes,
+ notify => Service["nfs"]
+}
+
+$nfslock_changes = [
+ "set /files/etc/sysconfig/nfs/LOCKD_TCPPORT 32803",
+ "set /files/etc/sysconfig/nfs/LOCKD_UDPPORT 32769",
+ "set /files/etc/sysconfig/nfs/STATD_PORT 662"
+]
+
+augeas {"nfslock_config":
+ changes => $nfslock_changes,
+ notify => Service["nfslock"]
+}
+
+#file {"/boot/grub/splash.xpm.gz":
+# source => "puppet:///ovirt/ovirt-splash.xpm.gz"
+#}
+
+firewall_rule {"tgtd": destination_port => '3260'}
+firewall_rule {"nfsd": destination_port => '2049'}
+firewall_rule {"rpcbind": destination_port => '111'}
+firewall_rule {"rpcbind-udp": destination_port => '111', protocol => 'udp'}
+firewall_rule {"rpc.mountd": destination_port => '892'}
+firewall_rule {"rpc.mountd-udp": destination_port => '892', protocol => 'udp'}
+firewall_rule {"rpc.statd": destination_port => '662'}
+firewall_rule {"rpc.statd-udp": destination_port => '662', protocol => 'udp'}
+
+service {"nfs":
+ ensure => "running",
+ enable => true,
+ require => Service["network"]
+}
+
+service {"nfslock":
+ ensure => "running",
+ enable => true
+}
+
+service {"network":
+ ensure => "running",
+ enable => true
+}
+
+file{"/mnt/data/ovirtiscsi":
+ ensure => directory
+}
+
+file{"/ovirtiscsi":
+ ensure => directory
+}
+
+file{"/ovirtnfs":
+ ensure => directory
+}
+
+file{"/mnt/data/ovirtnfs":
+ ensure => directory
+}
+
+mount{"/ovirtiscsi":
+ atboot => true,
+ ensure => mounted,
+ fstype => bind,
+ options => bind,
+ device => "/mnt/data/ovirtiscsi",
+ require => [File["/mnt/data/ovirtiscsi"],File["/ovirtiscsi"]]
+}
+
+mount{"/ovirtnfs":
+ atboot => true,
+ ensure => mounted,
+ fstype => bind,
+ options => bind,
+ device => "/mnt/data/ovirtnfs",
+ require => [File["/mnt/data/ovirtnfs"],File["/ovirtnfs"]]
+}
+
+file {"/usr/sbin/ovirt-appliance-setup":
+ source => "puppet:///ovirt/ovirt-appliance-setup",
+ mode => 755
+}
+
+single_exec{"ovirtnfs_export":
+ command => '/bin/echo "/ovirtnfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports',
+ notify => Service[nfs]
+}
+
+file{"/mnt/data/cobblernfs":
+ ensure => directory
+}
+
+file{"/cobblernfs":
+ ensure => directory
+}
+
+mount{"/cobblernfs":
+ atboot => true,
+ ensure => mounted,
+ fstype => bind,
+ options => bind,
+ device => "/mnt/data/ovirtnfs",
+ require => [File["/mnt/data/ovirtnfs"],File["/cobblernfs"]]
+}
+
+single_exec{"cobbler_nfs_export":
+ command => '/bin/echo "/cobblernfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports',
+ notify => Service[nfs],
+ require => Mount["/cobblernfs"]
+}
+
+
+file {"/etc/init.d/ovirt-storage":
+ source => "puppet:///ovirt/ovirt-storage",
+ mode => 755
+}
+
+service {"ovirt-storage":
+ ensure => "running",
+ enable => true,
+ require => [File["/etc/init.d/ovirt-storage"],File["/usr/sbin/ovirt-appliance-setup"]]
+}
+
+package{"scsi-target-utils":
+ ensure => installed
+}
+
+package{"iscsi-initiator-utils":
+ ensure => installed
+}
+
+
+}
diff --git a/installer/modules/ovirt/manifests/init.pp b/installer/modules/ovirt/manifests/init.pp
index 87f6832..a09cea1 100644
--- a/installer/modules/ovirt/manifests/init.pp
+++ b/installer/modules/ovirt/manifests/init.pp
@@ -6,4 +6,4 @@ import "ovirt/freeipa.pp"
import "ovirt/ovirt.pp"
import "ovirt/postgres.pp"
import "appliance_base/single_exec.pp"
-
+import "ovirt/appliance.pp"
--
1.6.0.6
More information about the ovirt-devel
mailing list