add reading of 'seedfrom' via DataSourceNoCloud's DataSourceConfig

What this does is provide an second DataSource that could use the
kernel command line url=.  For example:
  ro root=/dev/vda url=http://example.com/i-abcdefg/

http://example.com/i-abcdefg/ would contain:
datasource:
  NoCloud:
    # default seedfrom is None
    # if found, then it should contain a url with:
    #    <url>/user-data and <url>/meta-data
    # seedfrom: http://my.example.com/i-abcde
    seedfrom: http://example.com/i-abcdefg/

Then, the NoCloudNet DataSource would find that seedfrom config
and consume data at
  http://example.com/i-abcdefg/user-data
and
  http://example.com/i-abcdefg/meta-data
This commit is contained in:
Scott Moser 2012-04-04 22:05:17 -04:00
parent ceeedf3a03
commit c10de5db0f
2 changed files with 14 additions and 0 deletions

View File

@ -67,6 +67,13 @@ class DataSourceNoCloud(DataSource.DataSource):
found.append(self.seeddir)
log.debug("using seeded cache data in %s" % self.seeddir)
# if the datasource config had a 'seedfrom' entry, then that takes
# precedence over a 'seedfrom' that was found in a filesystem
# but not over external medi
if 'seedfrom' in self.ds_cfg and self.ds_cfg['seedfrom']:
found.append(["ds_config"])
md["seedfrom"] = self.ds_cfg['seedfrom']
fslist = util.find_devs_with("TYPE=vfat")
fslist.extend(util.find_devs_with("TYPE=iso9660"))

View File

@ -24,3 +24,10 @@ datasource:
consumer_key: Xh234sdkljf
token_key: kjfhgb3n
token_secret: 24uysdfx1w4
NoCloud:
# default seedfrom is None
# if found, then it should contain a url with:
# <url>/user-data and <url>/meta-data
# seedfrom: http://my.example.com/i-abcde
seedfrom: None