Warning: file_put_contents(/usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/cache/xml-b6ca261a7cc801aff3cccb15dfea0342.php) [function.file-put-contents]: failed to open stream: Permission denied in /usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/warp/helpers/xml.php on line 39

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/warp/helpers/xml.php:39) in /usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/warp/systems/wordpress.3.0/helpers/system.php on line 201

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/warp/helpers/xml.php:39) in /usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/warp/systems/wordpress.3.0/helpers/system.php on line 201

Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/vhosts/dramashack/wp-content/themes/yoo_corona_wp/warp/helpers/xml.php:39) in /usr/local/www/vhosts/dramashack/wp-content/plugins/what-would-seth-godin-do/what_would_seth_godin_do.php on line 124
Dramashack! » FreeNAS 0.8 is Highly Experimental, Proceed with Caution!
12
Aug

FreeNAS 0.8 is Highly Experimental, Proceed with Caution!

Written by James T. Nixon III. Posted in Django, FreeBSD, FreeNAS

An experimental version of FreeNAS based on FreeBSD 8.1 is now available to checkout from sourceforge.net.

Two items to consider before checking out the source:

http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=5&t=5819&start=10#p37152
– Warner Losh’s blog post on this release

http://freenas.svn.sourceforge.net/viewvc/freenas/experimental/ix/README
– The README file


Understanding the new FreeNAS UI

The most experimental part of FreeNAS is most likely the new user-interface written using the Django Framework. I have lofty goals and idealistic dreams – care to join me?

I used the following to build the django-based UI

When starting a new project I prefer to brainstorm on a whiteboard. Thankfully, dry-erase markers are plentiful behind my desk at iXsystems. It is often easier to write Models when I have a rough sketch of the schema behind me to glance over. Once the Models are finished, the second step is creating Forms from those models using ModelForms. Then the View, which, you guessed it, provides a way to “view” the model. The template used for the view can be super simple and auto-generate the form’s HTML, or one can choose to define the HTML for each form field. I haven’t given much love to the template, yet. The last thing I usually do is define my url and test.

Let’s break it down into simple parts:

In models.py,

## Disk Choices populates a list of disks on the system where FreeNAS is installed.

class DiskChoices:
    def __init__(self):
        pipe = popen('/sbin/sysctl -n kern.disks')
        self._disklist = pipe.read().strip().split(' ')
        self.max_choices = len(self._disklist)

    def __iter__(self):
        return iter((i, i) for i in self._disklist)

## Disk made from the disk you choose, a name you give the disk, and a description.
class Disk(models.Model):
    disks = models.CharField(max_length=120, choices=DiskChoices(),verbose_name='Disks')
    name = models.CharField(max_length=25, verbose_name='Disk Name')
    description = models.CharField(max_length=120, verbose_name='Description', blank=True)

## When saved the disk will be named something like, 'ada0 (Disk Name)'
    def __unicode__(self):
        return self.disks + ' (' + self.name + ')'

In forms.py,

# DiskForm takes a normal django Model and renders it as a django form
class DiskForm(ModelForm):
    class Meta:
        model = Disk

In views.py,

# DiskView uses the django form and a template to display the form
def DiskView(request):
    if request.method == 'POST':
        form = DiskForm(request.POST)
        if form.is_valid():
            form.save()
    else:
        form = DiskForm()
    variables = RequestContext(request, {
        'form': form
    })
    return render_to_response('freenas/disks/disk.html', variables)

In urls.py,

# the urlpattern defines a URL to use with the View

urlpatterns = patterns('',
    (r'^freenas/disk/$', DiskView),
)

There are several more things to familiarize yourself with before it all really fits together, this is a simple example about the different pieces of the puzzle. I didn’t cover how I used FormWizard, but the links provided above should suffice, for now. The most fun is when Xin Li connects the UI to his magical middleware; which communicates with the FreeBSD box and the UI. As these portions of FreeNAS are still experimental, bugs are sure to be found. I’m sure a code-cleanup is in order as well…

If you’re interested in the freenas project visit #freenas on Freenode, freenas.org, or blog.freenas.org.

YO! Check it:

svn co https://freenas.svn.sourceforge.net/svnroot/freenas/experimental/ix/ freenas

  • Print
  • RSS
  • PDF
  • Facebook
  • Twitter
  • Identi.ca
  • Technorati

Comments

  • Tweets that mention Dramashack! » FreeNAS 0.8 is Highly Experimental, Proceed with Caution! -- Topsy.com

    August 12, 2010 |

    [...] This post was mentioned on Twitter by Denise and Denise, James T. Nixon III. James T. Nixon III said: Blog: Understanding the new FreeNAS UI – http://bit.ly/cgocM5 #freenas #django #freebsd [...]

  • James T. Nixon III

    July 29, 2010 |

    Lol, I know right!?

  • Matt Olander

    July 29, 2010 |

    Great pix, James! Haha, that’s ironic that ISC, a customer of iX, won the server! PERFECT ;)

  • alan

    October 28, 2009 |

    One Question Habra version The 3 cds of the PC-BSD 8.0 Hubble Edition

  • Shaul

    September 4, 2009 |

    I would have to completely disagree with what you say how good PC-BSD is. And for the record, I do not use Linux, I do not have Linux installed on any systems. With the code they develop on top of FreeBSD for PC-BSD has consistency issue, and just don’t think they pay close enough attention to code correctness, I think it gets sluggish. Although my first choice is always to use OpenBSD on everything, I have set up FreeBSD as a desktop system. All I do is select minimal install, populate ports and source, patch the system, compile KDE4 from ports, and I find everything runs better and quicker that way. Once Firefox has been compiled from ports, I have seen it load instantaneously when you select it from KMenu. With PCBSD being developed for people who don’t know any tech stuff, and their own lack of proper auditing of code in the manner of say OpenBSD, I see definite performance issues, and some speed issues. I think it just gets bogged down. So that is why I would definitely disagree with what you say about how good PC-BSD is.