<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Eric,<div><br></div><div>haven’t had time for writing the test yet, since I’m trying to get an app out the door that uses libvirt for running “instant clones” of a VM.</div><div><br></div><div>I ran into a big issue and I’m hoping you or anyone on this list can help:</div><div><br></div><div>When I create a new domain with a transient disk like this, the .vmx file and all supporting files will be stored in the same directory as the transient disk. One of the supporting files is the “nvram” file and you can only have one, which means you can only have one VM using the same disk, transient or otherwise :-( :-( :-(</div><div><div><br class="webkit-block-placeholder"></div><div>The code that selects the location of the new .vmx file is vmwareVmxPath in src/vmware/vmware_conf.c and it picks the directory of the first disk</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">
Workarounds I can think of:</div><div apple-content-edited="true">- Augment the domain xml description so it also defines the storage pool on which the created domain should reside</div><div apple-content-edited="true">- Change vmwareVmxPath so it uses a temporary directory  on the first disk’s datastore if the first disk is transient</div><div apple-content-edited="true">- Somehow encode the .vmx storage location in a device type that isn’t used by vmware.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">The first way seems the cleanest but is probably also the most work and touches more code.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">The second way seems hackish but makes sense when you think about it - the disk is transient so the vm definition should be, too. Sadly you can’t specify a different datastore then.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">The third way is a bit of a middle ground but I wouldn’t know what device to use.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">Help! :-(</div><div apple-content-edited="true"><br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande';  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">Wout.</span>

</div>
<br><div><div>On Dec 17, 2013, at 23:06 , Wout Mertens <<a href="mailto:Wout.Mertens@gmail.com">Wout.Mertens@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Eric,<div><br></div><div>thank you very much for your assistance! I'll take a look at writing that test tomorrow.</div><div><br></div><div>Wout.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Dec 17, 2013 at 10:24 PM, Eric Blake <span dir="ltr"><<a href="mailto:eblake@redhat.com" target="_blank">eblake@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 12/17/2013 01:45 PM, Eric Blake wrote:<br>
> On 12/17/2013 01:42 PM, Eric Blake wrote:<br>
>> On 12/17/2013 10:04 AM, Wout Mertens wrote:<br>
>>> From: Wout Mertens <<a href="mailto:Wout.Mertens@gmail.com">Wout.Mertens@gmail.com</a>><br>
>>><br>
>>> vmx/vmx.c ignores the transient attribute on the disk xml format. This patch<br>
>>> adds a 1-1 relationship between it and [disk].mode = "independent-nonpersistent".<br>
>>><br>
>>> The other modes are ignored as before. It works in my testing.<br>
>>><br>
>>> <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1044023" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1044023</a><br>
>>><br>
>>> ---<br>
>>>  src/vmx/vmx.c | 17 ++++++++++++++++-<br>
>>>  1 file changed, 16 insertions(+), 1 deletion(-)<br>
>><br>
>> Congrats on your first libvirt patch.  It failed 'make syntax-check':<br>
>><br>
><br>
>><br>
>> But I don't mind fixing those on a first-time submission.<br>
><br>
> Oh, I spoke too soon.  It also fails 'make check':<br>
><br>
> ../build-aux/test-driver: line 95: 19280 Segmentation fault      (core<br>
> dumped) "$@" > $log_file 2>&1<br>
> FAIL: vmx2xmltest<br>
><br>
> Not a good sign.  I can still try and fix that before pushing, but for<br>
> now your patch is not upstream.<br>
<br>
</div></div>Found it.  Would you also be willing to do a followup patch to enhance<br>
the testsuite to add a case of a vmx file that gets translated into the<br>
<transient> libvirt xml?  Pushed now, with this added:<br>
<br>
diff --git i/src/vmx/vmx.c w/src/vmx/vmx.c<br>
index c04e397..8fb2a93 100644<br>
--- i/src/vmx/vmx.c<br>
+++ w/src/vmx/vmx.c<br>
@@ -2181,7 +2181,9 @@ virVMXParseDisk(virVMXContext *ctx,<br>
<div class="im">virDomainXMLOptionPtr xmlopt, virConfPtr con<br>
             (*def)->src = ctx->parseFileName(fileName, ctx->opaque);<br>
             (*def)->cachemode = writeThrough ?<br>
VIR_DOMAIN_DISK_CACHE_WRITETHRU<br>
                                              :<br>
VIR_DOMAIN_DISK_CACHE_DEFAULT;<br>
-            (*def)->transient = STRCASEEQ(mode,<br>
</div>"independent-nonpersistent");<br>
+            if (mode)<br>
<div class="im">+                (*def)->transient = STRCASEEQ(mode,<br>
</div>+                                              "independent-nonpersistent");<br>
<div class="im"><br>
             if ((*def)->src == NULL) {<br>
                 goto cleanup;<br>
</div>@@ -2300,6 +2302,7 @@ virVMXParseDisk(virVMXContext *ctx,<br>
virDomainXMLOptionPtr xmlopt, virConfPtr con<br>
     VIR_FREE(deviceType);<br>
     VIR_FREE(fileType);<br>
     VIR_FREE(fileName);<br>
+    VIR_FREE(mode);<br>
<br>
     return result;<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Eric Blake   eblake redhat com    <a href="tel:%2B1-919-301-3266" value="+19193013266">+1-919-301-3266</a><br>
Libvirt virtualization library <a href="http://libvirt.org/" target="_blank">http://libvirt.org</a><br>
<br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></body></html>