• David Johnson's avatar
    Add a CLI for FreeNAS to build Emulab clientside support. · 42c6e214
    David Johnson authored
    FreeNAS is basically a web frontend to BSD-backed ZFS volumes,
    filesystems, and various ways to share them (i.e., iSCSI, NFS, etc).
    It stores all its config info in a sqlite DB from which it configs
    the BSD system.  It uses Django (a slightly weird MVC that exports a web
    interface; logic/models/views are all in python, and there is an
    HTML-based template interface.
    What I did was basically to wrap the model/form parts of FreeNAS's
    code -- so for the commands we want to support, we actually mock up
    an HTTP request, and submit it directly to the correct handler function
    that the FreeNAS Django config files specify.  This allows us to leverage
    all the FreeNAS error checking code and automation (i.e., deleting an
    interface would delete aliases on that interface too).
    usage() prints this, at present:
    Supply a command set class, an operation, and the necessary arguments.
      interface       Configure network interfaces
        add  <interface> <name> [<dhcp=X> <ipv6auto=X> <options=X> ] ...
        del  <interface>
        edit <interface> [<dhcp=X> <ipv6auto=X> <name=X> <options=X> ] ...
      ist             Configure ISCSI targets (a target binds SCSI attributes
             (i.e. serial number, r/w flags, queue depth, block size) to iSCSI
             attributes (i.e., a target portal, authorized initiator network ACLs,
             iSCSI authentication info)
        add  <name> <serial> <portalgroup> <initiatorgroup> [<authtype>
             <authgroup> ] [<alias=X> <flags=X> <logical_blocksize=X>
             <queue_depth=X> <type=X> ]
        del  <name>
        edit <name> [<serial> <portalgroup> <initiatorgroup> <authtype>
             <authgroup> ]
      ist_assoc       Associate extents with targets (final "link" between storage
             and network)
        add <target> <extent>
        del <target> <extent>
      ist_authcred    Configure ISCSI target authentication credentials (i.e.,
        add  <tag> <user> <secret1> [<peeruser> <peersecret1> ]
        del  <user>
        edit <tag> <user> <secret1> [<peeruser> <peersecret1> ]
      ist_authinit    Configure ISCSI initiator authorizations by hostname or
        add  <tag> <initiators> [<auth_network> <comment> ]
        del  <tag>
        edit <tag> <initiators> [<auth_network> <comment> ]
      ist_config      Configure general ISCSI parameters
        edit [<basename=X> <defaultt2r=X> <defaultt2w=X> <discoveryauthgroup=X>
             <discoveryauthmethod=X> <firstburst=X> <iotimeout=X> <maxburst=X>
             <maxconnect=X> <maxoutstandingr2t=X> <maxrecdata=X> <maxsesh=X>
             <nopinint=X> <r2t=X> ]
      ist_extent      Configure ISCSI target extents (block devs or files exported
             via ISCSI)
        add      <name> <dev> [<comment> ]
        addfile  <name> <path> <filesize> [<comment> ]
        del      <name>
        edit     <name> <dev> [<comment> ]
        editfile <name> <path> [<comment> ] [<filesize=X> ]
      ist_portal      Configure ISCSI target portals (i.e., ip:port binding to
             associate with a target)
        add  <tag> [<comment=X> ] ...
        del  <tag>
        edit <tag> [<comment=X> ] ...
      network         Configure generic network settings
        config [<domain=X> <hostname=X> <ipv4gateway=X> <ipv6gateway=X>
             <nameserver1=X> <nameserver2=X> <nameserver3=X> ]
      pool            Configure ZFS storage pools
        add <volume_name> <volume_fstype> <group_type>  ...
        del <vol_name>
        mod <volume_add> <volume_fstype> <group_type>  ...
      route           Configure static routes
        add <destination> <gateway> [<description> ]
        del <destination> [<gateway> ]
      snapshot        Create, clone, rollback ZFS snapshots of volumes or clones
        add      <snap_name>
        clone    <cs_snapshot> <cs_name>
        del      <snap_name>
        rollback <snap_name>
      vlan            Configure vlan interfaces
        add <pint> <vint> <tag> [<description> ]
        del <vint>
      volume          Configure ZFS volumes (zvols) atop pools
        add <pool_name> <zvol_name> <zvol_size> <zvol_compression>
        del <pool_name> <vol_name>
freenas-config 43.5 KB