Exemplo n.º 1
0
 def get_initial(self):
     initial = super(FailoverView, self).get_initial()
     current_id = self.kwargs['baremetal']
     inode = self._find_ironic_node(current_id)
     try:
         if inode is not None:
             failover = inode['extra'].get('failover', None)
             if failover is not None:
                 node = shovel.request_node_get(failover)
                 list_drivers = shovel.get_driver_list()['drivers']
                 drivers = [elem['name'] for elem in list_drivers]
                 initial.update({
                     'nodeid': self.kwargs['baremetal'],
                     'node': node,
                     'drivers': drivers
                 })
             else:
                 raise ValueError('Failover node not set')
         else:
             raise ValueError('Registered node not found')
     except ValueError as e:
         redirect = reverse('horizon:admin:rackhd:index')
         messages.error(self.request, _(e.message))
         raise Exception(e.message)
     self._remove_node(current_id)
     messages.success(self.request,
                      _('Removed node {0}'.format(current_id)))
     return initial
Exemplo n.º 2
0
    def get_initial(self):
        id = self.kwargs['baremetal']
        node = shovel.request_node_get(id)
        list_drivers = shovel.get_driver_list()['drivers']
        drivers = [ elem['name'] for elem in list_drivers ]
        ports = str(node['name']).split(',')

        list_images = shovel.get_images_list()['images']
        images = [ elem['name'] for elem in list_images ]
        initial = super(RegisterView, self).get_initial()
        initial.update({'nodeid': self.kwargs['baremetal'], 'node': node, 'drivers': drivers,'images':images,'ports': ports})
        return initial
Exemplo n.º 3
0
    def get_initial(self):
        id = self.kwargs['baremetal']
        node = shovel.request_node_get(id)
        list_drivers = shovel.get_driver_list()['drivers']
        drivers = [elem['name'] for elem in list_drivers]
        ports = str(node['name']).split(',')

        list_images = shovel.get_images_list()['images']
        images = [elem['name'] for elem in list_images]
        initial = super(RegisterView, self).get_initial()
        initial.update({
            'nodeid': self.kwargs['baremetal'],
            'node': node,
            'drivers': drivers,
            'images': images,
            'ports': ports
        })
        return initial
Exemplo n.º 4
0
 def get_initial(self):
     initial = super(FailoverView, self).get_initial()
     current_id = self.kwargs['baremetal']
     inode = self._find_ironic_node(current_id)
     try:
         if inode is not None:
             failover = inode['extra'].get('failover', None)
             if failover is not None:
                 node = shovel.request_node_get(failover)
                 list_drivers = shovel.get_driver_list()['drivers']
                 drivers = [ elem['name'] for elem in list_drivers ]
                 initial.update({'nodeid': self.kwargs['baremetal'], 'node': node, 'drivers': drivers}) 
             else:
                 raise ValueError('Failover node not set') 
         else:
             raise ValueError('Registered node not found') 
     except ValueError as e:
         redirect = reverse('horizon:admin:rackhd:index')
         messages.error(self.request, _(e.message))
         raise Exception(e.message)    
     self._remove_node(current_id)
     messages.success(self.request, _('Removed node {0}'.format(current_id)))
     return initial