Exemple #1
0
    def __init__(self, *args, **kwargs):

        super(Volumes, self).__init__(*args, **kwargs)
        self.append_children([
            AddVolume(),
            ImportVolume(),
            AutoImportVolume(),
            ViewVolumes(),
            ViewDisks(),
        ])

        if not appPool.hook_feature_disabled('ufs'):
            self.append_child(AddVolumeUFS())

        has_multipath = models.Disk.objects.exclude(
            disk_multipath_name=''
        ).exists()
        if has_multipath:
            self.append_child(ViewMultipaths())

        mp = models.MountPoint.objects.select_related().order_by('-id')
        for i in mp:
            nav = TreeNode(i.mp_volume.id)
            nav.name = i.mp_path
            nav.order = -i.id
            nav.model = 'Volume'
            nav.kwargs = {'oid': i.mp_volume.id, 'model': 'Volume'}
            nav.icon = u'VolumesIcon'

            if i.mp_volume.vol_fstype == 'ZFS':
                ds = TreeNode('Dataset')
                ds.name = _(u'Create ZFS Dataset')
                ds.view = 'storage_dataset'
                ds.icon = u'AddDatasetIcon'
                ds.type = 'object'
                ds.kwargs = {'fs': i.mp_volume.vol_name}
                nav.append_child(ds)

                zv = AddZVol()
                zv.kwargs = {'parent': i.mp_volume.vol_name}
                nav.append_child(zv)

            subnav = TreeNode('ChangePermissions')
            subnav.name = _('Change Permissions')
            subnav.type = 'editobject'
            subnav.view = 'storage_mp_permission'
            subnav.kwargs = {'path': i.mp_path}
            subnav.model = 'Volume'
            subnav.icon = u'ChangePasswordIcon'
            subnav.app_name = 'storage'

            datasets = i.mp_volume.get_datasets(hierarchical=True)
            if datasets:
                for name, d in datasets.items():
                    # TODO: non-recursive algo
                    self._gen_dataset(nav, d)

            nav.append_child(subnav)
            self.insert_child(0, nav)
Exemple #2
0
 def get_datagrid_context(self, request):
     has_multipath = models.Disk.objects.exclude(
         disk_multipath_name='').exists()
     ufs_disabled = appPool.hook_feature_disabled('ufs')
     return {
         'has_multipath': has_multipath,
         'ufs_disabled': ufs_disabled,
     }
Exemple #3
0
 def get_datagrid_context(self, request):
     has_multipath = models.Disk.objects.exclude(
         disk_multipath_name='').exists()
     ufs_disabled = appPool.hook_feature_disabled('ufs')
     return {
         'has_multipath': has_multipath,
         'ufs_disabled': ufs_disabled,
     }
Exemple #4
0
    def __init__(self, *args, **kwargs):

        super(Volumes, self).__init__(*args, **kwargs)
        self.append_children([
            AddVolume(),
            ImportVolume(),
            AutoImportVolume(),
            ViewVolumes(),
            ViewDisks(),
        ])

        if not appPool.hook_feature_disabled('ufs'):
            self.append_child(AddVolumeUFS())

        has_multipath = models.Disk.objects.exclude(
            disk_multipath_name='').exists()
        if has_multipath:
            self.append_child(ViewMultipaths())

        mp = models.MountPoint.objects.select_related().order_by('-id')
        for i in mp:
            nav = TreeNode(i.mp_volume.id)
            nav.name = i.mp_path
            nav.order = -i.id
            nav.model = 'Volume'
            nav.kwargs = {'oid': i.mp_volume.id, 'model': 'Volume'}
            nav.icon = u'VolumesIcon'

            if i.mp_volume.vol_fstype == 'ZFS':
                ds = TreeNode('Dataset')
                ds.name = _(u'Create ZFS Dataset')
                ds.view = 'storage_dataset'
                ds.icon = u'AddDatasetIcon'
                ds.type = 'object'
                ds.kwargs = {'fs': i.mp_volume.vol_name}
                nav.append_child(ds)

                zv = AddZVol()
                zv.kwargs = {'parent': i.mp_volume.vol_name}
                nav.append_child(zv)

            subnav = TreeNode('ChangePermissions')
            subnav.name = _('Change Permissions')
            subnav.type = 'editobject'
            subnav.view = 'storage_mp_permission'
            subnav.kwargs = {'path': i.mp_path}
            subnav.model = 'Volume'
            subnav.icon = u'ChangePasswordIcon'
            subnav.app_name = 'storage'

            datasets = i.mp_volume.get_datasets(hierarchical=True)
            if datasets:
                for name, d in datasets.items():
                    # TODO: non-recursive algo
                    self._gen_dataset(nav, d)

            nav.append_child(subnav)
            self.insert_child(0, nav)