Hi Eric,

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.

I ran into a big issue and I’m hoping you or anyone on this list can help:

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 :-( :-( :-(

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

Workarounds I can think of:
- Augment the domain xml description so it also defines the storage pool on which the created domain should reside
- Change vmwareVmxPath so it uses a temporary directory  on the first disk’s datastore if the first disk is transient
- Somehow encode the .vmx storage location in a device type that isn’t used by vmware.

The first way seems the cleanest but is probably also the most work and touches more code.

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.

The third way is a bit of a middle ground but I wouldn’t know what device to use.

Help! :-(

Wout.

On Dec 17, 2013, at 23:06 , Wout Mertens <Wout.Mertens@gmail.com> wrote:

Hi Eric,

thank you very much for your assistance! I'll take a look at writing that test tomorrow.

Wout.


On Tue, Dec 17, 2013 at 10:24 PM, Eric Blake <eblake@redhat.com> wrote:
On 12/17/2013 01:45 PM, Eric Blake wrote:
> On 12/17/2013 01:42 PM, Eric Blake wrote:
>> On 12/17/2013 10:04 AM, Wout Mertens wrote:
>>> From: Wout Mertens <Wout.Mertens@gmail.com>
>>>
>>> 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':
>>
>
>>
>> But I don't mind fixing those on a first-time submission.
>
> Oh, I spoke too soon.  It also fails 'make check':
>
> ../build-aux/test-driver: line 95: 19280 Segmentation fault      (core
> dumped) "$@" > $log_file 2>&1
> FAIL: vmx2xmltest
>
> Not a good sign.  I can still try and fix that before pushing, but for
> now your patch is not upstream.

Found it.  Would you also be willing to do a followup patch to enhance
the testsuite to add a case of a vmx file that gets translated into the
<transient> libvirt xml?  Pushed now, with this added:

diff --git i/src/vmx/vmx.c w/src/vmx/vmx.c
index c04e397..8fb2a93 100644
--- i/src/vmx/vmx.c
+++ w/src/vmx/vmx.c
@@ -2181,7 +2181,9 @@ 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");
+            if (mode)
+                (*def)->transient = STRCASEEQ(mode,
+                                              "independent-nonpersistent");

             if ((*def)->src == NULL) {
                 goto cleanup;
@@ -2300,6 +2302,7 @@ virVMXParseDisk(virVMXContext *ctx,
virDomainXMLOptionPtr xmlopt, virConfPtr con
     VIR_FREE(deviceType);
     VIR_FREE(fileType);
     VIR_FREE(fileName);
+    VIR_FREE(mode);

     return result;

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