All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/modules/storage StorageModule.cpp
Date: 24 Sep 2007 18:05:57 -0000	[thread overview]
Message-ID: <20070924180557.2435.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-09-24 18:05:57

Modified files:
	ricci/modules/storage: StorageModule.cpp 

Log message:
	Fix 242943: Changes to clustered volumes should be made on all cluster nodes, pass 1

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/StorageModule.cpp.diff?cvsroot=cluster&r1=1.8&r2=1.9

--- conga/ricci/modules/storage/StorageModule.cpp	2007/09/11 02:45:28	1.8
+++ conga/ricci/modules/storage/StorageModule.cpp	2007/09/24 18:05:55	1.9
@@ -1,5 +1,5 @@
 /*
-  Copyright Red Hat, Inc. 2006
+  Copyright Red Hat, Inc. 2006-2007
 
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
@@ -26,6 +26,7 @@
 #include "BDFactory.h"
 #include "LVM.h"
 #include "FSController.h"
+#include "MountHandler.h"
 
 
 using namespace std;
@@ -49,6 +50,10 @@
 static VarMap modify_bd(const VarMap& args);
 static VarMap remove_bd(const VarMap& args);
 static VarMap get_fs_group_members(const VarMap& args);
+static VarMap mount_fs(const VarMap& args);
+static VarMap umount_fs(const VarMap& args);
+static VarMap fstab_add(const VarMap& args);
+static VarMap fstab_del(const VarMap& args);
 
 static VarMap enable_clustered_lvm(const VarMap& args);
 static VarMap disable_clustered_lvm(const VarMap& args);
@@ -86,11 +91,14 @@
   api_1_0["modify_bd"]                          = modify_bd;
   api_1_0["remove_bd"]                          = remove_bd;
 
-  api_1_0["get_fs_group_members"]                   = get_fs_group_members;
-
-  api_1_0["enable_clustered_lvm"]                 = enable_clustered_lvm;
-  api_1_0["disable_clustered_lvm"]                = disable_clustered_lvm;
+  api_1_0["get_fs_group_members"]               = get_fs_group_members;
 
+  api_1_0["enable_clustered_lvm"]               = enable_clustered_lvm;
+  api_1_0["disable_clustered_lvm"]              = disable_clustered_lvm;
+  api_1_0["mount_fs"]                           = mount_fs;
+  api_1_0["umount_fs"]                          = umount_fs;
+  api_1_0["fstab_add"]                          = fstab_add;
+  api_1_0["fstab_del"]                          = fstab_del;
 
   ApiFcnMap   api_fcn_map;
   api_fcn_map["1.0"] = api_1_0;
@@ -451,6 +459,137 @@
   return ret;
 }
 
+VarMap
+mount_fs(const VarMap& args)
+{
+	String device, mountpoint, fstype;
+
+	try {
+		VarMap::const_iterator iter = args.find("device");
+		if (iter == args.end())
+			throw APIerror("missing device variable");
+		device = iter->second.get_string();
+
+		iter = args.find("mountpoint");
+		if (iter == args.end())
+			throw APIerror("missing mountpoint variable");
+		mountpoint = iter->second.get_string();
+
+		iter = args.find("fstype");
+		if (iter == args.end())
+			throw APIerror("missing fstyle variable");
+		fstype = iter->second.get_string();
+
+		MountHandler mh;
+		if (!mh.mount(device, mountpoint, fstype)) {
+			throw APIerror("mounting " + device + " at "
+					+ mountpoint + " failed");
+		}
+	} catch (String e) {
+		throw APIerror(e);
+	}
+
+	VarMap ret;
+	return ret;
+}
+
+VarMap 
+umount_fs(const VarMap& args)
+{
+	String device(""), mountpoint("");
+
+	try {
+		VarMap::const_iterator iter = args.find("device");
+		if (iter != args.end())
+			device = iter->second.get_string();
+
+		iter = args.find("mountpoint");
+		if (iter != args.end())
+			mountpoint = iter->second.get_string();
+
+		if (!device.size() && !mountpoint.size())
+			throw APIerror("no device or mount point variable");
+
+		MountHandler mh;
+		if (mountpoint.size() > 0) {
+			if (mh.umount((device.size() > 0 ? device : ""), mountpoint)) {
+				VarMap ret;
+				return ret;
+			}
+		}
+
+		if (device.size() > 0) {
+			if (mh.umount(device, device)) {
+				VarMap ret;
+				return ret;
+			}
+		}
+	} catch (String e) {
+		throw APIerror(e);
+	}
+
+	throw APIerror("unable to unmount "
+			+ (mountpoint.size() ? mountpoint : device));
+}
+
+VarMap 
+fstab_add(const VarMap& args)
+{
+	String device, mountpoint, fstype;
+
+	try {
+		VarMap::const_iterator iter = args.find("device");
+		if (iter == args.end())
+			throw APIerror("missing device variable");
+		device = iter->second.get_string();
+
+		iter = args.find("mountpoint");
+		if (iter == args.end())
+			throw APIerror("missing mountpoint variable");
+		mountpoint = iter->second.get_string();
+
+		iter = args.find("fstype");
+		if (iter == args.end())
+			throw APIerror("missing fstyle variable");
+		fstype = iter->second.get_string();
+
+		MountHandler mh;
+		if (!mh.fstab_add(device, mountpoint, fstype)) {
+			throw APIerror("adding " + device + " at "
+					+ mountpoint + " to fstab failed");
+		}
+	} catch (String e) {
+		throw APIerror(e);
+	}
+
+	VarMap ret;
+	return ret;
+}
+
+VarMap 
+fstab_del(const VarMap& args)
+{
+	String device, mountpoint;
+
+	try {
+		VarMap::const_iterator iter = args.find("device");
+		if (iter == args.end())
+			throw APIerror("missing device variable");
+		device = iter->second.get_string();
+
+		iter = args.find("mountpoint");
+		if (iter == args.end())
+			throw APIerror("missing mountpoint variable");
+		mountpoint = iter->second.get_string();
+		MountHandler mh;
+		mh.fstab_remove(device, mountpoint);
+	} catch (String e) {
+		throw APIerror(e);
+	}
+
+	VarMap ret;
+	return ret;
+}
 
 list<XMLObject>
 _mapper_ids(const String& mapper_type)



                 reply	other threads:[~2007-09-24 18:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070924180557.2435.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.