diff --git a/ramalama/cli.py b/ramalama/cli.py index 47127204..fc6373b8 100644 --- a/ramalama/cli.py +++ b/ramalama/cli.py @@ -30,14 +30,41 @@ class HelpException(Exception): pass +def ai_support_in_vm(): + conman = container_manager() + if conman == "": + return False + + if conman == "podman": + conman_args = [conman, "machine", "list", "--format", "{{ .VMType }}"] + try: + output = run_cmd(conman_args).stdout.decode("utf-8").strip() + if output == "krunkit": + return True + except subprocess.CalledProcessError: + pass + perror( + """\ +Warning: podman needs to be configured to use krunkit for AI Workloads, +running without containers +""" + ) + return False + # Assume this is running with Docker and return true + return True + + def use_container(): transport = os.getenv("RAMALAMA_IN_CONTAINER") if transport: return transport.lower() == "true" - if in_container() or sys.platform == "darwin": + if in_container(): return False + if sys.platform == "darwin": + return ai_support_in_vm() + return True