phosphor-settings-defaults: refactor defaults settings for multihost support
separate host items from defaults.yaml to host-template.yaml
add host items to defaults.yaml based on OBMC_HOST_INSTANCES to support multi-host.
TESTED:
a. build with default OBMC_HOST_INSTANCES="0"
`busctl tree xyz.openbmc_project.Settings`
└─/xyz
└─/xyz/openbmc_project
├─/xyz/openbmc_project/control
│ ├─/xyz/openbmc_project/control/host0
│ │ ├─/xyz/openbmc_project/control/host0/TPMEnable
│ │ ├─/xyz/openbmc_project/control/host0/auto_reboot
│ │ │ └─/xyz/openbmc_project/control/host0/auto_reboot/one_time
│ │ ├─/xyz/openbmc_project/control/host0/boot
│ │ │ └─/xyz/openbmc_project/control/host0/boot/one_time
│ │ ├─/xyz/openbmc_project/control/host0/power_cap
│ │ ├─/xyz/openbmc_project/control/host0/power_restore_policy
│ │ │ └─/xyz/openbmc_project/control/host0/power_restore_policy/one_time
│ │ ├─/xyz/openbmc_project/control/host0/restriction_mode
│ │ └─/xyz/openbmc_project/control/host0/turbo_allowed
│ ├─/xyz/openbmc_project/control/minimum_ship_level_required
│ ├─/xyz/openbmc_project/control/power_supply_attributes
│ └─/xyz/openbmc_project/control/power_supply_redundancy
├─/xyz/openbmc_project/logging
│ ├─/xyz/openbmc_project/logging/rest_api_logs
│ └─/xyz/openbmc_project/logging/settings
├─/xyz/openbmc_project/network
│ └─/xyz/openbmc_project/network/host0
│ └─/xyz/openbmc_project/network/host0/intf
│ └─/xyz/openbmc_project/network/host0/intf/addr
├─/xyz/openbmc_project/software
│ └─/xyz/openbmc_project/software/apply_time
└─/xyz/openbmc_project/time
└─/xyz/openbmc_project/time/sync_method
b. build with Bletchley platform: OBMC_HOST_INSTANCES = "1 2 3 4 5 6"
`busctl tree xyz.openbmc_project.Settings`
└─/xyz
└─/xyz/openbmc_project
├─/xyz/openbmc_project/control
│ ├─/xyz/openbmc_project/control/host1
│ │ ├─/xyz/openbmc_project/control/host1/TPMEnable
│ │ ├─/xyz/openbmc_project/control/host1/auto_reboot
│ │ │ └─/xyz/openbmc_project/control/host1/auto_reboot/one_time
│ │ ├─/xyz/openbmc_project/control/host1/boot
│ │ │ └─/xyz/openbmc_project/control/host1/boot/one_time
│ │ ├─/xyz/openbmc_project/control/host1/power_cap
│ │ ├─/xyz/openbmc_project/control/host1/power_restore_policy
│ │ │ └─/xyz/openbmc_project/control/host1/power_restore_policy/one_time
│ │ ├─/xyz/openbmc_project/control/host1/restriction_mode
│ │ └─/xyz/openbmc_project/control/host1/turbo_allowed
│ ├─/xyz/openbmc_project/control/host2
│ │ ├─/xyz/openbmc_project/control/host2/TPMEnable
│ │ ├─/xyz/openbmc_project/control/host2/auto_reboot
│ │ │ └─/xyz/openbmc_project/control/host2/auto_reboot/one_time
│ │ ├─/xyz/openbmc_project/control/host2/boot
│ │ │ └─/xyz/openbmc_project/control/host2/boot/one_time
│ │ ├─/xyz/openbmc_project/control/host2/power_cap
│ │ ├─/xyz/openbmc_project/control/host2/power_restore_policy
│ │ │ └─/xyz/openbmc_project/control/host2/power_restore_policy/one_time
│ │ ├─/xyz/openbmc_project/control/host2/restriction_mode
│ │ └─/xyz/openbmc_project/control/host2/turbo_allowed
│ ├─/xyz/openbmc_project/control/host3
(.......repeat util host6)
│ ├─/xyz/openbmc_project/control/minimum_ship_level_required
│ ├─/xyz/openbmc_project/control/power_supply_attributes
│ └─/xyz/openbmc_project/control/power_supply_redundancy
├─/xyz/openbmc_project/logging
│ ├─/xyz/openbmc_project/logging/rest_api_logs
│ └─/xyz/openbmc_project/logging/settings
├─/xyz/openbmc_project/network
│ ├─/xyz/openbmc_project/network/host1
│ │ └─/xyz/openbmc_project/network/host1/intf
│ │ └─/xyz/openbmc_project/network/host1/intf/addr
│ ├─/xyz/openbmc_project/network/host2
│ │ └─/xyz/openbmc_project/network/host2/intf
│ │ └─/xyz/openbmc_project/network/host2/intf/addr
│ ├─/xyz/openbmc_project/network/host3
│ │ └─/xyz/openbmc_project/network/host3/intf
│ │ └─/xyz/openbmc_project/network/host3/intf/addr
│ ├─/xyz/openbmc_project/network/host4
│ │ └─/xyz/openbmc_project/network/host4/intf
│ │ └─/xyz/openbmc_project/network/host4/intf/addr
│ ├─/xyz/openbmc_project/network/host5
│ │ └─/xyz/openbmc_project/network/host5/intf
│ │ └─/xyz/openbmc_project/network/host5/intf/addr
│ └─/xyz/openbmc_project/network/host6
│ └─/xyz/openbmc_project/network/host6/intf
│ └─/xyz/openbmc_project/network/host6/intf/addr
├─/xyz/openbmc_project/software
│ └─/xyz/openbmc_project/software/apply_time
└─/xyz/openbmc_project/time
└─/xyz/openbmc_project/time/sync_method
Change-Id: I4b70fb7e19647ea2ba5c985cb7c6bf851cb971b2
Signed-off-by: Allen.Wang <Allen_Wang@quantatw.com>
diff --git a/meta-phosphor/recipes-phosphor/settings/phosphor-settings-defaults-native.bb b/meta-phosphor/recipes-phosphor/settings/phosphor-settings-defaults-native.bb
index 77693af..79fe68a 100644
--- a/meta-phosphor/recipes-phosphor/settings/phosphor-settings-defaults-native.bb
+++ b/meta-phosphor/recipes-phosphor/settings/phosphor-settings-defaults-native.bb
@@ -7,6 +7,7 @@
inherit native
SRC_URI += "file://defaults.yaml"
+SRC_URI += "file://host-template.yaml"
PROVIDES += "virtual/phosphor-settings-defaults"
@@ -16,4 +17,10 @@
DEST=${D}${settings_datadir}
install -d ${DEST}
install defaults.yaml ${DEST}
+
+ for i in ${OBMC_HOST_INSTANCES};
+ do
+ cat host-template.yaml | sed "s/{}/${i}/g" >> ${DEST}/defaults.yaml
+
+ done
}