[Ocfs2-tools-commits] manish commits r716 -
trunk/ocfs2console/ocfs2interface
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Mar 21 02:36:44 CST 2005
Author: manish
Date: 2005-03-21 02:36:42 -0600 (Mon, 21 Mar 2005)
New Revision: 716
Added:
trunk/ocfs2console/ocfs2interface/mount.py
Modified:
trunk/ocfs2console/ocfs2interface/Makefile
trunk/ocfs2console/ocfs2interface/console.py
Log:
Split mount/unmount into its own module
Modified: trunk/ocfs2console/ocfs2interface/Makefile
===================================================================
--- trunk/ocfs2console/ocfs2interface/Makefile 2005-03-21 08:14:27 UTC (rev 715)
+++ trunk/ocfs2console/ocfs2interface/Makefile 2005-03-21 08:36:42 UTC (rev 716)
@@ -63,6 +63,7 @@
fswidgets.py \
general.py \
guiutil.py \
+ mount.py \
menu.py \
nodemap.py \
partitionview.py \
Modified: trunk/ocfs2console/ocfs2interface/console.py
===================================================================
--- trunk/ocfs2console/ocfs2interface/console.py 2005-03-21 08:14:27 UTC (rev 715)
+++ trunk/ocfs2console/ocfs2interface/console.py 2005-03-21 08:36:42 UTC (rev 716)
@@ -23,7 +23,7 @@
from menu import Menu
from toolbar import Toolbar
from about import about, process_gui_args
-from process import Process
+from mount import mount, unmount
from format import format_partition
from tune import tune_label, tune_nodes
from general import General
@@ -115,41 +115,12 @@
def mount(self):
device, mountpoint = self.pv.get_sel_values()
+ mount(self, device)
- mountpoint = query_text(self, 'Mountpoint')
- if not mountpoint:
- return
-
- command = ('mount', '-t', 'ocfs2', device, mountpoint)
-
- p = Process(command, 'Mount', 'Mounting...', self, spin_now=False)
- success, output, killed = p.reap()
-
- if not success:
- if killed:
- error_box(self, 'mount died unexpectedly! Your system is '
- 'probably in an inconsistent state. You '
- 'should reboot at the earliest opportunity')
- else:
- error_box(self, '%s: Could not mount %s' % (output, device))
-
def unmount(self):
device, mountpoint = self.pv.get_sel_values()
+ unmount(self, device, mountpoint)
- command = ('umount', mountpoint)
-
- p = Process(command, 'Unmount', 'Unmounting...', self, spin_now=False)
- success, output, killed = p.reap()
-
- if not success:
- if killed:
- error_box(self, 'umount died unexpectedly! Your system is '
- 'probably in an inconsistent state. You '
- 'should reboot at the earliest opportunity')
- else:
- error_box(self, '%s: Could not unmount %s mounted on %s' %
- (output, device, mountpoint))
-
def format(self):
format_partition(self, self.pv.get_device())
Added: trunk/ocfs2console/ocfs2interface/mount.py
===================================================================
--- trunk/ocfs2console/ocfs2interface/mount.py 2005-03-21 08:14:27 UTC (rev 715)
+++ trunk/ocfs2console/ocfs2interface/mount.py 2005-03-21 08:36:42 UTC (rev 716)
@@ -0,0 +1,95 @@
+# OCFS2Console - GUI frontend for OCFS2 management and debugging
+# Copyright (C) 2002, 2005 Oracle. All rights reserved.
+#
+# 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 Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 021110-1307, USA.
+
+import gtk
+
+from guiutil import set_props, error_box, query_text
+
+from process import Process
+
+def mount(parent, device):
+ mountpoint = query_text(parent, 'Mountpoint')
+ if not mountpoint:
+ return None
+
+ command = ('mount', '-t', 'ocfs2', device, mountpoint)
+
+ p = Process(command, 'Mount', 'Mounting...', parent, spin_now=False)
+ success, output, killed = p.reap()
+
+ if not success:
+ if killed:
+ error_box(parent, 'mount died unexpectedly! Your system is '
+ 'probably in an inconsistent state. You '
+ 'should reboot at the earliest opportunity')
+ else:
+ error_box(parent, '%s: Could not mount %s' % (output, device))
+
+ return None
+ else:
+ return mountpoint
+
+def unmount(parent, device, mountpoint):
+ command = ('umount', mountpoint)
+
+ p = Process(command, 'Unmount', 'Unmounting...', parent, spin_now=False)
+ success, output, killed = p.reap()
+
+ if not success:
+ if killed:
+ error_box(parent, 'umount died unexpectedly! Your system is '
+ 'probably in an inconsistent state. You '
+ 'should reboot at the earliest opportunity')
+ else:
+ error_box(parent, '%s: Could not unmount %s mounted on %s' %
+ (output, device, mountpoint))
+def main():
+ import sys
+
+ device = sys.argv[1]
+
+ def dummy(*args):
+ gtk.main_quit()
+
+ window = gtk.Window()
+ window.connect('delete-event', dummy)
+
+ vbbox = gtk.VButtonBox()
+ window.add(vbbox)
+
+ window.mountpoint = None
+
+ def test_mount(b):
+ window.mountpoint = mount(window, device)
+
+ button = gtk.Button('Mount')
+ button.connect('clicked', test_mount)
+ vbbox.add(button)
+
+ def test_unmount(b):
+ unmount(window, device, window.mountpoint)
+
+ button = gtk.Button('Unmount')
+ button.connect('clicked', test_unmount)
+ vbbox.add(button)
+
+ window.show_all()
+
+ gtk.main()
+
+if __name__ == '__main__':
+ main()
More information about the Ocfs2-tools-commits
mailing list