-
Notifications
You must be signed in to change notification settings - Fork 213
ARM support VDSM changes #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
36313ff
e3616e2
84d8cb1
83b0e96
93b5bda
4b74ecf
5df0727
6ce4c5f
6ce258d
4f5da39
44cbf09
7aa3c84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # SPDX-FileCopyrightText: Red Hat, Inc. | ||
| # SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| from __future__ import absolute_import | ||
|
|
||
| import os.path | ||
| import subprocess | ||
|
|
||
| from vdsm import cpuinfo | ||
| from vdsm.common import cache | ||
|
|
||
|
|
||
|
|
||
| def get_sys_info(): | ||
|
|
||
| cmd = 'dmidecode -t system' | ||
|
shubhaOracle marked this conversation as resolved.
|
||
| sys_info = {} | ||
| try: | ||
| output = subprocess.check_output(cmd, shell=True, universal_newlines=True) | ||
| for item in output.split("\n"): | ||
| if 'Manufacturer' in item or \ | ||
| 'Product Name' in item or \ | ||
| 'Version' in item or \ | ||
| 'Serial Number' in item or \ | ||
| 'UUID' in item or \ | ||
| 'Family' in item : | ||
| item = item.strip() | ||
| key = item.split(":")[0].strip() | ||
| value = item.split(":")[1].strip() | ||
| sys_info[key]=value | ||
|
|
||
| except: | ||
| print("ERROR") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs more info
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated |
||
|
|
||
| return sys_info | ||
|
|
||
|
|
||
|
|
||
|
|
||
| @cache.memoized | ||
| def getHardwareInfoStructure(): | ||
| sys_info_dict=get_sys_info() | ||
|
|
||
|
|
||
| return { | ||
| 'systemSerialNumber': sys_info_dict.get('Serial Number', 'unavailable'), | ||
| 'systemFamily': sys_info_dict.get('Family', 'unavailable'), | ||
| 'systemVersion': sys_info_dict.get('Version', 'unavailable'), | ||
| 'systemUUID': sys_info_dict.get('UUID', 'unavailable'), | ||
| 'systemProductName': sys_info_dict.get('Product Name', 'unavailable'), | ||
| 'systemManufacturer': sys_info_dict.get('Manufacturer', 'unavailable'), | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # SPDX-FileCopyrightText: Red Hat, Inc. | ||
| # SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| import logging | ||
| import subprocess | ||
|
|
||
| VIRT_HOST_VALIDATE_CMD = "virt-host-validate" | ||
| CMD="date" | ||
|
shubhaOracle marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
|
|
||
| def exec_validate_cmd(cmd): | ||
| """Execute a command and convert returned values to native string. | ||
|
|
||
| Note that this function should not be used if output data could be | ||
| undecodable bytes. | ||
| """ | ||
| try: | ||
| out = subprocess.check_output(cmd).decode("utf-8") | ||
| except Exception as err: | ||
| logging.exception(f"Unexpected {err}, {type(err)}") | ||
|
|
||
| logging.info(f"output {out}") | ||
| return out | ||
|
|
||
|
|
||
|
|
||
|
|
||
| def is_valid_virt_host(): | ||
| """ Validate host is valid for virtualization | ||
| Below is the command and output | ||
| If host is not valid, the failure will be logged | ||
| # virt-host-validate | ||
| QEMU: Checking if device /dev/kvm exists : PASS | ||
| QEMU: Checking if device /dev/kvm is accessible : PASS | ||
| QEMU: Checking if device /dev/vhost-net exists : PASS | ||
| QEMU: Checking if device /dev/net/tun exists : PASS | ||
| QEMU: Checking for cgroup 'cpu' controller support : PASS | ||
| QEMU: Checking for cgroup 'cpuacct' controller support : PASS | ||
| QEMU: Checking for cgroup 'cpuset' controller support : PASS | ||
| QEMU: Checking for cgroup 'memory' controller support : PASS | ||
| QEMU: Checking for cgroup 'devices' controller support : PASS | ||
| QEMU: Checking for cgroup 'blkio' controller support : PASS | ||
| QEMU: Checking for device assignment IOMMU support : WARN (Unknown if this platform has IOMMU support) | ||
| QEMU: Checking for secure guest support : WARN (Unknown if this platform has Secure Guest support) | ||
|
|
||
| """ | ||
|
|
||
| out = exec_validate_cmd(VIRT_HOST_VALIDATE_CMD) | ||
|
|
||
| if (not 'fail' in out.lower()) : | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just check exit code?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to verify that there are no failures are reported in the output
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is exactly what the exit code does? |
||
| valid_host = True | ||
|
|
||
|
|
||
| return valid_host | ||
Uh oh!
There was an error while loading. Please reload this page.