Add support for assigning IP addresses
authorDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Fri, 27 Jul 2007 18:02:36 +0000 (18:02 +0000)
committerDaniel Hokka Zakrisson <dhokka@cs.princeton.edu>
Fri, 27 Jul 2007 18:02:36 +0000 (18:02 +0000)
sliver_vs.py
sm.py

index 09cf5b2..ca538c0 100644 (file)
@@ -169,6 +169,10 @@ class Sliver_VS(accounts.Account, vserver.VServer):
                 logger.log('%s: setting cpu share to %d' % (self.name, cpu_share))
                 self.set_sched_config(cpu_share, 0)
 
+            if self.rspec['ip_addresses'] != '0.0.0.0':
+                logger.log('%s: setting IP address(es) to %s' % (self.name, self.rspec['ip_addresses']))
+            self.set_ipaddresses_config(self.rspec['ip_addresses'])
+
             if False: # Does not work properly yet.
                 if self.have_limits_changed():
                     logger.log('%s: limits have changed --- restarting' % self.name)
diff --git a/sm.py b/sm.py
index 12e906c..3acce63 100644 (file)
--- a/sm.py
+++ b/sm.py
@@ -7,7 +7,7 @@ also to make inter-sliver resource loans.  The sliver manager is also
 responsible for handling delegation accounts.
 """
 
-# $Id: sm.py,v 1.26 2007/07/23 19:28:07 faiyaza Exp $
+# $Id: sm.py,v 1.27 2007/07/24 15:59:04 dhozac Exp $
 
 try: from bwlimit import bwmin, bwmax
 except ImportError: bwmin, bwmax = 8, 1000*1000*1000
@@ -41,6 +41,8 @@ DEFAULT_ALLOCATION = {
     'disk_max': 5000000, # bytes
     # capabilities
     'capabilities': '',
+    # IP-addresses'
+    'ip_addresses': '',
 
     # NOTE: this table is further populated with resource names and
     # default amounts via the start() function below.  This probably