Exemple #1
0
def index(request):
    sw_name = get_sw_name().lower()

    license, reason = utils.get_license()
    allow_update = True
    if hasattr(notifier, 'failover_status'):
        status = notifier().failover_status()
        if status not in ('MASTER', 'SINGLE'):
            allow_update = False

    context = {
        'sw_name': sw_name,
        'license': license,
        'fc_enabled': utils.fc_enabled(),
        'allow_update': allow_update,
    }
    for c in appPool.hook_view_context('support.index', request):
        context.update(c)

    if not notifier().is_freenas():
        form = forms.ProductionForm()
        if request.method == 'POST':
            form = forms.ProductionForm(request.POST)
            if form.is_valid():
                form.save()
                return JsonResp(
                    request,
                    message='Production status successfully updated.'
                )

        context['production_form'] = form

    return render(request, 'support/home.html', context)
Exemple #2
0
def iscsi(request):
    gconfid = models.iSCSITargetGlobalConfiguration.objects.all().order_by("-id")[0].id
    return render(
        request,
        "services/iscsi.html",
        {"focus_tab": request.GET.get("tab", ""), "gconfid": gconfid, "fc_enabled": fc_enabled()},
    )
Exemple #3
0
def iscsi(request):
    gconfid = models.iSCSITargetGlobalConfiguration.objects.all().order_by(
        "-id")[0].id
    return render(request, 'services/iscsi.html', {
        'focus_tab': request.GET.get('tab', ''),
        'gconfid': gconfid,
        'fc_enabled': fc_enabled(),
    })
Exemple #4
0
 def __init__(self, *args, **kwargs):
     super(iSCSITargetForm, self).__init__(*args, **kwargs)
     self._groups = []
     self.fields['iscsi_target_mode'].widget.attrs['onChange'] = (
         'targetMode();'
     )
     if not fc_enabled():
         self.fields['iscsi_target_mode'].initial = 'iscsi'
         self.fields['iscsi_target_mode'].widget = forms.widgets.HiddenInput()
Exemple #5
0
def index(request):
    sw_name = get_sw_name().lower()

    license, reason = utils.get_license()
    allow_update = True
    if hasattr(notifier, 'failover_status'):
        status = notifier().failover_status()
        if status not in ('MASTER', 'SINGLE'):
            allow_update = False

    context = {
        'sw_name': sw_name,
        'license': license,
        'fc_enabled': utils.fc_enabled(),
        'allow_update': allow_update,
    }
    for c in appPool.hook_view_context('support.index', request):
        context.update(c)

    return render(request, 'support/home.html', context)
Exemple #6
0
def home(request):

    view = appPool.hook_app_index('sharing', request)
    view = [_f for _f in view if _f]
    if view:
        return view[0]

    tab = request.GET.get('tab', '')

    # Redirect from services node
    if tab == 'services.ISCSI':
        tab = 'sharing.ISCSI.iSCSITargetGlobalConfiguration'

    if tab.startswith('sharing.ISCSI'):
        ntab = 'sharing.ISCSI'
    else:
        ntab = ''

    return render(request, 'sharing/index.html', {
        'focus_form': tab,
        'ntab': ntab,
        'fc_enabled': fc_enabled(),
    })
Exemple #7
0
 def done(self, *args, **kwargs):
     super(LicenseUpdateForm, self).done(*args, **kwargs)
     _n = notifier()
     if not _n.is_freenas() and _n.failover_licensed() and utils.fc_enabled():
         _n.start('ix-loader')
Exemple #8
0
 def rename(self):
     if fc_enabled():
         return u'%s (%s)' % (self.name, _('iSCSI'))
     return self.name
Exemple #9
0
 def pre_build_options(self):
     if not fc_enabled():
         raise ValueError
Exemple #10
0
 def done(self, *args, **kwargs):
     super(LicenseUpdateForm, self).done(*args, **kwargs)
     _n = notifier()
     if not _n.is_freenas() and _n.failover_licensed() and utils.fc_enabled():
         with client as c:
             c.call('etc.generate', 'loader')
Exemple #11
0
 def rename(self):
     return u'%s (%s%s)' % (
         _('Block'),
         _('iSCSI'),
         u'/' + unicode(_('FC')) if fc_enabled() else '',
     )
Exemple #12
0
 def rename(self):
     return '%s (%s%s)' % (
         _('Block'),
         _('iSCSI'),
         '/' + str(_('FC')) if fc_enabled() else '',
     )