mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 11:01:19 +00:00
conf: use disk source accessors in vmx/
Part of a series of cleanups to use new accessor methods. * src/vmx/vmx.c (virVMXHandleLegacySCSIDiskDriverName) (virVMXParseDisk, virVMXFormatDisk, virVMXFormatFloppy): Use accessors. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
4ad6024bdf
commit
f627468787
128
src/vmx/vmx.c
128
src/vmx/vmx.c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* vmx.c: VMware VMX parsing/formatting functions
|
* vmx.c: VMware VMX parsing/formatting functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2013 Red Hat, Inc.
|
* Copyright (C) 2010-2014 Red Hat, Inc.
|
||||||
* Copyright (C) 2009-2010 Matthias Bolte <matthias.bolte@googlemail.com>
|
* Copyright (C) 2009-2010 Matthias Bolte <matthias.bolte@googlemail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -1060,22 +1060,27 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
|
|||||||
int model;
|
int model;
|
||||||
size_t i;
|
size_t i;
|
||||||
virDomainControllerDefPtr controller = NULL;
|
virDomainControllerDefPtr controller = NULL;
|
||||||
|
const char *driver = virDomainDiskGetDriver(disk);
|
||||||
|
char *copy;
|
||||||
|
|
||||||
if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI || disk->driverName == NULL) {
|
if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI || !driver) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = disk->driverName;
|
if (VIR_STRDUP(copy, driver) < 0)
|
||||||
|
return -1;
|
||||||
|
tmp = copy;
|
||||||
|
|
||||||
for (; *tmp != '\0'; ++tmp) {
|
for (; *tmp != '\0'; ++tmp) {
|
||||||
*tmp = c_tolower(*tmp);
|
*tmp = c_tolower(*tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
model = virDomainControllerModelSCSITypeFromString(disk->driverName);
|
model = virDomainControllerModelSCSITypeFromString(copy);
|
||||||
|
VIR_FREE(copy);
|
||||||
|
|
||||||
if (model < 0) {
|
if (model < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown driver name '%s'"), disk->driverName);
|
_("Unknown driver name '%s'"), driver);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,7 +1103,7 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
|
|||||||
} else if (controller->model != model) {
|
} else if (controller->model != model) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Inconsistent SCSI controller model ('%s' is not '%s') "
|
_("Inconsistent SCSI controller model ('%s' is not '%s') "
|
||||||
"for SCSI controller index %d"), disk->driverName,
|
"for SCSI controller index %d"), driver,
|
||||||
virDomainControllerModelSCSITypeToString(controller->model),
|
virDomainControllerModelSCSITypeToString(controller->model),
|
||||||
controller->idx);
|
controller->idx);
|
||||||
return -1;
|
return -1;
|
||||||
@ -2159,6 +2164,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
/* Setup virDomainDiskDef */
|
/* Setup virDomainDiskDef */
|
||||||
if (device == VIR_DOMAIN_DISK_DEVICE_DISK) {
|
if (device == VIR_DOMAIN_DISK_DEVICE_DISK) {
|
||||||
if (virFileHasSuffix(fileName, ".vmdk")) {
|
if (virFileHasSuffix(fileName, ".vmdk")) {
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
if (deviceType != NULL) {
|
if (deviceType != NULL) {
|
||||||
if (busType == VIR_DOMAIN_DISK_BUS_SCSI &&
|
if (busType == VIR_DOMAIN_DISK_BUS_SCSI &&
|
||||||
STRCASENEQ(deviceType, "scsi-hardDisk") &&
|
STRCASENEQ(deviceType, "scsi-hardDisk") &&
|
||||||
@ -2179,17 +2186,19 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE);
|
||||||
(*def)->src = ctx->parseFileName(fileName, ctx->opaque);
|
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
||||||
|
goto cleanup;
|
||||||
|
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
VIR_FREE(tmp);
|
||||||
(*def)->cachemode = writeThrough ? VIR_DOMAIN_DISK_CACHE_WRITETHRU
|
(*def)->cachemode = writeThrough ? VIR_DOMAIN_DISK_CACHE_WRITETHRU
|
||||||
: VIR_DOMAIN_DISK_CACHE_DEFAULT;
|
: VIR_DOMAIN_DISK_CACHE_DEFAULT;
|
||||||
if (mode)
|
if (mode)
|
||||||
(*def)->transient = STRCASEEQ(mode,
|
(*def)->transient = STRCASEEQ(mode,
|
||||||
"independent-nonpersistent");
|
"independent-nonpersistent");
|
||||||
|
|
||||||
if ((*def)->src == NULL) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
} else if (virFileHasSuffix(fileName, ".iso") ||
|
} else if (virFileHasSuffix(fileName, ".iso") ||
|
||||||
STRCASEEQ(deviceType, "atapi-cdrom") ||
|
STRCASEEQ(deviceType, "atapi-cdrom") ||
|
||||||
STRCASEEQ(deviceType, "cdrom-raw")) {
|
STRCASEEQ(deviceType, "cdrom-raw")) {
|
||||||
@ -2210,6 +2219,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
}
|
}
|
||||||
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
||||||
if (virFileHasSuffix(fileName, ".iso")) {
|
if (virFileHasSuffix(fileName, ".iso")) {
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
if (deviceType != NULL) {
|
if (deviceType != NULL) {
|
||||||
if (STRCASENEQ(deviceType, "cdrom-image")) {
|
if (STRCASENEQ(deviceType, "cdrom-image")) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -2219,12 +2230,14 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE);
|
||||||
(*def)->src = ctx->parseFileName(fileName, ctx->opaque);
|
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
||||||
|
goto cleanup;
|
||||||
if ((*def)->src == NULL) {
|
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
||||||
|
VIR_FREE(tmp);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
VIR_FREE(tmp);
|
||||||
} else if (virFileHasSuffix(fileName, ".vmdk")) {
|
} else if (virFileHasSuffix(fileName, ".vmdk")) {
|
||||||
/*
|
/*
|
||||||
* This function was called in order to parse a CDROM device, but
|
* This function was called in order to parse a CDROM device, but
|
||||||
@ -2234,26 +2247,24 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
*/
|
*/
|
||||||
goto ignore;
|
goto ignore;
|
||||||
} else if (STRCASEEQ(deviceType, "atapi-cdrom")) {
|
} else if (STRCASEEQ(deviceType, "atapi-cdrom")) {
|
||||||
(*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK);
|
||||||
|
|
||||||
if (STRCASEEQ(fileName, "auto detect")) {
|
if (STRCASEEQ(fileName, "auto detect")) {
|
||||||
(*def)->src = NULL;
|
ignore_value(virDomainDiskSetSource(*def, NULL));
|
||||||
(*def)->startupPolicy = VIR_DOMAIN_STARTUP_POLICY_OPTIONAL;
|
(*def)->startupPolicy = VIR_DOMAIN_STARTUP_POLICY_OPTIONAL;
|
||||||
} else {
|
} else if (virDomainDiskSetSource(*def, fileName) < 0) {
|
||||||
(*def)->src = fileName;
|
goto cleanup;
|
||||||
fileName = NULL;
|
|
||||||
}
|
}
|
||||||
} else if (STRCASEEQ(deviceType, "cdrom-raw")) {
|
} else if (STRCASEEQ(deviceType, "cdrom-raw")) {
|
||||||
/* Raw access CD-ROMs actually are device='lun' */
|
/* Raw access CD-ROMs actually are device='lun' */
|
||||||
(*def)->device = VIR_DOMAIN_DISK_DEVICE_LUN;
|
(*def)->device = VIR_DOMAIN_DISK_DEVICE_LUN;
|
||||||
(*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK);
|
||||||
|
|
||||||
if (STRCASEEQ(fileName, "auto detect")) {
|
if (STRCASEEQ(fileName, "auto detect")) {
|
||||||
(*def)->src = NULL;
|
ignore_value(virDomainDiskSetSource(*def, NULL));
|
||||||
(*def)->startupPolicy = VIR_DOMAIN_STARTUP_POLICY_OPTIONAL;
|
(*def)->startupPolicy = VIR_DOMAIN_STARTUP_POLICY_OPTIONAL;
|
||||||
} else {
|
} else if (virDomainDiskSetSource(*def, fileName) < 0) {
|
||||||
(*def)->src = fileName;
|
goto cleanup;
|
||||||
fileName = NULL;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -2265,13 +2276,20 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
}
|
}
|
||||||
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
||||||
if (fileType != NULL && STRCASEEQ(fileType, "device")) {
|
if (fileType != NULL && STRCASEEQ(fileType, "device")) {
|
||||||
(*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK);
|
||||||
(*def)->src = fileName;
|
if (virDomainDiskSetSource(*def, fileName) < 0)
|
||||||
|
goto cleanup;
|
||||||
fileName = NULL;
|
|
||||||
} else if (fileType != NULL && STRCASEEQ(fileType, "file")) {
|
} else if (fileType != NULL && STRCASEEQ(fileType, "file")) {
|
||||||
(*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
char *tmp;
|
||||||
(*def)->src = ctx->parseFileName(fileName, ctx->opaque);
|
|
||||||
|
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE);
|
||||||
|
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
||||||
|
goto cleanup;
|
||||||
|
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
VIR_FREE(tmp);
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Invalid or not yet handled value '%s' "
|
_("Invalid or not yet handled value '%s' "
|
||||||
@ -2288,7 +2306,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
|
|
||||||
if (virDomainDiskDefAssignAddress(xmlopt, *def) < 0) {
|
if (virDomainDiskDefAssignAddress(xmlopt, *def) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not assign address to disk '%s'"), (*def)->src);
|
_("Could not assign address to disk '%s'"),
|
||||||
|
virDomainDiskGetSource(*def));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3395,11 +3414,12 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
int controllerOrBus, unit;
|
int controllerOrBus, unit;
|
||||||
const char *vmxDeviceType = NULL;
|
const char *vmxDeviceType = NULL;
|
||||||
char *fileName = NULL;
|
char *fileName = NULL;
|
||||||
|
int type = virDomainDiskGetType(def);
|
||||||
|
|
||||||
/* Convert a handful of types to their string values */
|
/* Convert a handful of types to their string values */
|
||||||
const char *busType = virDomainDiskBusTypeToString(def->bus);
|
const char *busType = virDomainDiskBusTypeToString(def->bus);
|
||||||
const char *deviceType = virDomainDeviceTypeToString(def->device);
|
const char *deviceType = virDomainDeviceTypeToString(def->device);
|
||||||
const char *diskType = virDomainDeviceTypeToString(def->type);
|
const char *diskType = virDomainDeviceTypeToString(type);
|
||||||
|
|
||||||
/* If we are dealing with a disk its a .vmdk, otherwise it must be
|
/* If we are dealing with a disk its a .vmdk, otherwise it must be
|
||||||
* an ISO.
|
* an ISO.
|
||||||
@ -3417,8 +3437,8 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We only support type='file' and type='block' */
|
/* We only support type='file' and type='block' */
|
||||||
if (def->type != VIR_DOMAIN_DISK_TYPE_FILE &&
|
if (type != VIR_DOMAIN_DISK_TYPE_FILE &&
|
||||||
def->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("%s %s '%s' has unsupported type '%s', expecting "
|
_("%s %s '%s' has unsupported type '%s', expecting "
|
||||||
"'%s' or '%s'"), busType, deviceType, def->dst,
|
"'%s' or '%s'"), busType, deviceType, def->dst,
|
||||||
@ -3446,11 +3466,11 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
||||||
def->type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
||||||
vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ?
|
vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ?
|
||||||
"scsi-hardDisk" : "ata-hardDisk";
|
"scsi-hardDisk" : "ata-hardDisk";
|
||||||
} else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
} else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
||||||
if (def->type == VIR_DOMAIN_DISK_TYPE_FILE)
|
if (type == VIR_DOMAIN_DISK_TYPE_FILE)
|
||||||
vmxDeviceType = "cdrom-image";
|
vmxDeviceType = "cdrom-image";
|
||||||
else
|
else
|
||||||
vmxDeviceType = "atapi-cdrom";
|
vmxDeviceType = "atapi-cdrom";
|
||||||
@ -3468,8 +3488,10 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n",
|
virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n",
|
||||||
busType, controllerOrBus, unit, vmxDeviceType);
|
busType, controllerOrBus, unit, vmxDeviceType);
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
||||||
if (def->src != NULL && ! virFileHasSuffix(def->src, fileExt)) {
|
const char *src = virDomainDiskGetSource(def);
|
||||||
|
|
||||||
|
if (src && ! virFileHasSuffix(src, fileExt)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Image file for %s %s '%s' has "
|
_("Image file for %s %s '%s' has "
|
||||||
"unsupported suffix, expecting '%s'"),
|
"unsupported suffix, expecting '%s'"),
|
||||||
@ -3477,7 +3499,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName = ctx->formatFileName(def->src, ctx->opaque);
|
fileName = ctx->formatFileName(src, ctx->opaque);
|
||||||
|
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -3487,8 +3509,10 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
busType, controllerOrBus, unit, fileName);
|
busType, controllerOrBus, unit, fileName);
|
||||||
|
|
||||||
VIR_FREE(fileName);
|
VIR_FREE(fileName);
|
||||||
} else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
} else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
||||||
if (!def->src &&
|
const char *src = virDomainDiskGetSource(def);
|
||||||
|
|
||||||
|
if (!src &&
|
||||||
def->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_OPTIONAL) {
|
def->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_OPTIONAL) {
|
||||||
virBufferAsprintf(buffer, "%s%d:%d.autodetect = \"true\"\n",
|
virBufferAsprintf(buffer, "%s%d:%d.autodetect = \"true\"\n",
|
||||||
busType, controllerOrBus, unit);
|
busType, controllerOrBus, unit);
|
||||||
@ -3496,7 +3520,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
busType, controllerOrBus, unit);
|
busType, controllerOrBus, unit);
|
||||||
} else {
|
} else {
|
||||||
virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n",
|
virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n",
|
||||||
busType, controllerOrBus, unit, def->src);
|
busType, controllerOrBus, unit, src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3526,6 +3550,8 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
{
|
{
|
||||||
int unit;
|
int unit;
|
||||||
char *fileName = NULL;
|
char *fileName = NULL;
|
||||||
|
int type = virDomainDiskGetType(def);
|
||||||
|
const char *src = virDomainDiskGetSource(def);
|
||||||
|
|
||||||
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
|
||||||
@ -3540,11 +3566,11 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
|
|
||||||
virBufferAsprintf(buffer, "floppy%d.present = \"true\"\n", unit);
|
virBufferAsprintf(buffer, "floppy%d.present = \"true\"\n", unit);
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
||||||
virBufferAsprintf(buffer, "floppy%d.fileType = \"file\"\n", unit);
|
virBufferAsprintf(buffer, "floppy%d.fileType = \"file\"\n", unit);
|
||||||
|
|
||||||
if (def->src != NULL) {
|
if (src) {
|
||||||
fileName = ctx->formatFileName(def->src, ctx->opaque);
|
fileName = ctx->formatFileName(src, ctx->opaque);
|
||||||
|
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -3555,18 +3581,18 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
|
|
||||||
VIR_FREE(fileName);
|
VIR_FREE(fileName);
|
||||||
}
|
}
|
||||||
} else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
} else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
||||||
virBufferAsprintf(buffer, "floppy%d.fileType = \"device\"\n", unit);
|
virBufferAsprintf(buffer, "floppy%d.fileType = \"device\"\n", unit);
|
||||||
|
|
||||||
if (def->src != NULL) {
|
if (src) {
|
||||||
virBufferAsprintf(buffer, "floppy%d.fileName = \"%s\"\n",
|
virBufferAsprintf(buffer, "floppy%d.fileName = \"%s\"\n",
|
||||||
unit, def->src);
|
unit, src);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Floppy '%s' has unsupported type '%s', expecting '%s' "
|
_("Floppy '%s' has unsupported type '%s', expecting '%s' "
|
||||||
"or '%s'"), def->dst,
|
"or '%s'"), def->dst,
|
||||||
virDomainDiskTypeToString(def->type),
|
virDomainDiskTypeToString(type),
|
||||||
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
|
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
|
||||||
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
|
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user