On Fri, Sep 11, 2015 at 03:55:03PM +0200, Matthias Bolte wrote:
2015-09-07 22:04 GMT+02:00 Richard W.M. Jones
<rjones(a)redhat.com>:
> On Mon, Sep 07, 2015 at 02:29:22PM +0200, Matthias Bolte wrote:
>> I think the datacenter path could be exposed
>> as part of the domain XML as
>> <vmware:datacenterpath>/path/to/dc</vmware:datacenterpath> similar
to
>> the way <qemu:commandline> works. But it would be ignored on parsing.
>>
>> Would that work for you? If yes, I can propose a patch that does this.
>
> Absolutely this would be brilliant.
Okay, here's patch that does this. It's only tested using the test
suite, as I don't have an ESX setup at hand at the moment. Do you have
the possibility to test this properly?
I tried it against two vCenter instances, and I see the additional XML
like this:
<domain type='vmware'
xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
...
<vmware:datacenterpath>Folder/Datacenter</vmware:datacenterpath>
</domain>
That seems fine and it's something we can use in libguestfs.
Looks good to me, so ACK.
Minor comment on the patch below.
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 21cf333..f3cbbf5 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -145,6 +145,9 @@ vmwareLoadDomains(struct vmware_driver *driver)
virCommandPtr cmd;
ctx.parseFileName = vmwareCopyVMXFileName;
+ ctx.formatFileName = NULL;
+ ctx.autodetectSCSIControllerModel = NULL;
+ ctx.datacenterPath = NULL;
cmd = virCommandNewArgList(driver->vmrun, "-T",
vmwareDriverTypeToString(driver->type),
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index ec74fe3..e228aaa 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -381,7 +381,10 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml,
unsigned int fla
if (flags & VIR_DOMAIN_DEFINE_VALIDATE)
parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE;
+ ctx.parseFileName = NULL;
ctx.formatFileName = vmwareCopyVMXFileName;
+ ctx.autodetectSCSIControllerModel = NULL;
+ ctx.datacenterPath = NULL;
vmwareDriverLock(driver);
if ((vmdef = virDomainDefParseString(xml, driver->caps, driver->xmlopt,
@@ -671,7 +674,10 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
if (flags & VIR_DOMAIN_START_VALIDATE)
parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE;
+ ctx.parseFileName = NULL;
ctx.formatFileName = vmwareCopyVMXFileName;
+ ctx.autodetectSCSIControllerModel = NULL;
+ ctx.datacenterPath = NULL;
vmwareDriverLock(driver);
@@ -1022,6 +1028,9 @@ vmwareConnectDomainXMLFromNative(virConnectPtr conn, const char
*nativeFormat,
}
ctx.parseFileName = vmwareCopyVMXFileName;
+ ctx.formatFileName = NULL;
+ ctx.autodetectSCSIControllerModel = NULL;
+ ctx.datacenterPath = NULL;
This appears to be an unrelated fix? Perhaps it should go in a
separate commit.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/