Amahi Disk-Wizard plugin(v0.3)

person kasunfolder_openUncategorizedlocal_offer, access_time June 11, 2014

Amahi disk-wizard plugin simply allow its users to create,edit manipulate their storage devices as the prefer, v 0.3 is the first(alpha) release of the plugin.  In this post i will go through the basic functionalities of the plugin and explain little bit about its architecture and how its work.

Amahi plugins are kind of Rails engine which initialize with the initialization of amahi platform,the concept is one folder for one plugin and that folder(self contained) will contain all the resources which need to run the plugin.

Disk-wizard plugin has three layers of abstraction, where each layer provide unique functionality to its preceding and  succeeding layers.

Starting from the bottom layer, which is simply a command mapper,It only allow selected commands to pass through the script and execute(As we have discussed in last meeting),This simple script would be a platform independent where we can use in both Ubuntu and Fedora platforms,It is a duty of the upper layers to pass the correct command to wrapper script.and here is the latest version of the script[5]
Second layer provides bunch of ruby methods, to call or execute system tools via the above mentioned wrapper script ,for example DiskCommand.execute[6] will execute a given command on the system with the help of wrapper script. I have used Open3 library because it is more flexible and have more features than IO library.
From the third layer it provides storage devices specific operations such as formating[7] , mounting[8], check partition table[9] , get device/partition usage[10] etc., which execute system tools to preform those operations i.e. parted, mkfs, mount, umount and etc.In this library it checks for the underline platform[11] which the current application is running and issue the appropriate command to the DiskCommand library, By doing so this layer provides information or results to its top layer independent from the platform which it running on.
And top most layer is the disk model(but it is not inherited from AR::Base class).I have define some general methods which are available with AR::Base class, such as Disk.find[12] , Disk.all[13] and etc,
If i summarize the whole idea in few lines,
when we call Disk.find “/dev/sda1” it will return new Partition object which contains information about ‘sda1’ partition
disk.format(“ntfs”) will format the above partition to ‘ntfs’ format,when executing this operation it goes through the Diskwz.rb library
Where it issue the correct system tool to the DiskCommand library by checking the current platform using Platform.fedora? / .ubuntu? method.
DiskCommand library will handle all the errors,inputs streams, outputs and keep pid of the process and its status in variables for future use.if the user wants to kill any process start by the disk wizard plugin they can use that PID attribute to call the kill method.

Format and mount a partition to HDA

V 0.3 Known issues:

  1. Can’t format partition/device to NTFS file system type due to fedora does not come with ntfs module
  2. Unmounting partition which is in use.
  3. Remove an entry from /etc/fstab when unmounting or deleting a partition
  4. Back action issue in 3rd step (“What to do ?”) in the wizard
  5. Debug mode exceptions when try to format entire disk in new devices.
  6. In second step(file system selection) of the wizard. last column which contains the format checkbox is inactive for row selection.Even when click on that column it won’t select that row.
  7. After completion if not mount option selected show only format details.
  8. Multiple “Are you sure?” alerts in Confirmation step
  9. Removable devices get automatically mounted on /media/  trying to mount them manually raise an exception saying “Device is busy”.( reference)
  10. When running mkfs.vfat give an error “mkfs.vfat: invalid option — ‘q’
  11. Add tail -n 10 /etc/fstab to debug info script


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">