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

[libvirt] [PATCH] Fix virLXCPrepareHostDevices method



From: "Daniel P. Berrange" <berrange redhat com>

The virLXCPrepareHostDevices method was returning success even
when it reported an error, and failed to handle several host
device types
---
 src/lxc/lxc_hostdev.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_hostdev.c b/src/lxc/lxc_hostdev.c
index 21f3096..4fa0508 100644
--- a/src/lxc/lxc_hostdev.c
+++ b/src/lxc/lxc_hostdev.c
@@ -299,15 +299,29 @@ int virLXCPrepareHostDevices(virLXCDriverPtr driver,
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("Unsupported hostdev type %s"),
                                virDomainHostdevSubsysTypeToString(dev->source.subsys.type));
+                return -1;
+            }
+            break;
+
+        case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
+            switch (dev->source.subsys.type) {
+            case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE:
+            case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC:
                 break;
+            default:
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("Unsupported hostdev type %s"),
+                               virDomainHostdevSubsysTypeToString(dev->source.subsys.type));
+                return -1;
             }
             break;
 
+
         default:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Unsupported hostdev mode %s"),
                            virDomainHostdevModeTypeToString(dev->mode));
-            break;
+            return -1;
         }
     }
 
-- 
1.8.0.1


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