lxd/db/profiles.go
func ProfilesExpandDevices(devices types.Devices, profiles []api.Profile) types.Devices {
	expandedDevices := types.Devices{}

	// Apply all the profiles
	profileDevices := make([]types.Devices, len(profiles))
	for i, profile := range profiles {
		profileDevices[i] = profile.Devices
	}
	for i := range profileDevices {
		for k, v := range profileDevices[i] {
			expandedDevices[k] = v
		}
	}

	// Stick the given devices on top
	for k, v := range devices {
		expandedDevices[k] = v
	}

	return expandedDevices
}
func ProfilesExpandDevices(devices types.Devices, profiles []api.Profile) types.Devices {
	expandedDevices := types.Devices{}

	// Apply all the profiles
	profileDevices := make([]types.Devices, len(profiles))
	for i, profile := range profiles {
		profileDevices[i] = profile.Devices
	}
	for i := range profileDevices {
		for k, v := range profileDevices[i] {
			expandedDevices[k] = v
		}
	}

	// Stick the given devices on top
	for k, v := range devices {
		expandedDevices[k] = v
	}

	return expandedDevices
}
// ProfilesExpandDevices expands the given container devices with the devices
// defined in the given profiles.