[PATCH] Fix virLXCPrepareHostDevices method

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]