lib/providers/lxd.rb in gogetit-0.16.0 vs lib/providers/lxd.rb in gogetit-0.17.0
- old
+ new
@@ -269,21 +269,31 @@
def generate_devices(args, options)
logger.info("Calling <#{__method__.to_s}>")
args[:devices] = {}
if options['no-maas']
- args[:devices] = \
- (Hashie.symbolize_keys YAML.load_file(options['file'])['devices'])
+ args[:devices] = YAML.load_file(options['file'])['devices']
+
+ # https://docs.maas.io/2.4/en/installconfig-lxd-install
+ for i in 0..7
+ i = i.to_s
+ args[:devices]["loop" + i] = {}
+ args[:devices]["loop" + i]["path"] = "/dev/loop" + i
+ args[:devices]["loop" + i]["type"] = "unix-block"
+ end
+
# Now, LXD API can handle integer as a value of a map
args[:devices].each do |k, v|
v.each do |kk, vv|
if vv.is_a? Integer
v[kk] = vv.to_s
end
end
end
+ args[:devices] = (Hashie.symbolize_keys args[:devices])
+
elsif options['ipaddresses']
options[:ifaces].each_with_index do |iface,index|
if index == 0
if iface['vlan']['name'] == 'untagged' # or vid == 0
args[:devices][:"eth#{index}"] = {
@@ -412,9 +422,10 @@
# https://github.com/jeffshantz/hyperkit/blob/master/lib/hyperkit/client/containers.rb#L240
# Adding configurations that are necessary for shipping MAAS on lxc
if options['no-maas'] and options['maas-on-lxc']
container.config = container.config.to_hash
+ # https://docs.maas.io/2.4/en/installconfig-lxd-install
container.config[:"raw.lxc"] = "\
lxc.cgroup.devices.allow = c 10:237 rwm\n\
lxc.aa_profile = unconfined\n\
lxc.cgroup.devices.allow = b 7:* rwm"
end