Re: [PATCH] Support transient attribute on vmware disks

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

 



On 12/17/2013 10:04 AM, Wout Mertens wrote:
> From: Wout Mertens <Wout.Mertens@xxxxxxxxx>
> 
> vmx/vmx.c ignores the transient attribute on the disk xml format. This patch
> adds a 1-1 relationship between it and [disk].mode = "independent-nonpersistent".
> 
> The other modes are ignored as before. It works in my testing.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1044023
> 
> ---
>  src/vmx/vmx.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)

Congrats on your first libvirt patch.  It failed 'make syntax-check':

TAB_in_indentation
src/vmx/vmx.c:3511:	
src/vmx/vmx.c:3512:	if (def->transient) {
src/vmx/vmx.c:3513:		virBufferAsprintf(buffer, "%s%d:%d.mode =
\"independent-nonpersistent\"\n",
src/vmx/vmx.c:3514:						  busType, controllerOrBus, unit);
src/vmx/vmx.c:3515:	}
maint.mk: indent with space, not TAB, in C, sh, html, py, syms and RNG
schemas
src/vmx/vmx.c:3511:	
maint.mk: found trailing blank(s)
make: *** [sc_trailing_blank] Error 1

But I don't mind fixing those on a first-time submission.

> +++ b/src/vmx/vmx.c
> @@ -1954,6 +1954,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
>       *         busType = VIR_DOMAIN_DISK_BUS_FDC
>       * controllerOrBus = [0]
>       *            unit = [0..1]
> +     *
>       */
>  
>      int result = -1;

This hunk looks spurious.

> @@ -2172,6 +2182,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
>              (*def)->src = ctx->parseFileName(fileName, ctx->opaque);
>              (*def)->cachemode = writeThrough ? VIR_DOMAIN_DISK_CACHE_WRITETHRU
>                                               : VIR_DOMAIN_DISK_CACHE_DEFAULT;
> +            (*def)->transient = STRCASEEQ(mode, "independent-nonpersistent") ? true: false;

'bool_expr ? true : false' is a waste of typing.  It's just as easy to
write 'bool_expr'.

Pushed with the following squashed in:

diff --git i/src/vmx/vmx.c w/src/vmx/vmx.c
index 4282390..c04e397 100644
--- i/src/vmx/vmx.c
+++ w/src/vmx/vmx.c
@@ -1954,7 +1954,6 @@ virVMXParseDisk(virVMXContext *ctx,
virDomainXMLOptionPtr xmlopt, virConfPtr con
      *         busType = VIR_DOMAIN_DISK_BUS_FDC
      * controllerOrBus = [0]
      *            unit = [0..1]
-     *
      */

     int result = -1;
@@ -2182,7 +2181,7 @@ virVMXParseDisk(virVMXContext *ctx,
virDomainXMLOptionPtr xmlopt, virConfPtr con
             (*def)->src = ctx->parseFileName(fileName, ctx->opaque);
             (*def)->cachemode = writeThrough ?
VIR_DOMAIN_DISK_CACHE_WRITETHRU
                                              :
VIR_DOMAIN_DISK_CACHE_DEFAULT;
-            (*def)->transient = STRCASEEQ(mode,
"independent-nonpersistent") ? true: false;
+            (*def)->transient = STRCASEEQ(mode,
"independent-nonpersistent");

             if ((*def)->src == NULL) {
                 goto cleanup;
@@ -3508,11 +3507,11 @@ virVMXFormatDisk(virVMXContext *ctx,
virDomainDiskDefPtr def,
             return -1;
         }
     }
-	
-	if (def->transient) {
-		virBufferAsprintf(buffer, "%s%d:%d.mode =
\"independent-nonpersistent\"\n",
-						  busType, controllerOrBus, unit);
-	}
+
+    if (def->transient)
+        virBufferAsprintf(buffer,
+                          "%s%d:%d.mode = \"independent-nonpersistent\"\n",
+                          busType, controllerOrBus, unit);
     return 0;
 }



-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]