diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py
index 3402bc5e51a804d386146cd111142452f0a07cda..e0c62d7c2ae9bdc2982995f78ddd598bdf5b7ede 100755
--- a/qa/ganeti-qa.py
+++ b/qa/ganeti-qa.py
@@ -188,7 +188,7 @@ def RunOsTests():
     qa_os.TestOsPartiallyValid,
     qa_os.TestOsModifyValid,
     qa_os.TestOsModifyInvalid,
-    qa_os.TestOsStates,
+    qa_os.TestOsStatesNonExisting,
     ]:
     RunTestIf("os", fn)
 
diff --git a/qa/qa_os.py b/qa/qa_os.py
index 740c8c53cd9ff39c8a8e8645035d492ce23d5e3e..cbc3142cdc59c3f6462f8d8a6da58b4571396f8b 100644
--- a/qa/qa_os.py
+++ b/qa/qa_os.py
@@ -68,13 +68,13 @@ def _TestOsModify(hvp_dict, fail=False):
   AssertCommand(cmd, fail=fail)
 
 
-def _TestOsStates():
+def _TestOsStates(os_name):
   """gnt-os modify, more stuff"""
   cmd = ["gnt-os", "modify"]
 
   for param in ["hidden", "blacklisted"]:
     for val in ["yes", "no"]:
-      new_cmd = cmd + ["--%s" % param, val, _TEMP_OS_NAME]
+      new_cmd = cmd + ["--%s" % param, val, os_name]
       AssertCommand(new_cmd)
       # check that double-running the command is OK
       AssertCommand(new_cmd)
@@ -179,7 +179,7 @@ def TestOsModifyInvalid():
   return _TestOsModify(hv_dict, fail=True)
 
 
-def TestOsStates():
-  """Testing OS states"""
-
-  return _TestOsStates()
+def TestOsStatesNonExisting():
+  """Testing OS states with non-existing OS"""
+  AssertCommand(["test", "-e", _TEMP_OS_PATH], fail=True)
+  return _TestOsStates(_TEMP_OS_NAME)