From: Eric Blake Date: Tue, 18 Mar 2014 21:41:28 +0000 (-0600) Subject: conf: use disk source accessors in vmware/ X-Git-Tag: v1.2.3-rc1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ad6024bdf038010ab2722fdf805d54412f93af1;p=thirdparty%2Flibvirt.git conf: use disk source accessors in vmware/ Part of a series of cleanups to use new accessor methods. * src/vmware/vmware_conf.c (vmwareVmxPath): Use accessors. Signed-off-by: Eric Blake --- diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index c339186ba8..2de24a7821 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -388,6 +388,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) char *fileName = NULL; int ret = -1; size_t i; + const char *src; /* * Build VMX URL. Use the source of the first file-based harddisk @@ -405,7 +406,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) for (i = 0; i < vmdef->ndisks; ++i) { if (vmdef->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK && - vmdef->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE) { + virDomainDiskGetType(vmdef->disks[i]) == VIR_DOMAIN_DISK_TYPE_FILE) { disk = vmdef->disks[i]; break; } @@ -418,21 +419,22 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) goto cleanup; } - if (disk->src == NULL) { + src = virDomainDiskGetSource(disk); + if (!src) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("First file-based harddisk has no source, cannot " "deduce datastore and path for VMX file")); goto cleanup; } - if (vmwareParsePath(disk->src, &directoryName, &fileName) < 0) { + if (vmwareParsePath(src, &directoryName, &fileName) < 0) { goto cleanup; } if (!virFileHasSuffix(fileName, ".vmdk")) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expecting source '%s' of first file-based harddisk " - "to be a VMDK image"), disk->src); + "to be a VMDK image"), src); goto cleanup; }