-
Notifications
You must be signed in to change notification settings - Fork 211
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
Open
shubhaOracle
wants to merge
12
commits into
oVirt:master
Choose a base branch
from
shubhaOracle:arm-vdsm-changes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+109
−0
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
36313ff
build: support el10 aka add Python 3.12+ compatibility
peter-boden e3616e2
test: migrate from nose to pytest testing framework
peter-boden 84d8cb1
lint: fix pylint and Python 3.12 compatibility issues
peter-boden 83b0e96
lint: upgrade flake8 and fix errors
peter-boden 93b5bda
tests: fix tests on centos 10
peter-boden 4b74ecf
ARM support VDSM changes
shubhaOracle 5df0727
Merge branch 'master' into arm-vdsm-changes
shubhaOracle 6ce4c5f
Address review comments
shubhaOracle 6ce258d
Merge branch 'arm-vdsm-changes' of https://github.com/shubhaOracle/vd…
shubhaOracle 4f5da39
Address review comments
shubhaOracle 44cbf09
Remove unneeded import
shubhaOracle 7aa3c84
Fix pylint error
shubhaOracle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
|
|
||
| import logging | ||
| import os.path | ||
| import subprocess | ||
|
|
||
| from vdsm import cpuinfo | ||
| from vdsm.common import cache | ||
|
|
||
|
|
||
|
|
||
| def get_sys_info(): | ||
|
|
||
| cmd = 'dmidecode -t system' | ||
| 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: | ||
| logging.exception('Error while getting system information') | ||
|
|
||
| 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'), | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # SPDX-FileCopyrightText: Red Hat, Inc. | ||
| # SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| import logging | ||
| import subprocess | ||
|
|
||
| VIRT_HOST_VALIDATE_CMD = "virt-host-validate" | ||
|
|
||
| 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 | ||
| QEMU: Checking for secure guest support : WARN | ||
|
|
||
| """ | ||
|
|
||
| out = exec_validate_cmd(VIRT_HOST_VALIDATE_CMD) | ||
| valid_host = False | ||
|
|
||
| if ('fail' not in out.lower()): | ||
| valid_host = True | ||
|
|
||
| return valid_host |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.