mirror of https://gitee.com/openkylin/libvirt.git
Remove unnecessary curly brackets in src/vmx/vmx.c
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
247ad91541
commit
3d45429ef1
243
src/vmx/vmx.c
243
src/vmx/vmx.c
|
@ -565,9 +565,8 @@ virVMXEscapeHex(const char *string, char escape, const char *special)
|
||||||
|
|
||||||
/* Calculate length of escaped string */
|
/* Calculate length of escaped string */
|
||||||
while (*tmp1 != '\0') {
|
while (*tmp1 != '\0') {
|
||||||
if (*tmp1 == escape || strspn(tmp1, special) > 0) {
|
if (*tmp1 == escape || strspn(tmp1, special) > 0)
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
|
||||||
|
|
||||||
++tmp1;
|
++tmp1;
|
||||||
++length;
|
++length;
|
||||||
|
@ -610,9 +609,8 @@ virVMXUnescapeHex(char *string, char escape)
|
||||||
/* Unescape from 'cXX' where c is the escape char and X is a hex digit */
|
/* Unescape from 'cXX' where c is the escape char and X is a hex digit */
|
||||||
while (*tmp1 != '\0') {
|
while (*tmp1 != '\0') {
|
||||||
if (*tmp1 == escape) {
|
if (*tmp1 == escape) {
|
||||||
if (!c_isxdigit(tmp1[1]) || !c_isxdigit(tmp1[2])) {
|
if (!c_isxdigit(tmp1[1]) || !c_isxdigit(tmp1[2]))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
*tmp2++ = virHexToBin(tmp1[1]) * 16 + virHexToBin(tmp1[2]);
|
*tmp2++ = virHexToBin(tmp1[1]) * 16 + virHexToBin(tmp1[2]);
|
||||||
tmp1 += 3;
|
tmp1 += 3;
|
||||||
|
@ -676,9 +674,8 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char **string,
|
||||||
value = virConfGetValue(conf, name);
|
value = virConfGetValue(conf, name);
|
||||||
|
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
if (optional) {
|
if (optional)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Missing essential config entry '%s'"), name);
|
_("Missing essential config entry '%s'"), name);
|
||||||
|
@ -692,9 +689,8 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char **string,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value->str == NULL) {
|
if (value->str == NULL) {
|
||||||
if (optional) {
|
if (optional)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Missing essential config entry '%s'"), name);
|
_("Missing essential config entry '%s'"), name);
|
||||||
|
@ -882,9 +878,8 @@ virVMXSCSIDiskNameToControllerAndUnit(const char *name, int *controller, int *un
|
||||||
*unit = idx % 15;
|
*unit = idx % 15;
|
||||||
|
|
||||||
/* Skip the controller ifself at unit 7 */
|
/* Skip the controller ifself at unit 7 */
|
||||||
if (*unit >= 7) {
|
if (*unit >= 7)
|
||||||
++(*unit);
|
++(*unit);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1082,17 +1077,15 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
|
||||||
const char *driver = virDomainDiskGetDriver(disk);
|
const char *driver = virDomainDiskGetDriver(disk);
|
||||||
char *copy;
|
char *copy;
|
||||||
|
|
||||||
if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI || !driver) {
|
if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI || !driver)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (VIR_STRDUP(copy, driver) < 0)
|
if (VIR_STRDUP(copy, driver) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
tmp = copy;
|
tmp = copy;
|
||||||
|
|
||||||
for (; *tmp != '\0'; ++tmp) {
|
for (; *tmp != '\0'; ++tmp)
|
||||||
*tmp = c_tolower(*tmp);
|
*tmp = c_tolower(*tmp);
|
||||||
}
|
|
||||||
|
|
||||||
model = virDomainControllerModelSCSITypeFromString(copy);
|
model = virDomainControllerModelSCSITypeFromString(copy);
|
||||||
VIR_FREE(copy);
|
VIR_FREE(copy);
|
||||||
|
@ -1278,14 +1271,12 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
|
|
||||||
conf = virConfReadMem(vmx, strlen(vmx), VIR_CONF_FLAG_VMX_FORMAT);
|
conf = virConfReadMem(vmx, strlen(vmx), VIR_CONF_FLAG_VMX_FORMAT);
|
||||||
|
|
||||||
if (conf == NULL) {
|
if (conf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:.encoding */
|
/* vmx:.encoding */
|
||||||
if (virVMXGetConfigString(conf, ".encoding", &encoding, true) < 0) {
|
if (virVMXGetConfigString(conf, ".encoding", &encoding, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (encoding == NULL || STRCASEEQ(encoding, "UTF-8")) {
|
if (encoding == NULL || STRCASEEQ(encoding, "UTF-8")) {
|
||||||
/* nothing */
|
/* nothing */
|
||||||
|
@ -1295,17 +1286,15 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
|
|
||||||
utf8 = virVMXConvertToUTF8(encoding, vmx);
|
utf8 = virVMXConvertToUTF8(encoding, vmx);
|
||||||
|
|
||||||
if (utf8 == NULL) {
|
if (utf8 == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
conf = virConfReadMem(utf8, strlen(utf8), VIR_CONF_FLAG_VMX_FORMAT);
|
conf = virConfReadMem(utf8, strlen(utf8), VIR_CONF_FLAG_VMX_FORMAT);
|
||||||
|
|
||||||
VIR_FREE(utf8);
|
VIR_FREE(utf8);
|
||||||
|
|
||||||
if (conf == NULL) {
|
if (conf == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate domain def */
|
/* Allocate domain def */
|
||||||
|
@ -1344,14 +1333,12 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
|
|
||||||
/* vmx:uuid.bios -> def:uuid */
|
/* vmx:uuid.bios -> def:uuid */
|
||||||
/* FIXME: Need to handle 'uuid.action = "create"' */
|
/* FIXME: Need to handle 'uuid.action = "create"' */
|
||||||
if (virVMXGetConfigUUID(conf, "uuid.bios", def->uuid, true) < 0) {
|
if (virVMXGetConfigUUID(conf, "uuid.bios", def->uuid, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:displayName -> def:name */
|
/* vmx:displayName -> def:name */
|
||||||
if (virVMXGetConfigString(conf, "displayName", &def->name, true) < 0) {
|
if (virVMXGetConfigString(conf, "displayName", &def->name, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (def->name != NULL) {
|
if (def->name != NULL) {
|
||||||
if (virVMXUnescapeHexPercent(def->name) < 0 ||
|
if (virVMXUnescapeHexPercent(def->name) < 0 ||
|
||||||
|
@ -1378,9 +1365,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vmx:memsize -> def:mem.max_balloon */
|
/* vmx:memsize -> def:mem.max_balloon */
|
||||||
if (virVMXGetConfigLong(conf, "memsize", &memsize, 32, true) < 0) {
|
if (virVMXGetConfigLong(conf, "memsize", &memsize, 32, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (memsize <= 0 || memsize % 4 != 0) {
|
if (memsize <= 0 || memsize % 4 != 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -1397,15 +1383,13 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sched_mem_max < 0) {
|
if (sched_mem_max < 0)
|
||||||
sched_mem_max = memsize;
|
sched_mem_max = memsize;
|
||||||
}
|
|
||||||
|
|
||||||
def->mem.cur_balloon = sched_mem_max * 1024; /* Scale from megabytes to kilobytes */
|
def->mem.cur_balloon = sched_mem_max * 1024; /* Scale from megabytes to kilobytes */
|
||||||
|
|
||||||
if (def->mem.cur_balloon > def->mem.max_balloon) {
|
if (def->mem.cur_balloon > def->mem.max_balloon)
|
||||||
def->mem.cur_balloon = def->mem.max_balloon;
|
def->mem.cur_balloon = def->mem.max_balloon;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:sched.mem.minsize -> def:mem.min_guarantee */
|
/* vmx:sched.mem.minsize -> def:mem.min_guarantee */
|
||||||
if (virVMXGetConfigLong(conf, "sched.mem.minsize", &sched_mem_minsize, 0,
|
if (virVMXGetConfigLong(conf, "sched.mem.minsize", &sched_mem_minsize, 0,
|
||||||
|
@ -1413,20 +1397,17 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sched_mem_minsize < 0) {
|
if (sched_mem_minsize < 0)
|
||||||
sched_mem_minsize = 0;
|
sched_mem_minsize = 0;
|
||||||
}
|
|
||||||
|
|
||||||
def->mem.min_guarantee = sched_mem_minsize * 1024; /* Scale from megabytes to kilobytes */
|
def->mem.min_guarantee = sched_mem_minsize * 1024; /* Scale from megabytes to kilobytes */
|
||||||
|
|
||||||
if (def->mem.min_guarantee > def->mem.max_balloon) {
|
if (def->mem.min_guarantee > def->mem.max_balloon)
|
||||||
def->mem.min_guarantee = def->mem.max_balloon;
|
def->mem.min_guarantee = def->mem.max_balloon;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:numvcpus -> def:vcpus */
|
/* vmx:numvcpus -> def:vcpus */
|
||||||
if (virVMXGetConfigLong(conf, "numvcpus", &numvcpus, 1, true) < 0) {
|
if (virVMXGetConfigLong(conf, "numvcpus", &numvcpus, 1, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
|
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -1474,9 +1455,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number + 1 > cpumasklen) {
|
if (number + 1 > cpumasklen)
|
||||||
cpumasklen = number + 1;
|
cpumasklen = number + 1;
|
||||||
}
|
|
||||||
|
|
||||||
ignore_value(virBitmapSetBit(def->cpumask, number));
|
ignore_value(virBitmapSetBit(def->cpumask, number));
|
||||||
++count;
|
++count;
|
||||||
|
@ -1542,9 +1522,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* vmx:guestOS -> def:os.arch */
|
/* vmx:guestOS -> def:os.arch */
|
||||||
if (virVMXGetConfigString(conf, "guestOS", &guestOS, true) < 0) {
|
if (virVMXGetConfigString(conf, "guestOS", &guestOS, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (guestOS != NULL && virFileHasSuffix(guestOS, "-64")) {
|
if (guestOS != NULL && virFileHasSuffix(guestOS, "-64")) {
|
||||||
def->os.arch = VIR_ARCH_X86_64;
|
def->os.arch = VIR_ARCH_X86_64;
|
||||||
|
@ -1558,9 +1537,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smbios_reflecthost) {
|
if (smbios_reflecthost)
|
||||||
def->os.smbios_mode = VIR_DOMAIN_SMBIOS_HOST;
|
def->os.smbios_mode = VIR_DOMAIN_SMBIOS_HOST;
|
||||||
}
|
|
||||||
|
|
||||||
/* def:features */
|
/* def:features */
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
|
@ -1574,13 +1552,11 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
|
|
||||||
def->ngraphics = 0;
|
def->ngraphics = 0;
|
||||||
|
|
||||||
if (virVMXParseVNC(conf, &def->graphics[def->ngraphics]) < 0) {
|
if (virVMXParseVNC(conf, &def->graphics[def->ngraphics]) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (def->graphics[def->ngraphics] != NULL) {
|
if (def->graphics[def->ngraphics] != NULL)
|
||||||
++def->ngraphics;
|
++def->ngraphics;
|
||||||
}
|
|
||||||
|
|
||||||
/* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
|
/* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
|
||||||
if (VIR_ALLOC_N(def->disks, 66) < 0)
|
if (VIR_ALLOC_N(def->disks, 66) < 0)
|
||||||
|
@ -1595,9 +1571,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! present) {
|
if (! present)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
for (unit = 0; unit < 16; ++unit) {
|
for (unit = 0; unit < 16; ++unit) {
|
||||||
if (unit == 7) {
|
if (unit == 7) {
|
||||||
|
@ -1625,9 +1600,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->disks[def->ndisks] != NULL) {
|
if (def->disks[def->ndisks] != NULL)
|
||||||
++def->ndisks;
|
++def->ndisks;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1651,9 +1625,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->disks[def->ndisks] != NULL) {
|
if (def->disks[def->ndisks] != NULL)
|
||||||
++def->ndisks;
|
++def->ndisks;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1665,9 +1638,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->disks[def->ndisks] != NULL) {
|
if (def->disks[def->ndisks] != NULL)
|
||||||
++def->ndisks;
|
++def->ndisks;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:controllers */
|
/* def:controllers */
|
||||||
|
@ -1716,9 +1688,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->fss[def->nfss] != NULL) {
|
if (def->fss[def->nfss] != NULL)
|
||||||
++def->nfss;
|
++def->nfss;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1735,9 +1706,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->nets[def->nnets] != NULL) {
|
if (def->nets[def->nnets] != NULL)
|
||||||
++def->nnets;
|
++def->nnets;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:inputs */
|
/* def:inputs */
|
||||||
|
@ -1749,9 +1719,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
|
|
||||||
def->nvideos = 0;
|
def->nvideos = 0;
|
||||||
|
|
||||||
if (virVMXParseSVGA(conf, &def->videos[def->nvideos]) < 0) {
|
if (virVMXParseSVGA(conf, &def->videos[def->nvideos]) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
def->nvideos = 1;
|
def->nvideos = 1;
|
||||||
|
|
||||||
|
@ -1773,9 +1742,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->serials[def->nserials] != NULL) {
|
if (def->serials[def->nserials] != NULL)
|
||||||
++def->nserials;
|
++def->nserials;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:parallels */
|
/* def:parallels */
|
||||||
|
@ -1790,9 +1758,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->parallels[def->nparallels] != NULL) {
|
if (def->parallels[def->nparallels] != NULL)
|
||||||
++def->nparallels;
|
++def->nparallels;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
|
@ -1831,9 +1798,8 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! enabled) {
|
if (! enabled)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (VIR_ALLOC(*def) < 0)
|
if (VIR_ALLOC(*def) < 0)
|
||||||
goto failure;
|
goto failure;
|
||||||
|
@ -1864,9 +1830,8 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
|
||||||
(*def)->data.vnc.port = 0;
|
(*def)->data.vnc.port = 0;
|
||||||
(*def)->data.vnc.autoport = true;
|
(*def)->data.vnc.autoport = true;
|
||||||
} else {
|
} else {
|
||||||
if (port < 5900 || port > 5964) {
|
if (port < 5900 || port > 5964)
|
||||||
VIR_WARN("VNC port %lld it out of [5900..5964] range", port);
|
VIR_WARN("VNC port %lld it out of [5900..5964] range", port);
|
||||||
}
|
|
||||||
|
|
||||||
(*def)->data.vnc.port = port;
|
(*def)->data.vnc.port = port;
|
||||||
(*def)->data.vnc.autoport = false;
|
(*def)->data.vnc.autoport = false;
|
||||||
|
@ -1910,9 +1875,8 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
|
||||||
snprintf(virtualDev_name, sizeof(virtualDev_name), "scsi%d.virtualDev",
|
snprintf(virtualDev_name, sizeof(virtualDev_name), "scsi%d.virtualDev",
|
||||||
controller);
|
controller);
|
||||||
|
|
||||||
if (virVMXGetConfigBoolean(conf, present_name, present, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, present_name, present, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (! *present) {
|
if (! *present) {
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -1927,9 +1891,8 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
|
||||||
if (virtualDev_string != NULL) {
|
if (virtualDev_string != NULL) {
|
||||||
tmp = virtualDev_string;
|
tmp = virtualDev_string;
|
||||||
|
|
||||||
for (; *tmp != '\0'; ++tmp) {
|
for (; *tmp != '\0'; ++tmp)
|
||||||
*tmp = c_tolower(*tmp);
|
*tmp = c_tolower(*tmp);
|
||||||
}
|
|
||||||
|
|
||||||
*virtualDev = virVMXControllerModelSCSITypeFromString(virtualDev_string);
|
*virtualDev = virVMXControllerModelSCSITypeFromString(virtualDev_string);
|
||||||
|
|
||||||
|
@ -2045,9 +2008,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
virIndexToDiskName
|
virIndexToDiskName
|
||||||
(controllerOrBus * 15 + (unit < 7 ? unit : unit - 1), "sd");
|
(controllerOrBus * 15 + (unit < 7 ? unit : unit - 1), "sd");
|
||||||
|
|
||||||
if ((*def)->dst == NULL) {
|
if ((*def)->dst == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
} else if (busType == VIR_DOMAIN_DISK_BUS_IDE) {
|
} else if (busType == VIR_DOMAIN_DISK_BUS_IDE) {
|
||||||
if (controllerOrBus < 0 || controllerOrBus > 1) {
|
if (controllerOrBus < 0 || controllerOrBus > 1) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -2067,9 +2029,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
|
|
||||||
(*def)->dst = virIndexToDiskName(controllerOrBus * 2 + unit, "hd");
|
(*def)->dst = virIndexToDiskName(controllerOrBus * 2 + unit, "hd");
|
||||||
|
|
||||||
if ((*def)->dst == NULL) {
|
if ((*def)->dst == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Unsupported bus type '%s' for device type '%s'"),
|
_("Unsupported bus type '%s' for device type '%s'"),
|
||||||
|
@ -2098,9 +2059,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
|
|
||||||
(*def)->dst = virIndexToDiskName(unit, "fd");
|
(*def)->dst = virIndexToDiskName(unit, "fd");
|
||||||
|
|
||||||
if ((*def)->dst == NULL) {
|
if ((*def)->dst == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Unsupported bus type '%s' for device type '%s'"),
|
_("Unsupported bus type '%s' for device type '%s'"),
|
||||||
|
@ -2125,9 +2085,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
VMX_BUILD_NAME(mode);
|
VMX_BUILD_NAME(mode);
|
||||||
|
|
||||||
/* vmx:present */
|
/* vmx:present */
|
||||||
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:startConnected */
|
/* vmx:startConnected */
|
||||||
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
||||||
|
@ -2136,14 +2095,12 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Need to distiguish between active and inactive domains here */
|
/* FIXME: Need to distiguish between active and inactive domains here */
|
||||||
if (! present/* && ! startConnected*/) {
|
if (! present/* && ! startConnected*/)
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:deviceType -> def:type */
|
/* vmx:deviceType -> def:type */
|
||||||
if (virVMXGetConfigString(conf, deviceType_name, &deviceType, true) < 0) {
|
if (virVMXGetConfigString(conf, deviceType_name, &deviceType, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:clientDevice */
|
/* vmx:clientDevice */
|
||||||
if (virVMXGetConfigBoolean(conf, clientDevice_name, &clientDevice, false,
|
if (virVMXGetConfigBoolean(conf, clientDevice_name, &clientDevice, false,
|
||||||
|
@ -2152,9 +2109,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vmx:mode -> def:transient */
|
/* vmx:mode -> def:transient */
|
||||||
if (virVMXGetConfigString(conf, mode_name, &mode, true) < 0) {
|
if (virVMXGetConfigString(conf, mode_name, &mode, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (clientDevice) {
|
if (clientDevice) {
|
||||||
/*
|
/*
|
||||||
|
@ -2165,14 +2121,12 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vmx:fileType -> def:type */
|
/* vmx:fileType -> def:type */
|
||||||
if (virVMXGetConfigString(conf, fileType_name, &fileType, true) < 0) {
|
if (virVMXGetConfigString(conf, fileType_name, &fileType, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:fileName -> def:src, def:type */
|
/* vmx:fileName -> def:src, def:type */
|
||||||
if (virVMXGetConfigString(conf, fileName_name, &fileName, false) < 0) {
|
if (virVMXGetConfigString(conf, fileName_name, &fileName, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:writeThrough -> def:cachemode */
|
/* vmx:writeThrough -> def:cachemode */
|
||||||
if (virVMXGetConfigBoolean(conf, writeThrough_name, &writeThrough, false,
|
if (virVMXGetConfigBoolean(conf, writeThrough_name, &writeThrough, false,
|
||||||
|
@ -2396,31 +2350,26 @@ int virVMXParseFileSystem(virConfPtr conf, int number, virDomainFSDefPtr *def)
|
||||||
VMX_BUILD_NAME(writeAccess);
|
VMX_BUILD_NAME(writeAccess);
|
||||||
|
|
||||||
/* vmx:present */
|
/* vmx:present */
|
||||||
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:enabled */
|
/* vmx:enabled */
|
||||||
if (virVMXGetConfigBoolean(conf, enabled_name, &enabled, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, enabled_name, &enabled, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(present && enabled)) {
|
if (!(present && enabled))
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:hostPath */
|
/* vmx:hostPath */
|
||||||
if (virVMXGetConfigString(conf, hostPath_name, &hostPath, false) < 0) {
|
if (virVMXGetConfigString(conf, hostPath_name, &hostPath, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
(*def)->src = hostPath;
|
(*def)->src = hostPath;
|
||||||
hostPath = NULL;
|
hostPath = NULL;
|
||||||
|
|
||||||
/* vmx:guestName */
|
/* vmx:guestName */
|
||||||
if (virVMXGetConfigString(conf, guestName_name, &guestName, false) < 0) {
|
if (virVMXGetConfigString(conf, guestName_name, &guestName, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
(*def)->dst = guestName;
|
(*def)->dst = guestName;
|
||||||
guestName = NULL;
|
guestName = NULL;
|
||||||
|
@ -2522,9 +2471,8 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
|
||||||
VMX_BUILD_NAME(vnet);
|
VMX_BUILD_NAME(vnet);
|
||||||
|
|
||||||
/* vmx:present */
|
/* vmx:present */
|
||||||
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:startConnected */
|
/* vmx:startConnected */
|
||||||
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
||||||
|
@ -2533,9 +2481,8 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Need to distiguish between active and inactive domains here */
|
/* FIXME: Need to distiguish between active and inactive domains here */
|
||||||
if (! present/* && ! startConnected*/) {
|
if (! present/* && ! startConnected*/)
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:connectionType -> def:type */
|
/* vmx:connectionType -> def:type */
|
||||||
if (virVMXGetConfigString(conf, connectionType_name, &connectionType,
|
if (virVMXGetConfigString(conf, connectionType_name, &connectionType,
|
||||||
|
@ -2736,9 +2683,8 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
|
||||||
VMX_BUILD_NAME_EXTRA(network_endPoint, "network.endPoint");
|
VMX_BUILD_NAME_EXTRA(network_endPoint, "network.endPoint");
|
||||||
|
|
||||||
/* vmx:present */
|
/* vmx:present */
|
||||||
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:startConnected */
|
/* vmx:startConnected */
|
||||||
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
||||||
|
@ -2747,19 +2693,16 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Need to distiguish between active and inactive domains here */
|
/* FIXME: Need to distiguish between active and inactive domains here */
|
||||||
if (! present/* && ! startConnected*/) {
|
if (! present/* && ! startConnected*/)
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:fileType -> def:type */
|
/* vmx:fileType -> def:type */
|
||||||
if (virVMXGetConfigString(conf, fileType_name, &fileType, false) < 0) {
|
if (virVMXGetConfigString(conf, fileType_name, &fileType, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:fileName -> def:data.file.path */
|
/* vmx:fileName -> def:data.file.path */
|
||||||
if (virVMXGetConfigString(conf, fileName_name, &fileName, true) < 0) {
|
if (virVMXGetConfigString(conf, fileName_name, &fileName, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:network.endPoint -> def:data.tcp.listen */
|
/* vmx:network.endPoint -> def:data.tcp.listen */
|
||||||
if (virVMXGetConfigString(conf, network_endPoint_name, &network_endPoint,
|
if (virVMXGetConfigString(conf, network_endPoint_name, &network_endPoint,
|
||||||
|
@ -2780,9 +2723,8 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
|
||||||
(*def)->source.data.file.path = ctx->parseFileName(fileName,
|
(*def)->source.data.file.path = ctx->parseFileName(fileName,
|
||||||
ctx->opaque);
|
ctx->opaque);
|
||||||
|
|
||||||
if ((*def)->source.data.file.path == NULL) {
|
if ((*def)->source.data.file.path == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
} else if (STRCASEEQ(fileType, "pipe")) {
|
} else if (STRCASEEQ(fileType, "pipe")) {
|
||||||
/*
|
/*
|
||||||
* FIXME: Differences between client/server and VM/application pipes
|
* FIXME: Differences between client/server and VM/application pipes
|
||||||
|
@ -2924,9 +2866,8 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
|
||||||
VMX_BUILD_NAME(fileName);
|
VMX_BUILD_NAME(fileName);
|
||||||
|
|
||||||
/* vmx:present */
|
/* vmx:present */
|
||||||
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0) {
|
if (virVMXGetConfigBoolean(conf, present_name, &present, false, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:startConnected */
|
/* vmx:startConnected */
|
||||||
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
if (virVMXGetConfigBoolean(conf, startConnected_name, &startConnected,
|
||||||
|
@ -2935,19 +2876,16 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Need to distiguish between active and inactive domains here */
|
/* FIXME: Need to distiguish between active and inactive domains here */
|
||||||
if (! present/* && ! startConnected*/) {
|
if (! present/* && ! startConnected*/)
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:fileType -> def:type */
|
/* vmx:fileType -> def:type */
|
||||||
if (virVMXGetConfigString(conf, fileType_name, &fileType, false) < 0) {
|
if (virVMXGetConfigString(conf, fileType_name, &fileType, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* vmx:fileName -> def:data.file.path */
|
/* vmx:fileName -> def:data.file.path */
|
||||||
if (virVMXGetConfigString(conf, fileName_name, &fileName, false) < 0) {
|
if (virVMXGetConfigString(conf, fileName_name, &fileName, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup virDomainChrDef */
|
/* Setup virDomainChrDef */
|
||||||
if (STRCASEEQ(fileType, "device")) {
|
if (STRCASEEQ(fileType, "device")) {
|
||||||
|
@ -2962,9 +2900,8 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port,
|
||||||
(*def)->source.data.file.path = ctx->parseFileName(fileName,
|
(*def)->source.data.file.path = ctx->parseFileName(fileName,
|
||||||
ctx->opaque);
|
ctx->opaque);
|
||||||
|
|
||||||
if ((*def)->source.data.file.path == NULL) {
|
if ((*def)->source.data.file.path == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Expecting VMX entry '%s' to be 'device' or 'file' but "
|
_("Expecting VMX entry '%s' to be 'device' or 'file' but "
|
||||||
|
@ -3122,15 +3059,13 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
/* def:name -> vmx:displayName */
|
/* def:name -> vmx:displayName */
|
||||||
preliminaryDisplayName = virVMXEscapeHexPipe(def->name);
|
preliminaryDisplayName = virVMXEscapeHexPipe(def->name);
|
||||||
|
|
||||||
if (preliminaryDisplayName == NULL) {
|
if (preliminaryDisplayName == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
displayName = virVMXEscapeHexPercent(preliminaryDisplayName);
|
displayName = virVMXEscapeHexPercent(preliminaryDisplayName);
|
||||||
|
|
||||||
if (displayName == NULL) {
|
if (displayName == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAsprintf(&buffer, "displayName = \"%s\"\n", displayName);
|
virBufferAsprintf(&buffer, "displayName = \"%s\"\n", displayName);
|
||||||
|
|
||||||
|
@ -3188,9 +3123,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
sched_cpu_affinity_length = 0;
|
sched_cpu_affinity_length = 0;
|
||||||
|
|
||||||
bit = -1;
|
bit = -1;
|
||||||
while ((bit = virBitmapNextSetBit(def->cpumask, bit)) >= 0) {
|
while ((bit = virBitmapNextSetBit(def->cpumask, bit)) >= 0)
|
||||||
++sched_cpu_affinity_length;
|
++sched_cpu_affinity_length;
|
||||||
}
|
|
||||||
|
|
||||||
if (sched_cpu_affinity_length < def->maxvcpus) {
|
if (sched_cpu_affinity_length < def->maxvcpus) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
@ -3204,9 +3138,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
while ((bit = virBitmapNextSetBit(def->cpumask, bit)) >= 0) {
|
while ((bit = virBitmapNextSetBit(def->cpumask, bit)) >= 0) {
|
||||||
virBufferAsprintf(&buffer, "%d", bit);
|
virBufferAsprintf(&buffer, "%d", bit);
|
||||||
|
|
||||||
if (sched_cpu_affinity_length > 1) {
|
if (sched_cpu_affinity_length > 1)
|
||||||
virBufferAddChar(&buffer, ',');
|
virBufferAddChar(&buffer, ',');
|
||||||
}
|
|
||||||
|
|
||||||
--sched_cpu_affinity_length;
|
--sched_cpu_affinity_length;
|
||||||
}
|
}
|
||||||
|
@ -3233,9 +3166,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
for (i = 0; i < def->ngraphics; ++i) {
|
for (i = 0; i < def->ngraphics; ++i) {
|
||||||
switch (def->graphics[i]->type) {
|
switch (def->graphics[i]->type) {
|
||||||
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
|
||||||
if (virVMXFormatVNC(def->graphics[i], &buffer) < 0) {
|
if (virVMXFormatVNC(def->graphics[i], &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3277,9 +3209,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
||||||
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
||||||
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
||||||
if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0) {
|
if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3301,9 +3232,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i) {
|
for (i = 0; i < 2; ++i) {
|
||||||
/* floppy[0..1].present defaults to true, disable it explicitly */
|
/* floppy[0..1].present defaults to true, disable it explicitly */
|
||||||
if (! floppy_present[i]) {
|
if (! floppy_present[i])
|
||||||
virBufferAsprintf(&buffer, "floppy%zu.present = \"false\"\n", i);
|
virBufferAsprintf(&buffer, "floppy%zu.present = \"false\"\n", i);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:fss */
|
/* def:fss */
|
||||||
|
@ -3313,16 +3243,14 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < def->nfss; ++i) {
|
for (i = 0; i < def->nfss; ++i) {
|
||||||
if (virVMXFormatFileSystem(def->fss[i], i, &buffer) < 0) {
|
if (virVMXFormatFileSystem(def->fss[i], i, &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:nets */
|
/* def:nets */
|
||||||
for (i = 0; i < def->nnets; ++i) {
|
for (i = 0; i < def->nnets; ++i) {
|
||||||
if (virVMXFormatEthernet(def->nets[i], i, &buffer) < 0) {
|
if (virVMXFormatEthernet(def->nets[i], i, &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:inputs */
|
/* def:inputs */
|
||||||
|
@ -3339,9 +3267,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virVMXFormatSVGA(def->videos[0], &buffer) < 0) {
|
if (virVMXFormatSVGA(def->videos[0], &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:hostdevs */
|
/* def:hostdevs */
|
||||||
|
@ -3349,16 +3276,14 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
|
|
||||||
/* def:serials */
|
/* def:serials */
|
||||||
for (i = 0; i < def->nserials; ++i) {
|
for (i = 0; i < def->nserials; ++i) {
|
||||||
if (virVMXFormatSerial(ctx, def->serials[i], &buffer) < 0) {
|
if (virVMXFormatSerial(ctx, def->serials[i], &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def:parallels */
|
/* def:parallels */
|
||||||
for (i = 0; i < def->nparallels; ++i) {
|
for (i = 0; i < def->nparallels; ++i) {
|
||||||
if (virVMXFormatParallel(ctx, def->parallels[i], &buffer) < 0) {
|
if (virVMXFormatParallel(ctx, def->parallels[i], &buffer) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get final VMX output */
|
/* Get final VMX output */
|
||||||
|
@ -3368,9 +3293,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
|
||||||
vmx = virBufferContentAndReset(&buffer);
|
vmx = virBufferContentAndReset(&buffer);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vmx == NULL) {
|
if (vmx == NULL)
|
||||||
virBufferFreeAndReset(&buffer);
|
virBufferFreeAndReset(&buffer);
|
||||||
}
|
|
||||||
|
|
||||||
VIR_FREE(preliminaryDisplayName);
|
VIR_FREE(preliminaryDisplayName);
|
||||||
VIR_FREE(displayName);
|
VIR_FREE(displayName);
|
||||||
|
@ -3518,9 +3442,8 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
||||||
|
|
||||||
fileName = ctx->formatFileName(src, ctx->opaque);
|
fileName = ctx->formatFileName(src, ctx->opaque);
|
||||||
|
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n",
|
virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n",
|
||||||
busType, controllerOrBus, unit, fileName);
|
busType, controllerOrBus, unit, fileName);
|
||||||
|
@ -3575,9 +3498,8 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virVMXFloppyDiskNameToUnit(def->dst, &unit) < 0) {
|
if (virVMXFloppyDiskNameToUnit(def->dst, &unit) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
floppy_present[unit] = true;
|
floppy_present[unit] = true;
|
||||||
|
|
||||||
|
@ -3589,9 +3511,8 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
||||||
if (src) {
|
if (src) {
|
||||||
fileName = ctx->formatFileName(src, ctx->opaque);
|
fileName = ctx->formatFileName(src, ctx->opaque);
|
||||||
|
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAsprintf(buffer, "floppy%d.fileName = \"%s\"\n",
|
virBufferAsprintf(buffer, "floppy%d.fileName = \"%s\"\n",
|
||||||
unit, fileName);
|
unit, fileName);
|
||||||
|
@ -3784,9 +3705,8 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def,
|
||||||
|
|
||||||
fileName = ctx->formatFileName(def->source.data.file.path, ctx->opaque);
|
fileName = ctx->formatFileName(def->source.data.file.path, ctx->opaque);
|
||||||
|
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAsprintf(buffer, "serial%d.fileName = \"%s\"\n",
|
virBufferAsprintf(buffer, "serial%d.fileName = \"%s\"\n",
|
||||||
def->target.port, fileName);
|
def->target.port, fileName);
|
||||||
|
@ -3891,9 +3811,8 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def,
|
||||||
|
|
||||||
fileName = ctx->formatFileName(def->source.data.file.path, ctx->opaque);
|
fileName = ctx->formatFileName(def->source.data.file.path, ctx->opaque);
|
||||||
|
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAsprintf(buffer, "parallel%d.fileName = \"%s\"\n",
|
virBufferAsprintf(buffer, "parallel%d.fileName = \"%s\"\n",
|
||||||
def->target.port, fileName);
|
def->target.port, fileName);
|
||||||
|
|
Loading…
Reference in New Issue