When running cxl-tool.py --run for the first time on an Ubuntu 24.04 host, I encountered the following error:
$ ./cxl-tool.py --run
env[qemu_extra_opt] undefined, return empty
[...snip...]
This error originates from cxl-tool.py
if args["extra"]:
os.environ["qemu_extra_opt"] = args["extra"]
It is expected that os.environ raises an exception if the environment variable does not exist. It's a harmless message, but the tool could handle this gracefully by setting the environment variable before it's read using:
# Set a default value if qemu_extra_opt is not set or doesn't exist
qemu_extra_opt = os.getenv("qemu_extra_opt", "")
---8<---
if args["extra"]:
os.environ["qemu_extra_opt"] = args["extra"]
This will also help utils/tools.py, which also expects the variable, but handles non-existent environment variables gracefully
def run_qemu(qemu, topo, kernel, accel_mode=accel_mode, run_direct=False, qemu_img="", port_offset=0, allow_multivm=False):
if not allow_multivm and vm_is_running():
print("VM is running, exit")
return;
extra_opts = system_env("qemu_extra_opt")
When running
cxl-tool.py --runfor the first time on an Ubuntu 24.04 host, I encountered the following error:$ ./cxl-tool.py --run env[qemu_extra_opt] undefined, return empty [...snip...]This error originates from cxl-tool.py
It is expected that
os.environraises an exception if the environment variable does not exist. It's a harmless message, but the tool could handle this gracefully by setting the environment variable before it's read using:This will also help utils/tools.py, which also expects the variable, but handles non-existent environment variables gracefully