diff options
Diffstat (limited to 'ec2init/DataSourceEc2.py')
-rw-r--r-- | ec2init/DataSourceEc2.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ec2init/DataSourceEc2.py b/ec2init/DataSourceEc2.py index 9afbe8b9..123ede67 100644 --- a/ec2init/DataSourceEc2.py +++ b/ec2init/DataSourceEc2.py @@ -108,3 +108,14 @@ class DataSourceEc2(DataSource.DataSource): keys.append(pkey) return(keys) + + def getswap_devs(self): + if not self.metadata.has_key('block-device-mapping'): + raise Exception("no block-device-mapping") + list = [] + for use_t, device in self.metadata['block-device-mapping'].items(): + if not device.startswith("/dev"): + device="/dev/%s" % device + if use_t == "swap": + list.append(device) + return(list) |