anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame SOURCES/77d84b2-ndctl-create-namespace-include-dax-info-in-operation-result.patch

ab4840
ndctl, create-namespace: include dax info in operation result
ab4840
ab4840
BZ: 
ab4840
ab4840
commit 77d84b249ef51b6dbccd988e42ce2ab2962a9b36
ab4840
Author: Dan Williams <dan.j.williams@intel.com>
ab4840
Date:   Thu Mar 2 14:10:11 2017 -0800
ab4840
ab4840
    ndctl, create-namespace: include dax info in operation result
ab4840
    
ab4840
    When modifying or creating a namespace in "dax" mode, include the
ab4840
    device-dax information so that resulting character device is included in
ab4840
    the output.
ab4840
    
ab4840
    Before:
ab4840
    # ndctl create-namespace --reconfig=namespace1.0 --mode=dax --force
ab4840
    {
ab4840
      "dev":"namespace1.0",
ab4840
      "mode":"dax",
ab4840
      "size":4225761280,
ab4840
      "uuid":"55082055-70f8-40eb-b131-d59f6f537df5"
ab4840
    }
ab4840
    
ab4840
    After:
ab4840
    # ndctl create-namespace --reconfig=namespace1.0 --mode=dax --force
ab4840
    {
ab4840
      "dev":"namespace1.0",
ab4840
      "mode":"dax",
ab4840
      "size":4225761280,
ab4840
      "uuid":"1ccc310a-04af-4a57-88a4-6011c2825b95",
ab4840
      "daxregion":{
ab4840
        "id":1,
ab4840
        "size":4225761280,
ab4840
        "align":2097152,
ab4840
        "devices":[
ab4840
          {
ab4840
            "chardev":"dax1.0",
ab4840
            "size":4225761280
ab4840
          }
ab4840
        ]
ab4840
      }
ab4840
    }
ab4840
    
ab4840
    Reported-by: Dave Jiang <dave.jiang@intel.com>
ab4840
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
ab4840
ab4840
diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c
ab4840
index 46d651e..05575c5 100644
ab4840
--- a/ndctl/builtin-xaction-namespace.c
ab4840
+++ b/ndctl/builtin-xaction-namespace.c
ab4840
@@ -361,7 +361,7 @@ static int setup_namespace(struct ndctl_region *region,
ab4840
 		error("%s: failed to enable\n",
ab4840
 				ndctl_namespace_get_devname(ndns));
ab4840
 	} else {
ab4840
-		struct json_object *jndns = util_namespace_to_json(ndns, 0, 0);
ab4840
+		struct json_object *jndns = util_namespace_to_json(ndns, 0, 1);
ab4840
 
ab4840
 		if (jndns)
ab4840
 			printf("%s\n", json_object_to_json_string_ext(jndns,