         type            : String
         default         : -> null
       name              : String
-      hostnameAlias     : String
+      hostnameAlias     : [String]
       users             : Array
       groups            : Array
       usage             : # TODO: usage seems like the wrong term for this.

    JGroup  = require './group'
    JUser   = require './user'

    addVm = ({ target, user, name, sudo, groups })->
      vm = new JVM {
        name: name
        users: [
          { id: user.getId(), sudo: yes, owner: yes }
        ]
        groups: groups ? []
      }
      vm.save (err)-> target.addVm vm, handleError


        type            : Boolean
        default         : no

  @createAliases = ({nickname, type, uid, groupSlug})->
    domain       = 'kd.io'
    if type is 'user'
      prefix = if uid > 0 then "vm#{uid}." else ""
      aliases = ["#{prefix}#{nickname}.#{groupSlug}.#{domain}"]
      if groupSlug is 'koding'
        aliases.push "#{prefix}#{nickname}.#{domain}"
    else if type is 'group'
      if uid is 0
        aliases = ["#{groupSlug}.#{domain}"
                 "shared.#{groupSlug}.#{domain}"]
      else
        aliases = ["shared-#{uid}.#{groupSlug}.#{domain}"]

    return aliases

  # TODO: this needs to be rethought in terms of bundles, as per the
  # discussion between Devrim, Chris T. and Badahir  C.T.
  @createVm = ({account, type, groupSlug, usage}, callback)->
    JGroup = require './group'
    JGroup.one {slug: groupSlug}, (err, group)=>
      return callback err  if err
      account.fetchUser (err, user)=>
        return callback err  if err
        name = "#{groupSlug}~"
        if type is 'user'
