azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

azurelinux-sysinfo: new system information properties for host type and architecture

Open amritakohli opened this issue 1 year ago • 0 comments

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • [x] The toolchain has been rebuilt successfully (or no changes were made to it)
  • [x] The toolchain/worker package manifests are up-to-date
  • [x] Any updated packages successfully build (or no packages were changed)
  • [x] Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • [x] Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • [x] All package sources are available
  • [x] cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • [x] LICENSE-MAP files are up-to-date (./SPECS/LICENSES-AND-NOTICES/data/licenses.json, ./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md, ./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON)
  • [x] All source files have up-to-date hashes in the *.signatures.json files
  • [x] sudo make go-tidy-all and sudo make go-test-coverage pass
  • [x] Documentation has been updated to match any changes to the build system
  • [x] If you are adding/removing a .spec file that has multiple-versions supported, please add @microsoft/cbl-mariner-multi-package-reviewers team as reviewer (Eg. golang has 2 versions 1.18, 1.21+)
  • [ ] Ready to merge

Summary

Added properties under system_info for architecture, system manufacturer and host type. Architecture: Logs the system architecture. System manufacturer: Info regarding the host machine. Host type: Whether the host machine is virtual or physical. Virtual if system manufacturer is QEMU.

Change Log
  • Added properties under system_info for architecture, system manufacturer and host type.
Does this affect the toolchain?

NO

Test Methodology
  • Tested changes locally in Mariner VMs with and without SELinux.
  • Buddy build: https://dev.azure.com/mariner-org/mariner/_build/results?buildId=559902&view=results

Example output: Apr 29 20:22:29 mariner-vm systemd[1]: Started Azure Linux Sysinfo Service. Apr 29 20:22:30 mariner-vm python3[4592]: Running azurelinux sysinfo collection... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting asset id... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting os info... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting cloud-init info... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting boot info... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting disk and memory usage... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting package info... Apr 29 20:22:30 mariner-vm python3[4592]: Collecting system info... Apr 29 20:22:30 mariner-vm python3[4592]: {'$schema': 'v1', 'source': 'azurelinux-sysinfo-service', 'asset_id': '65b34220-679f-4b13-bd3e-d84263a9bd9c', 'os_info': {'kernel_version': '5.15.148.2-2.cm2', 'release_version': '2.0.20240301', 'release_version_id': '2.0'}, 'cloud_init_info': {'hostname': 'mariner-vm', 'longest_running_processes': [{'time': '32.38300s', 'process': '(modules-final/config-package_update_upgrade_install)'}, {'time': '00.59200s', 'process': '(init-network/config-users_groups)'}, {'time': '00.26100s', 'process': '(init-network/config-ssh)'}, {'time': '00.22200s', 'process': '(modules-final/config-scripts_user)'}, {'time': '00.08800s', 'process': '(init-local/search-NoCloud)'}]}, 'boot_info': {'boot_time': {'kernel_boot_time_secs': 1.362, 'initrd_boot_time_secs': 1.176, 'userspace_boot_time_secs': 5.07, 'total_boot_time_secs': 7.609}, 'longest_running_processes': [{'systemd-networkd-wait-online.service': 1.722}, {'cloud-init-local.service': 1.173}, {'initrd-switch-root.service': 0.602}]}, 'resource_utilization': {'disk_usage': {'disk_size_gib': '3.85', 'disk_usage_gib': '0.54'}, 'memory_usage': {'total_memory_gib': 3, 'available_memory_gib': 3}, 'cpu_usage': {'physical_cpu_count': 2, 'logical_cpu_count': 4, 'cpu_percent': 25.3}}, 'package_info': {'package_count': 232}, 'system_info': {'selinux_mode': 'Disabled', 'architecture': 'x86_64', 'system_manufacturer': 'Microsoft Corporation', 'host_type': 'physical'}} Apr 29 20:22:30 mariner-vm python3[4592]: Azure Linux sysinfo collection completed successfully. Apr 29 20:22:30 mariner-vm systemd[1]: azurelinux-sysinfo.service: Deactivated successfully.

amritakohli avatar Apr 29 '24 16:04 amritakohli