if (!(type = virDomainVirtTypeToString(def->virtType))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected domain type %d"), def->virtType);
- goto error;
+ return -1;
}
if (def->id == -1)
xmlIndentTreeOutput = 1;
if (!(xmlbuf = xmlBufferCreate())) {
virReportOOMError();
- goto error;
+ return -1;
}
if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata,
virBufferGetIndent(buf) / 2, 1) < 0) {
xmlIndentTreeOutput = oldIndentTreeOutput;
- goto error;
+ return -1;
}
virBufferAsprintf(buf, "%s\n", (char *) xmlBufferContent(xmlbuf));
xmlIndentTreeOutput = oldIndentTreeOutput;
def->mem.cur_balloon);
if (virDomainDefFormatBlkiotune(buf, def) < 0)
- goto error;
+ return -1;
virDomainMemtuneFormat(buf, &def->mem);
virDomainMemorybackingFormat(buf, &def->mem);
if (virDomainCpuDefFormat(buf, def) < 0)
- goto error;
+ return -1;
if (def->niothreadids > 0) {
virBufferAsprintf(buf, "<iothreads>%zu</iothreads>\n",
}
if (virDomainCputuneDefFormat(buf, def, flags) < 0)
- goto error;
+ return -1;
if (virDomainNumatuneFormatXML(buf, def->numa) < 0)
- goto error;
+ return -1;
if (def->resource)
virDomainResourceDefFormat(buf, def->resource);
for (i = 0; i < def->nsysinfo; i++) {
if (virSysinfoFormat(buf, def->sysinfo[i]) < 0)
- goto error;
+ return -1;
}
if (def->os.bootloader) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected boot device type %d"),
def->os.bootDevs[n]);
- goto error;
+ return -1;
}
virBufferAsprintf(buf, "<boot dev='%s'/>\n", boottype);
}
if (mode == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected smbios mode %d"), def->os.smbios_mode);
- goto error;
+ return -1;
}
virBufferAsprintf(buf, "<smbios mode='%s'/>\n", mode);
}
}
if (virDomainDefFormatFeatures(buf, def) < 0)
- goto error;
+ return -1;
if (virCPUDefFormatBufFull(buf, def->cpu, def->numa) < 0)
- goto error;
+ return -1;
virBufferAsprintf(buf, "<clock offset='%s'",
virDomainClockOffsetTypeToString(def->clock.offset));
virBufferAdjustIndent(buf, 2);
for (n = 0; n < def->clock.ntimers; n++) {
if (virDomainTimerDefFormat(buf, def->clock.timers[n]) < 0)
- goto error;
+ return -1;
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</clock>\n");
if (virDomainEventActionDefFormat(buf, def->onPoweroff,
"on_poweroff",
virDomainLifecycleActionTypeToString) < 0)
- goto error;
+ return -1;
if (virDomainEventActionDefFormat(buf, def->onReboot,
"on_reboot",
virDomainLifecycleActionTypeToString) < 0)
- goto error;
+ return -1;
if (virDomainEventActionDefFormat(buf, def->onCrash,
"on_crash",
virDomainLifecycleActionTypeToString) < 0)
- goto error;
+ return -1;
if (def->onLockFailure != VIR_DOMAIN_LOCK_FAILURE_DEFAULT &&
virDomainEventActionDefFormat(buf, def->onLockFailure,
"on_lockfailure",
virDomainLockFailureTypeToString) < 0)
- goto error;
+ return -1;
if (def->pm.s3 || def->pm.s4) {
virBufferAddLit(buf, "<pm>\n");
for (n = 0; n < def->ndisks; n++)
if (virDomainDiskDefFormat(buf, def->disks[n], flags, xmlopt) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->ncontrollers; n++)
if (virDomainControllerDefFormat(buf, def->controllers[n], flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nleases; n++)
if (virDomainLeaseDefFormat(buf, def->leases[n]) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nfss; n++)
if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nnets; n++)
if (virDomainNetDefFormat(buf, def->nets[n], xmlopt, flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nsmartcards; n++)
if (virDomainSmartcardDefFormat(buf, def->smartcards[n], flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nserials; n++)
if (virDomainChrDefFormat(buf, def->serials[n], flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nparallels; n++)
if (virDomainChrDefFormat(buf, def->parallels[n], flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->nconsoles; n++) {
virDomainChrDef console;
memcpy(&console, def->consoles[n], sizeof(console));
}
if (virDomainChrDefFormat(buf, &console, flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->nchannels; n++)
if (virDomainChrDefFormat(buf, def->channels[n], flags) < 0)
- goto error;
+ return -1;
for (n = 0; n < def->ninputs; n++) {
if (virDomainInputDefFormat(buf, def->inputs[n], flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->ntpms; n++) {
if (virDomainTPMDefFormat(buf, def->tpms[n], flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->ngraphics; n++) {
if (virDomainGraphicsDefFormat(buf, def->graphics[n], flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->nsounds; n++) {
if (virDomainSoundDefFormat(buf, def->sounds[n], flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->nvideos; n++) {
if (virDomainVideoDefFormat(buf, def->videos[n], flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->nhostdevs; n++) {
*/
if (!def->hostdevs[n]->parentnet &&
virDomainHostdevDefFormat(buf, def->hostdevs[n], flags) < 0) {
- goto error;
+ return -1;
}
}
for (n = 0; n < def->nredirdevs; n++) {
if (virDomainRedirdevDefFormat(buf, def->redirdevs[n], flags) < 0)
- goto error;
+ return -1;
}
if (def->redirfilter)
for (n = 0; n < def->nhubs; n++) {
if (virDomainHubDefFormat(buf, def->hubs[n], flags) < 0)
- goto error;
+ return -1;
}
if (def->watchdog)
for (n = 0; n < def->nrngs; n++) {
if (virDomainRNGDefFormat(buf, def->rngs[n], flags))
- goto error;
+ return -1;
}
if (def->nvram)
for (n = 0; n < def->npanics; n++) {
if (virDomainPanicDefFormat(buf, def->panics[n]) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->nshmems; n++) {
if (virDomainShmemDefFormat(buf, def->shmems[n], flags) < 0)
- goto error;
+ return -1;
}
for (n = 0; n < def->nmems; n++) {
if (virDomainMemoryDefFormat(buf, def->mems[n], def, flags) < 0)
- goto error;
+ return -1;
}
if (def->iommu &&
virDomainIOMMUDefFormat(buf, def->iommu) < 0)
- goto error;
+ return -1;
if (def->vsock &&
virDomainVsockDefFormat(buf, def->vsock) < 0)
- goto error;
+ return -1;
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</devices>\n");
if (def->namespaceData && def->ns.format) {
if ((def->ns.format)(buf, def->namespaceData) < 0)
- goto error;
+ return -1;
}
virBufferAdjustIndent(buf, -2);
virBufferAsprintf(buf, "</%s>\n", rootname);
return 0;
-
- error:
- return -1;
}
+
/* Converts VIR_DOMAIN_XML_COMMON_FLAGS into VIR_DOMAIN_DEF_FORMAT_*
* flags, and silently ignores any other flags. Note that the caller
* should validate the set of flags it is willing to accept; see also