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

Re: [libvirt] [PATCH v2] Do not generate security_model when fs driver is anything but 'path'



On 01/10/2012 04:17 PM, Daniel P. Berrange wrote:
On Tue, Jan 10, 2012 at 03:35:26PM +0530, Deepak C Shetty wrote:
---
v2:
- removed xml accessmode changes as suggested by dan.
- every fs driver having a default accessmode always, retained.

  src/qemu/qemu_command.c |   23 +++++++++++++++++------
  1 files changed, 17 insertions(+), 6 deletions(-)
ACK

Daniel
My sincere apologies, forgot to add 'goto error' after
qemuReportError in the patch sent.

Putting the correct patch below...pls consider this.

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f2e9cfa..73f673f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2100,13 +2100,25 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs,
     }
     virBufferAdd(&opt, driver, -1);

-    if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
-        virBufferAddLit(&opt, ",security_model=mapped");
-    } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
-        virBufferAddLit(&opt, ",security_model=passthrough");
-    } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
-        virBufferAddLit(&opt, ",security_model=none");
+    if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_PATH ||
+        fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
+        if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
+            virBufferAddLit(&opt, ",security_model=mapped");
+        } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
+            virBufferAddLit(&opt, ",security_model=passthrough");
+        } else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
+            virBufferAddLit(&opt, ",security_model=none");
+        }
+    } else {
+        /* For other fs drivers, default(passthru) should always */
+        /* be supported */
+        if (fs->accessmode != VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
+            qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        _("only supports passthrough accessmode"));
+            goto error;
+        }
     }
+
virBufferAsprintf(&opt, ",id=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias);
     virBufferAsprintf(&opt, ",path=%s", fs->src);


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