def ui_command_create(self, storage_object, lun=None, add_mapped_luns=None):
    '\n        Creates a new LUN in the Target Portal Group, attached to a storage\n        object. If the I{lun} parameter is omitted, the first available LUN in\n        the TPG will be used. If present, it must be a number greater than 0.\n        Alternatively, the syntax I{lunX} where I{X} is a positive number is\n        also accepted.\n\n        The I{storage_object} must be the path of an existing storage object,\n        i.e. B{/backstore/pscsi0/mydisk} to reference the B{mydisk} storage\n        object of the virtual HBA B{pscsi0}.\n\n        If I{add_mapped_luns} is omitted, the global parameter\n        B{auto_add_mapped_luns} will be used, else B{true} or B{false} are\n        accepted. If B{true}, then after creating the LUN, mapped LUNs will be\n        automatically created for all existing node ACLs, mapping the new LUN.\n\n        SEE ALSO\n        ========\n        B{delete}\n        '
    self.assert_root()
    add_mapped_luns = self.ui_eval_param(add_mapped_luns, 'bool', self.shell.prefs['auto_add_mapped_luns'])
    try:
        so = self.get_node(storage_object).rtsnode
    except ValueError:
        self.shell.log.error(('Invalid storage object %s.' % storage_object))
        return
    if (so in (l.storage_object for l in self.parent.rtsnode.luns)):
        raise ExecutionError(('lun for storage object %s already exists' % storage_object))
    if (lun and lun.lower().startswith('lun')):
        lun = lun[3:]
    lun_object = LUN(self.tpg, lun, so)
    self.shell.log.info(('Created LUN %s.' % lun_object.lun))
    ui_lun = UILUN(lun_object, self)
    if add_mapped_luns:
        for acl in self.tpg.node_acls:
            if lun:
                mapped_lun = lun
            else:
                mapped_lun = 0
            existing_mluns = [mlun.mapped_lun for mlun in acl.mapped_luns]
            if (mapped_lun in existing_mluns):
                mapped_lun = None
                for possible_mlun in xrange(LUN.MAX_LUN):
                    if (possible_mlun not in existing_mluns):
                        mapped_lun = possible_mlun
                        break
            if (mapped_lun == None):
                self.shell.log.warning(('Cannot map new lun %s into ACL %s' % (lun_object.lun, acl.node_wwn)))
            else:
                mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False)
                self.shell.log.info(('Created LUN %d->%d mapping in node ACL %s' % (mlun.tpg_lun.lun, mlun.mapped_lun, acl.node_wwn)))
        self.parent.refresh()
    return self.new_node(ui_lun)
Creates a new LUN in the Target Portal Group, attached to a storage
object. If the I{lun} parameter is omitted, the first available LUN in
the TPG will be used. If present, it must be a number greater than 0.
Alternatively, the syntax I{lunX} where I{X} is a positive number is
also accepted.

The I{storage_object} must be the path of an existing storage object,
i.e. B{/backstore/pscsi0/mydisk} to reference the B{mydisk} storage
object of the virtual HBA B{pscsi0}.

If I{add_mapped_luns} is omitted, the global parameter
B{auto_add_mapped_luns} will be used, else B{true} or B{false} are
accepted. If B{true}, then after creating the LUN, mapped LUNs will be
automatically created for all existing node ACLs, mapping the new LUN.

SEE ALSO
========
B{delete}
def ui_command_create(self, storage_object, lun=None, add_mapped_luns=None):
    '\n        Creates a new LUN in the Target Portal Group, attached to a storage\n        object. If the I{lun} parameter is omitted, the first available LUN in\n        the TPG will be used. If present, it must be a number greater than 0.\n        Alternatively, the syntax I{lunX} where I{X} is a positive number is\n        also accepted.\n\n        The I{storage_object} must be the path of an existing storage object,\n        i.e. B{/backstore/pscsi0/mydisk} to reference the B{mydisk} storage\n        object of the virtual HBA B{pscsi0}.\n\n        If I{add_mapped_luns} is omitted, the global parameter\n        B{auto_add_mapped_luns} will be used, else B{true} or B{false} are\n        accepted. If B{true}, then after creating the LUN, mapped LUNs will be\n        automatically created for all existing node ACLs, mapping the new LUN.\n\n        SEE ALSO\n        ========\n        B{delete}\n        '
    self.assert_root()
    add_mapped_luns = self.ui_eval_param(add_mapped_luns, 'bool', self.shell.prefs['auto_add_mapped_luns'])
    try:
        so = self.get_node(storage_object).rtsnode
    except ValueError:
        self.shell.log.error(('Invalid storage object %s.' % storage_object))
        return
    if (so in (l.storage_object for l in self.parent.rtsnode.luns)):
        raise ExecutionError(('lun for storage object %s already exists' % storage_object))
    if (lun and lun.lower().startswith('lun')):
        lun = lun[3:]
    lun_object = LUN(self.tpg, lun, so)
    self.shell.log.info(('Created LUN %s.' % lun_object.lun))
    ui_lun = UILUN(lun_object, self)
    if add_mapped_luns:
        for acl in self.tpg.node_acls:
            if lun:
                mapped_lun = lun
            else:
                mapped_lun = 0
            existing_mluns = [mlun.mapped_lun for mlun in acl.mapped_luns]
            if (mapped_lun in existing_mluns):
                mapped_lun = None
                for possible_mlun in xrange(LUN.MAX_LUN):
                    if (possible_mlun not in existing_mluns):
                        mapped_lun = possible_mlun
                        break
            if (mapped_lun == None):
                self.shell.log.warning(('Cannot map new lun %s into ACL %s' % (lun_object.lun, acl.node_wwn)))
            else:
                mlun = MappedLUN(acl, mapped_lun, lun_object, write_protect=False)
                self.shell.log.info(('Created LUN %d->%d mapping in node ACL %s' % (mlun.tpg_lun.lun, mlun.mapped_lun, acl.node_wwn)))
        self.parent.refresh()
    return self.new_node(ui_lun)