Exemple #1
0
 def delete(self, params):
     """Delete the specified node groups
            fuel --env 1 nodegroup --delete --group 1
            fuel --env 1 nodegroup --delete --group 2,3,4
     """
     ngs = NodeGroup.get_by_ids(params.group)
     for n in ngs:
         if n.name == "default":
             raise ActionException("Default node groups cannot be deleted.")
         NodeGroup.delete(n.id)
Exemple #2
0
 def assign(self, params):
     """Assign nodes to specified node group:
             fuel --env 1 nodegroup --assign --node 1 --group 1
             fuel --env 1 nodegroup --assign --node 2,3,4 --group 1
     """
     nodes = [n.id for n in map(Node, params.node)]
     ngs = map(NodeGroup, params.group)
     if len(ngs) > 1:
         raise ActionException(
             "Nodes can only be assigned to one node group.")
     NodeGroup.assign(ngs[0].id, nodes)
Exemple #3
0
 def delete(self, params):
     """Delete the specified node groups
            fuel nodegroup --delete --group 1
            fuel nodegroup --delete --group 2,3,4
     """
     ngs = NodeGroup.get_by_ids(params.group)
     for n in ngs:
         if n.name == "default":
             raise ActionException("Default node groups cannot be deleted.")
         data = NodeGroup.delete(n.id)
         self.serializer.print_to_output(
             data, u"Node group with id={id} was deleted!".format(id=n.id))
 def delete(self, params):
     """Delete the specified node groups
            fuel --env 1 nodegroup --delete --group 1
            fuel --env 1 nodegroup --delete --group 2,3,4
     """
     ngs = NodeGroup.get_by_ids(params.group)
     for n in ngs:
         if n.name == "default":
             raise ActionException(
                 "Default node groups cannot be deleted."
             )
         NodeGroup.delete(n.id)
Exemple #5
0
 def assign(self, params):
     """Assign nodes to specified node group:
             fuel --env 1 nodegroup --assign --node 1 --group 1
             fuel --env 1 nodegroup --assign --node 2,3,4 --group 1
     """
     nodes = [n.id for n in map(Node, params.node)]
     ngs = map(NodeGroup, params.group)
     if len(ngs) > 1:
         raise ActionException(
             "Nodes can only be assigned to one node group."
         )
     NodeGroup.assign(ngs[0].id, nodes)
    def create(self, params):
        """Create a new node group
               fuel --env 1 nodegroup --create --name "group 1"
        """
        env_id = int(params.env)
        data = NodeGroup.create(params.name, env_id)
        env = Environment(env_id)
        network_data = env.get_network_data()
        seg_type = network_data['networking_parameters'].get(
            'segmentation_type'
        )
        if seg_type == 'vlan':
            six.print_("WARNING: In VLAN segmentation type, there will be no "
                       "connectivity over private network between instances "
                       "running on hypervisors in different segments and that "
                       "it's a user's responsibility to handle this "
                       "situation.",
                       file=sys.stderr)

        self.serializer.print_to_output(
            data,
            u"Node group '{name}' with id={id} "
            u"in environment {env} was created!"
            .format(env=env_id, **data)
        )
 def delete(self, params):
     """Delete the specified node groups
            fuel nodegroup --delete --group 1
            fuel nodegroup --delete --group 2,3,4
     """
     ngs = NodeGroup.get_by_ids(params.group)
     for n in ngs:
         if n.name == "default":
             raise ActionException(
                 "Default node groups cannot be deleted."
             )
         data = NodeGroup.delete(n.id)
         self.serializer.print_to_output(
             data,
             u"Node group with id={id} was deleted!"
             .format(id=n.id)
         )
Exemple #8
0
    def assign(self, params):
        """Assign nodes to specified node group:
                fuel nodegroup --assign --node 1 --group 1
                fuel nodegroup --assign --node 2,3,4 --group 1
        """
        if len(params.group) > 1:
            raise ActionException(
                "Nodes can only be assigned to one node group.")

        group = NodeGroup(params.group.pop())
        group.assign(params.node)
Exemple #9
0
    def create(self, params):
        """Create a new node group
               fuel --env 1 nodegroup --create --name "group 1"
        """
        env_id = int(params.env)
        data = NodeGroup.create(params.name, env_id)
        env = Environment(env_id)
        network_data = env.get_network_data()
        seg_type = network_data['networking_parameters'].get(
            'segmentation_type')
        if seg_type == 'vlan':
            six.print_(
                "WARNING: In VLAN segmentation type, there will be no "
                "connectivity over private network between instances "
                "running on hypervisors in different segments and that "
                "it's a user's responsibility to handle this "
                "situation.",
                file=sys.stderr)

        self.serializer.print_to_output(
            data, u"Node group '{name}' with id={id} "
            u"in environment {env} was created!".format(env=env_id, **data))
 def create(self, params):
     """Create a new node group
            fuel --env 1 nodegroup --create --name "group 1"
     """
     NodeGroup.create(params.name, int(params.env))
Exemple #11
0
 def create(self, params):
     """Create a new node group
            fuel --env 1 nodegroup --create --name "group 1"
     """
     NodeGroup.create(params.name, int(params.env))