From a526d7fa0e3359e63b70f6a0a5bc35e210f6a4f6 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Fri, 27 Jul 2007 18:02:36 +0000 Subject: [PATCH] Add support for assigning IP addresses --- sliver_vs.py | 4 ++++ sm.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sliver_vs.py b/sliver_vs.py index 09cf5b2..ca538c0 100644 --- a/sliver_vs.py +++ b/sliver_vs.py @@ -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 --- 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 -- 2.43.0