[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] xen: Fix bogus error when attaching a device

The xm internal xen driver only supports disk and network devices to be
added to a guest. On an attempt to attach any other device the xm driver
used VIR_ERR_XML_ERROR which resulted in a completely bogus error

error: Failed to attach device from pci.xml
error: XML description for unknown device is not well formed or invalid
  src/xen/xm_internal.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index fcc9378..00f0df8 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -2980,8 +2980,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,

-        xenXMError(VIR_ERR_XML_ERROR,
-                   "%s", _("unknown device"));
+        xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
+                   _("Xm driver only supports adding disk or network devices"));
          goto cleanup;

It looks like many other similar errors in other drivers use VIR_ERR_CONFIG_UNSUPPORTED. Would that maybe be a better choice than VIR_ERR_OPERATION_INVALID, which seems to be used when something normally valid is attempted while in an inavalid state (eg, trying to stop a domain when it's already stopped, or perform some operation that can be done only when a domain is stopped, but it's currently running.)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]