summaryrefslogtreecommitdiffstats
path: root/os-plugins
diff options
context:
space:
mode:
authorDirk von Suchodoletz2009-02-25 06:07:07 +0100
committerDirk von Suchodoletz2009-02-25 06:07:07 +0100
commitdcda3cdb7dcfc2190253fdc87dd34e10ec22b384 (patch)
treed138ba257e3e82e3caa78337b9d6445812266cd8 /os-plugins
parentCleaned up/restructured the mounting of fs components (function (diff)
downloadcore-dcda3cdb7dcfc2190253fdc87dd34e10ec22b384.tar.gz
core-dcda3cdb7dcfc2190253fdc87dd34e10ec22b384.tar.xz
core-dcda3cdb7dcfc2190253fdc87dd34e10ec22b384.zip
Simplified handling of mounting the image sources via newly
introduced function fsmount, see r2639. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2640 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r--os-plugins/plugins/qemukvm/XX_qemukvm.sh31
-rw-r--r--os-plugins/plugins/virtualbox/XX_virtualbox.sh30
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm41
-rw-r--r--os-plugins/plugins/vmware/XX_vmware.sh32
4 files changed, 41 insertions, 93 deletions
diff --git a/os-plugins/plugins/qemukvm/XX_qemukvm.sh b/os-plugins/plugins/qemukvm/XX_qemukvm.sh
index 2d96d212..62a26037 100644
--- a/os-plugins/plugins/qemukvm/XX_qemukvm.sh
+++ b/os-plugins/plugins/qemukvm/XX_qemukvm.sh
@@ -52,30 +52,13 @@ qemu(-kvm)\n makes not much sense."
fi
if [ -n "${qkimgserv}" ] ; then
# directory where qemu images are expected in
- testmkd /mnt/var/lib/virt/qemukvm
- case "${qkimgprot}" in
- *nbd)
- # TODO: to be filled in ...
- ;;
- lbdev)
- # we expect the stuff on toplevel directory, filesystem type should
- # be autodetected here ... (qkimgserv is blockdev here)
- qkbdev=/dev/${qkimgserv}
- waitfor ${qkbdev} 20000
- echo -e "ext2\nreiserfs\nvfat\nxfs" >/etc/filesystems
- mount -o ro ${qkbdev} /mnt/var/lib/virt/qemukvm || \
- error "$scfg_evmlm" nonfatal
- ;;
- *)
- # we expect nfs mounts here ...
- for proto in tcp udp fail; do
- [ $proto = "fail" ] && { error "$scfg_nfs" nonfatal;
- noimg=yes; break;}
- mount -n -t nfs -o ro,nolock,$proto ${qkimgserv}:${qkimgpath} \
- /mnt/var/lib/virt/qemukvm && break
- done
- ;;
- esac
+ mnttarget=/mnt/var/lib/virt/qemukvm
+ # mount the qemukvm image source readonly (ro)
+ fsmount ${qkimgprot} ${qkimgserv} ${qkimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && error " * Incomplete information in variable \
+${qemukvm_imagesrc}." nonfatal
+ fi
fi
# copy version depending files - the vmchooser expects for every virtua-
# lization plugin a file named after it (here run-qemukvm.include)
diff --git a/os-plugins/plugins/virtualbox/XX_virtualbox.sh b/os-plugins/plugins/virtualbox/XX_virtualbox.sh
index 6f717f29..40d60c7b 100644
--- a/os-plugins/plugins/virtualbox/XX_virtualbox.sh
+++ b/os-plugins/plugins/virtualbox/XX_virtualbox.sh
@@ -34,30 +34,12 @@ if [ -e /initramfs/plugin-conf/virtualbox.conf ]; then
fi
if [ -n "${vbimgserv}" ] ; then
# directory where qemu images are expected in
- testmkd /mnt/var/lib/virt/virtualbox
- case "${vbimgprot}" in
- *nbd)
- # TODO: to be filled in ...
- ;;
- lbdev)
- # we expect the stuff on toplevel directory, filesystem type should be
- # autodetected here ... (vbimgserv is blockdev here)
- vbbdev=/dev/${vbimgserv}
- waitfor ${vbbdev} 20000
- echo -e "ext2\nreiserfs\nvfat\nxfs" >/etc/filesystems
- mount -o ro ${vbbdev} /mnt/var/lib/virt/virtualbox || \
- error "$scfg_evmlm" nonfatal
- ;;
- *)
- # we expect nfs mounts here ...
- for proto in tcp udp fail; do
- [ $proto = "fail" ] && { error "$scfg_nfs" nonfatal;
- noimg=yes; break;}
- mount -n -t nfs -o ro,nolock,$proto ${vbimgserv}:${vbimgpath} \
- /mnt/var/lib/virt/virtualbox && break
- done
- ;;
- esac
+ mnttarget=/mnt/var/lib/virt/virtualbox
+ # mount the virtualbox image source readonly (ro)
+ fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && error " * Incomplete information in variable \
+${virtualbox_imagesrc}." nonfatal
fi
# copy version depending files - the vmchooser expects for every virtua-
# lization plugin a file named after it (here run-virtualbox.include)
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index 82015534..7a4ff531 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -481,26 +481,27 @@ sub _getVersion {
my %versioninfo = (vmversion => "", vmbuildversion => "");
# get version information about installed vmplayer
- open(FH, "$vmpath/bin/vmplayer");
- $/ = undef;
- my $data = <FH>;
- close FH;
- # depending on the installation it could differ and has multiple build
- # strings
- if ($data =~ m{[^\d\.](\d\.\d) build-(\d+)}) {
- $vmversion = $1;
- $vmbuildversion = $2;
- }
- if ($data =~ m{\0(2\.[05])\.[0-9]}) {
- $vmversion = $1;
- }
- # else { TODO: errorhandling if file or string doesn't exist }
- chomp($vmversion);
- chomp($vmbuildversion);
-
- $versioninfo{vmversion} = $vmversion;
- $versioninfo{vmbuildversion} = $vmbuildversion;
- return %versioninfo;
+ if (open(FH, "$vmpath/bin/vmplayer")) {
+ $/ = undef;
+ my $data = <FH>;
+ close FH;
+ # depending on the installation it could differ and has multiple build
+ # strings
+ if ($data =~ m{[^\d\.](\d\.\d) build-(\d+)}) {
+ $vmversion = $1;
+ $vmbuildversion = $2;
+ }
+ if ($data =~ m{\0(2\.[05])\.[0-9]}) {
+ $vmversion = $1;
+ }
+ # else { TODO: errorhandling if file or string doesn't exist }
+ chomp($vmversion);
+ chomp($vmbuildversion);
+
+ $versioninfo{vmversion} = $vmversion;
+ $versioninfo{vmbuildversion} = $vmbuildversion;
+ }
+ return %versioninfo;
}
########################################################################
diff --git a/os-plugins/plugins/vmware/XX_vmware.sh b/os-plugins/plugins/vmware/XX_vmware.sh
index 4dab751c..f3e059b7 100644
--- a/os-plugins/plugins/vmware/XX_vmware.sh
+++ b/os-plugins/plugins/vmware/XX_vmware.sh
@@ -152,31 +152,13 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \
vmimgserv=$(uri_token ${vmware_imagesrc} server)
vmimgpath="$(uri_token ${vmware_imagesrc} path)"
fi
- if [ -n "${vmimgserv}" ] ; then
- testmkd /mnt/var/lib/virt/vmware
- case "${vmimgprot}" in
- *nbd)
- # TODO: to be filled in ...
- ;;
- lbdev)
- # we expect the stuff on toplevel directory, filesystem type should be
- # autodetected here ... (vmimgserv is blockdev here)
- vmbdev=/dev/${vmimgserv}
- waitfor ${vmbdev} 20000
- echo -e "ext2\nreiserfs\nvfat\nxfs" >/etc/filesystems
- mount -o ro ${vmbdev} /mnt/var/lib/virt/vmware || \
- error "$scfg_evmlm" nonfatal
- ;;
- *)
- # we expect nfs mounts here ...
- for proto in tcp udp fail; do
- [ $proto = "fail" ] && { error "$scfg_nfs" nonfatal;
- noimg=yes; break;}
- mount -n -t nfs -o ro,nolock,$proto ${vmimgserv}:${vmimgpath} \
- /mnt/var/lib/virt/vmware && break
- done
- ;;
- esac
+ if [ -n "${vmimgserv}" -a -n ${vmimgpath} -a -n ${vmimgprot} ] ; then
+ mnttarget=/mnt/var/lib/virt/vmware
+ # mount the vmware image source readonly (ro)
+ fsmount ${vmimgprot} ${vmimgserv} ${vmimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && error " * Incomplete information in variable \
+${vmware_imagesrc}." nonfatal
fi
#############################################################################