Revision af6a3bc5 snf-cyclades-app/synnefo/db/models.py

b/snf-cyclades-app/synnefo/db/models.py
548 548

  
549 549
        self.save()
550 550

  
551
    def __init__(self, *args, **kwargs):
552
        super(Network, self).__init__(*args, **kwargs)
553
        if not self.mac_prefix:
554
            # Allocate a MAC prefix for just created Network instances
555
            mac_pool = MacPrefixPoolTable.get_pool()
556
            mac_prefix = mac_pool.get()
557
            mac_pool.save()
558
            self.mac_prefix = mac_prefix
559

  
560 551
    def create_backend_network(self, backend=None):
561 552
        """Create corresponding BackendNetwork entries."""
562 553

  

Also available in: Unified diff