Xen-HVM: Improve the invalid disk/nic type error
authorGuido Trotter <ultrotter@google.com>
Mon, 9 Feb 2009 15:16:07 +0000 (15:16 +0000)
committerGuido Trotter <ultrotter@google.com>
Mon, 9 Feb 2009 15:16:07 +0000 (15:16 +0000)
Copy the message from the KVM one, adding a missing 'the' and a list of
possible values, to help the user in his decision.

Reviewed-by: iustinp

lib/hypervisor/hv_xen.py

index 5a8e4a2..75773ab 100644 (file)
@@ -515,12 +515,16 @@ class XenHvmHypervisor(XenHypervisor):
     # device type checks
     nic_type = hvparams[constants.HV_NIC_TYPE]
     if nic_type not in constants.HT_HVM_VALID_NIC_TYPES:
-      raise errors.HypervisorError("Invalid NIC type %s specified for Xen HVM"
-                                   " hypervisor" % nic_type)
+      raise errors.HypervisorError("Invalid NIC type %s specified for the Xen"
+                                   " HVM hypervisor. Please choose one of: %s"
+                                   % (nic_type,
+                                      constants.HT_HVM_VALID_NIC_TYPES))
     disk_type = hvparams[constants.HV_DISK_TYPE]
     if disk_type not in constants.HT_HVM_VALID_DISK_TYPES:
-      raise errors.HypervisorError("Invalid disk type %s specified for Xen HVM"
-                                   " hypervisor" % disk_type)
+      raise errors.HypervisorError("Invalid disk type %s specified for the Xen"
+                                   " HVM hypervisor. Please choose one of: %s"
+                                   % (disk_type,
+                                      constants.HT_HVM_VALID_DISK_TYPES))
     # vnc_bind_address verification
     vnc_bind_address = hvparams[constants.HV_VNC_BIND_ADDRESS]
     if vnc_bind_address is not None: