[v1,0/7] add json power policy interface for containers
mbox series

Message ID 20180830105422.1198-1-david.hunt@intel.com
Headers show
  • add json power policy interface for containers
Related show


David Hunt Aug. 30, 2018, 10:54 a.m. UTC
The current vm_power_manager example app has the capability to accept power
policies from virtual machines via virtio-serial channels. These power
policies  allow a virtual machine to give information to the power manager
to allow the power manager take care of the power management of the virtual
machine based on the information in the policy.

This power policy functionality is limited to virtual machines sending
the policies to the power manager (which runs in the Host OS), and a solution
was needed for additional methods of sending power policies to the power
manager app.

The main use-case for this modification is for containers and host
applications that wish to send polices to the power manager.

This patchset adds the capability to send power polices and power commands
to the vm_power_manager app via JSON strings through a fifo on the file
For example, given the following file, policy.json:

{"policy": {
  "name": "ubuntu2",
  "command": "create",
  "policy_type": "TIME",
  "busy_hours":[ 17, 18, 19, 20, 21, 22, 23 ],
  "quiet_hours":[ 2, 3, 4, 5, 6 ],
  "core_list":[ 11, 12, 13 ]

Then running the command:

cat policy.json >/tmp/powermonitor/fifo.0

The policy is sent to the vm_power_manager. The power manager app then parses
the JSON data, and inserts the policy into the array of policies.

Part of the patch series contains documentation updates to give all the
details of the valid name-value pairs, the data types, etc.

[1/7] examples/power: add checks around hypervisor
[2/7] lib/power: add changes for host commands/policies
[3/7] examples/power: add necessary changes to guest app
[4/7] examples/power: add host channel to power manager
[5/7] examples/power: add json string handling
[6/7] doc/vm_power_manager: add JSON interface API info
[7/7] examples/power: add json example files