mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
snapshot: minor cleanups from reviewing indentation
Break some long lines, and use more efficient functions when possible, such as relying on virBufferEscapeString to skip output on a NULL arg. Ensure that output does not embed newlines, since auto-indent won't work in those situations. * src/conf/domain_conf.c (virDomainTimerDefFormat): Break output lines. (virDomainDefFormatInternal, virDomainDiskDefFormat) (virDomainActualNetDefFormat, virDomainNetDefFormat) (virDomainHostdevDefFormat): Minor cleanups.
This commit is contained in:
parent
4d8e20f6c2
commit
cfa61a950a
@ -9245,7 +9245,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
if (def->driverName || def->driverType || def->cachemode ||
|
if (def->driverName || def->driverType || def->cachemode ||
|
||||||
def->ioeventfd || def->event_idx) {
|
def->ioeventfd || def->event_idx) {
|
||||||
virBufferAsprintf(buf, " <driver");
|
virBufferAddLit(buf, " <driver");
|
||||||
if (def->driverName)
|
if (def->driverName)
|
||||||
virBufferAsprintf(buf, " name='%s'", def->driverName);
|
virBufferAsprintf(buf, " name='%s'", def->driverName);
|
||||||
if (def->driverType)
|
if (def->driverType)
|
||||||
@ -9262,7 +9262,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
|||||||
virBufferAsprintf(buf, " ioeventfd='%s'", ioeventfd);
|
virBufferAsprintf(buf, " ioeventfd='%s'", ioeventfd);
|
||||||
if (def->event_idx)
|
if (def->event_idx)
|
||||||
virBufferAsprintf(buf, " event_idx='%s'", event_idx);
|
virBufferAsprintf(buf, " event_idx='%s'", event_idx);
|
||||||
virBufferAsprintf(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->src || def->nhosts > 0 ||
|
if (def->src || def->nhosts > 0 ||
|
||||||
@ -9292,18 +9292,18 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
|||||||
virBufferEscapeString(buf, " name='%s'", def->src);
|
virBufferEscapeString(buf, " name='%s'", def->src);
|
||||||
}
|
}
|
||||||
if (def->nhosts == 0) {
|
if (def->nhosts == 0) {
|
||||||
virBufferAsprintf(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
virBufferAsprintf(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
for (i = 0; i < def->nhosts; i++) {
|
for (i = 0; i < def->nhosts; i++) {
|
||||||
virBufferEscapeString(buf, " <host name='%s'",
|
virBufferEscapeString(buf, " <host name='%s'",
|
||||||
def->hosts[i].name);
|
def->hosts[i].name);
|
||||||
virBufferEscapeString(buf, " port='%s'/>\n",
|
virBufferEscapeString(buf, " port='%s'/>\n",
|
||||||
def->hosts[i].port);
|
def->hosts[i].port);
|
||||||
}
|
}
|
||||||
virBufferAsprintf(buf, " </source>\n");
|
virBufferAddLit(buf, " </source>\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -9325,9 +9325,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, " <shareable/>\n");
|
virBufferAddLit(buf, " <shareable/>\n");
|
||||||
if (def->transient)
|
if (def->transient)
|
||||||
virBufferAddLit(buf, " <transient/>\n");
|
virBufferAddLit(buf, " <transient/>\n");
|
||||||
if (def->serial)
|
virBufferEscapeString(buf, " <serial>%s</serial>\n", def->serial);
|
||||||
virBufferEscapeString(buf, " <serial>%s</serial>\n",
|
|
||||||
def->serial);
|
|
||||||
if (def->encryption) {
|
if (def->encryption) {
|
||||||
virBufferAdjustIndent(buf, 6);
|
virBufferAdjustIndent(buf, 6);
|
||||||
if (virStorageEncryptionFormat(buf, def->encryption) < 0)
|
if (virStorageEncryptionFormat(buf, def->encryption) < 0)
|
||||||
@ -9511,10 +9509,8 @@ virDomainActualNetDefFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
switch (def->type) {
|
switch (def->type) {
|
||||||
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||||
if (def->data.bridge.brname) {
|
virBufferEscapeString(buf, " <source bridge='%s'/>\n",
|
||||||
virBufferEscapeString(buf, " <source bridge='%s'/>\n",
|
def->data.bridge.brname);
|
||||||
def->data.bridge.brname);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
case VIR_DOMAIN_NET_TYPE_DIRECT:
|
||||||
@ -9575,10 +9571,8 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|||||||
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
||||||
virBufferEscapeString(buf, " <source network='%s'",
|
virBufferEscapeString(buf, " <source network='%s'",
|
||||||
def->data.network.name);
|
def->data.network.name);
|
||||||
if (def->data.network.portgroup) {
|
virBufferEscapeString(buf, " portgroup='%s'",
|
||||||
virBufferEscapeString(buf, " portgroup='%s'",
|
def->data.network.portgroup);
|
||||||
def->data.network.portgroup);
|
|
||||||
}
|
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
virBufferAdjustIndent(buf, 6);
|
virBufferAdjustIndent(buf, 6);
|
||||||
virVirtualPortProfileFormat(buf, def->data.network.virtPortProfile);
|
virVirtualPortProfileFormat(buf, def->data.network.virtPortProfile);
|
||||||
@ -9589,15 +9583,13 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||||
if (def->data.ethernet.dev)
|
virBufferEscapeString(buf, " <source dev='%s'/>\n",
|
||||||
virBufferEscapeString(buf, " <source dev='%s'/>\n",
|
def->data.ethernet.dev);
|
||||||
def->data.ethernet.dev);
|
|
||||||
if (def->data.ethernet.ipaddr)
|
if (def->data.ethernet.ipaddr)
|
||||||
virBufferAsprintf(buf, " <ip address='%s'/>\n",
|
virBufferAsprintf(buf, " <ip address='%s'/>\n",
|
||||||
def->data.ethernet.ipaddr);
|
def->data.ethernet.ipaddr);
|
||||||
if (def->data.ethernet.script)
|
virBufferEscapeString(buf, " <script path='%s'/>\n",
|
||||||
virBufferEscapeString(buf, " <script path='%s'/>\n",
|
def->data.ethernet.script);
|
||||||
def->data.ethernet.script);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||||
@ -9606,9 +9598,8 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|||||||
if (def->data.bridge.ipaddr)
|
if (def->data.bridge.ipaddr)
|
||||||
virBufferAsprintf(buf, " <ip address='%s'/>\n",
|
virBufferAsprintf(buf, " <ip address='%s'/>\n",
|
||||||
def->data.bridge.ipaddr);
|
def->data.bridge.ipaddr);
|
||||||
if (def->data.bridge.script)
|
virBufferEscapeString(buf, " <script path='%s'/>\n",
|
||||||
virBufferEscapeString(buf, " <script path='%s'/>\n",
|
def->data.bridge.script);
|
||||||
def->data.bridge.script);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||||
@ -9631,7 +9622,7 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|||||||
virBufferEscapeString(buf, " <source dev='%s'",
|
virBufferEscapeString(buf, " <source dev='%s'",
|
||||||
def->data.direct.linkdev);
|
def->data.direct.linkdev);
|
||||||
virBufferAsprintf(buf, " mode='%s'",
|
virBufferAsprintf(buf, " mode='%s'",
|
||||||
virMacvtapModeTypeToString(def->data.direct.mode));
|
virMacvtapModeTypeToString(def->data.direct.mode));
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
virBufferAdjustIndent(buf, 6);
|
virBufferAdjustIndent(buf, 6);
|
||||||
virVirtualPortProfileFormat(buf, def->data.direct.virtPortProfile);
|
virVirtualPortProfileFormat(buf, def->data.direct.virtPortProfile);
|
||||||
@ -9688,7 +9679,8 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
if (def->tune.sndbuf_specified) {
|
if (def->tune.sndbuf_specified) {
|
||||||
virBufferAddLit(buf, " <tune>\n");
|
virBufferAddLit(buf, " <tune>\n");
|
||||||
virBufferAsprintf(buf, " <sndbuf>%lu</sndbuf>\n", def->tune.sndbuf);
|
virBufferAsprintf(buf, " <sndbuf>%lu</sndbuf>\n",
|
||||||
|
def->tune.sndbuf);
|
||||||
virBufferAddLit(buf, " </tune>\n");
|
virBufferAddLit(buf, " </tune>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9726,7 +9718,7 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compat with legacy <console tty='/dev/pts/5'/> syntax */
|
/* Compat with legacy <console tty='/dev/pts/5'/> syntax */
|
||||||
virBufferAsprintf(buf, " type='%s'", type);
|
virBufferAsprintf(buf, " type='%s'", type);
|
||||||
if (tty_compat) {
|
if (tty_compat) {
|
||||||
virBufferEscapeString(buf, " tty='%s'",
|
virBufferEscapeString(buf, " tty='%s'",
|
||||||
@ -9897,8 +9889,7 @@ virDomainChrDefFormat(virBufferPtr buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(buf, " </%s>\n",
|
virBufferAsprintf(buf, " </%s>\n", elementName);
|
||||||
elementName);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -9932,9 +9923,8 @@ virDomainSmartcardDefFormat(virBufferPtr buf,
|
|||||||
for (i = 0; i < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; i++)
|
for (i = 0; i < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; i++)
|
||||||
virBufferEscapeString(buf, " <certificate>%s</certificate>\n",
|
virBufferEscapeString(buf, " <certificate>%s</certificate>\n",
|
||||||
def->data.cert.file[i]);
|
def->data.cert.file[i]);
|
||||||
if (def->data.cert.database)
|
virBufferEscapeString(buf, " <database>%s</database>\n",
|
||||||
virBufferEscapeString(buf, " <database>%s</database>\n",
|
def->data.cert.database);
|
||||||
def->data.cert.database);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
|
case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
|
||||||
@ -9967,8 +9957,7 @@ virDomainSoundDefFormat(virBufferPtr buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(buf, " <sound model='%s'",
|
virBufferAsprintf(buf, " <sound model='%s'", model);
|
||||||
model);
|
|
||||||
|
|
||||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
@ -9996,8 +9985,7 @@ virDomainMemballoonDefFormat(virBufferPtr buf,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(buf, " <memballoon model='%s'",
|
virBufferAsprintf(buf, " <memballoon model='%s'", model);
|
||||||
model);
|
|
||||||
|
|
||||||
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
if (virDomainDeviceInfoIsSet(&def->info, flags)) {
|
||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
@ -10211,7 +10199,8 @@ virDomainTimerDefFormat(virBufferPtr buf,
|
|||||||
&& (def->catchup.limit == 0)) {
|
&& (def->catchup.limit == 0)) {
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
} else {
|
} else {
|
||||||
virBufferAddLit(buf, ">\n <catchup ");
|
virBufferAddLit(buf, ">\n");
|
||||||
|
virBufferAddLit(buf, " <catchup ");
|
||||||
if (def->catchup.threshold > 0) {
|
if (def->catchup.threshold > 0) {
|
||||||
virBufferAsprintf(buf, " threshold='%lu'", def->catchup.threshold);
|
virBufferAsprintf(buf, " threshold='%lu'", def->catchup.threshold);
|
||||||
}
|
}
|
||||||
@ -10221,7 +10210,8 @@ virDomainTimerDefFormat(virBufferPtr buf,
|
|||||||
if (def->catchup.limit > 0) {
|
if (def->catchup.limit > 0) {
|
||||||
virBufferAsprintf(buf, " limit='%lu'", def->catchup.limit);
|
virBufferAsprintf(buf, " limit='%lu'", def->catchup.limit);
|
||||||
}
|
}
|
||||||
virBufferAddLit(buf, "/>\n </timer>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
|
virBufferAddLit(buf, " </timer>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -10509,7 +10499,8 @@ virDomainHostdevDefFormat(virBufferPtr buf,
|
|||||||
def->source.subsys.u.usb.bus,
|
def->source.subsys.u.usb.bus,
|
||||||
def->source.subsys.u.usb.device);
|
def->source.subsys.u.usb.device);
|
||||||
} else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
} else if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
||||||
virBufferAsprintf(buf, " <address domain='0x%.4x' bus='0x%.2x' slot='0x%.2x' function='0x%.1x'/>\n",
|
virBufferAsprintf(buf, " <address domain='0x%.4x' bus='0x%.2x' "
|
||||||
|
"slot='0x%.2x' function='0x%.1x'/>\n",
|
||||||
def->source.subsys.u.pci.domain,
|
def->source.subsys.u.pci.domain,
|
||||||
def->source.subsys.u.pci.bus,
|
def->source.subsys.u.pci.bus,
|
||||||
def->source.subsys.u.pci.slot,
|
def->source.subsys.u.pci.slot,
|
||||||
@ -10562,8 +10553,8 @@ virDomainRedirdevDefFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainHubDefFormat(virBufferPtr buf,
|
virDomainHubDefFormat(virBufferPtr buf,
|
||||||
virDomainHubDefPtr def,
|
virDomainHubDefPtr def,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
const char *type = virDomainHubTypeToString(def->type);
|
const char *type = virDomainHubTypeToString(def->type);
|
||||||
|
|
||||||
@ -10638,9 +10629,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
virUUIDFormat(uuid, uuidstr);
|
virUUIDFormat(uuid, uuidstr);
|
||||||
virBufferAsprintf(buf, " <uuid>%s</uuid>\n", uuidstr);
|
virBufferAsprintf(buf, " <uuid>%s</uuid>\n", uuidstr);
|
||||||
|
|
||||||
if (def->description)
|
virBufferEscapeString(buf, " <description>%s</description>\n",
|
||||||
virBufferEscapeString(buf, " <description>%s</description>\n",
|
def->description);
|
||||||
def->description);
|
|
||||||
|
|
||||||
virBufferAsprintf(buf, " <memory>%lu</memory>\n", def->mem.max_balloon);
|
virBufferAsprintf(buf, " <memory>%lu</memory>\n", def->mem.max_balloon);
|
||||||
virBufferAsprintf(buf, " <currentMemory>%lu</currentMemory>\n",
|
virBufferAsprintf(buf, " <currentMemory>%lu</currentMemory>\n",
|
||||||
@ -10648,16 +10638,16 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
|
|
||||||
/* add blkiotune only if there are any */
|
/* add blkiotune only if there are any */
|
||||||
if (def->blkio.weight) {
|
if (def->blkio.weight) {
|
||||||
virBufferAsprintf(buf, " <blkiotune>\n");
|
virBufferAddLit(buf, " <blkiotune>\n");
|
||||||
virBufferAsprintf(buf, " <weight>%u</weight>\n",
|
virBufferAsprintf(buf, " <weight>%u</weight>\n",
|
||||||
def->blkio.weight);
|
def->blkio.weight);
|
||||||
virBufferAsprintf(buf, " </blkiotune>\n");
|
virBufferAddLit(buf, " </blkiotune>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add memtune only if there are any */
|
/* add memtune only if there are any */
|
||||||
if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
|
if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
|
||||||
def->mem.swap_hard_limit)
|
def->mem.swap_hard_limit)
|
||||||
virBufferAsprintf(buf, " <memtune>\n");
|
virBufferAddLit(buf, " <memtune>\n");
|
||||||
if (def->mem.hard_limit) {
|
if (def->mem.hard_limit) {
|
||||||
virBufferAsprintf(buf, " <hard_limit>%lu</hard_limit>\n",
|
virBufferAsprintf(buf, " <hard_limit>%lu</hard_limit>\n",
|
||||||
def->mem.hard_limit);
|
def->mem.hard_limit);
|
||||||
@ -10676,12 +10666,13 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
|
if (def->mem.hard_limit || def->mem.soft_limit || def->mem.min_guarantee ||
|
||||||
def->mem.swap_hard_limit)
|
def->mem.swap_hard_limit)
|
||||||
virBufferAsprintf(buf, " </memtune>\n");
|
virBufferAddLit(buf, " </memtune>\n");
|
||||||
|
|
||||||
if (def->mem.hugepage_backed) {
|
if (def->mem.hugepage_backed) {
|
||||||
virBufferAddLit(buf, " <memoryBacking>\n");
|
virBufferStrcat(buf,
|
||||||
virBufferAddLit(buf, " <hugepages/>\n");
|
" <memoryBacking>\n",
|
||||||
virBufferAddLit(buf, " </memoryBacking>\n");
|
" <hugepages/>\n",
|
||||||
|
" </memoryBacking>\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n = 0 ; n < def->cpumasklen ; n++)
|
for (n = 0 ; n < def->cpumasklen ; n++)
|
||||||
@ -10739,27 +10730,25 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
def->cputune.period || def->cputune.quota)
|
def->cputune.period || def->cputune.quota)
|
||||||
virBufferAddLit(buf, " </cputune>\n");
|
virBufferAddLit(buf, " </cputune>\n");
|
||||||
|
|
||||||
if (def->numatune.memory.nodemask)
|
|
||||||
virBufferAddLit(buf, " <numatune>\n");
|
|
||||||
|
|
||||||
if (def->numatune.memory.nodemask) {
|
if (def->numatune.memory.nodemask) {
|
||||||
|
const char *mode;
|
||||||
char *nodemask = NULL;
|
char *nodemask = NULL;
|
||||||
|
|
||||||
|
virBufferAddLit(buf, " <numatune>\n");
|
||||||
nodemask = virDomainCpuSetFormat(def->numatune.memory.nodemask,
|
nodemask = virDomainCpuSetFormat(def->numatune.memory.nodemask,
|
||||||
VIR_DOMAIN_CPUMASK_LEN);
|
VIR_DOMAIN_CPUMASK_LEN);
|
||||||
if (nodemask == NULL) {
|
if (nodemask == NULL) {
|
||||||
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
"%s", _("failed to format nodeset for NUMA memory tuning"));
|
_("failed to format nodeset for NUMA memory tuning"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode = virDomainNumatuneMemModeTypeToString(def->numatune.memory.mode);
|
||||||
virBufferAsprintf(buf, " <memory mode='%s' nodeset='%s'/>\n",
|
virBufferAsprintf(buf, " <memory mode='%s' nodeset='%s'/>\n",
|
||||||
virDomainNumatuneMemModeTypeToString(def->numatune.memory.mode),
|
mode, nodemask);
|
||||||
nodemask);
|
|
||||||
VIR_FREE(nodemask);
|
VIR_FREE(nodemask);
|
||||||
}
|
|
||||||
|
|
||||||
if (def->numatune.memory.nodemask)
|
|
||||||
virBufferAddLit(buf, " </numatune>\n");
|
virBufferAddLit(buf, " </numatune>\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (def->sysinfo)
|
if (def->sysinfo)
|
||||||
virDomainSysinfoDefFormat(buf, def->sysinfo);
|
virDomainSysinfoDefFormat(buf, def->sysinfo);
|
||||||
@ -10767,12 +10756,12 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
if (def->os.bootloader) {
|
if (def->os.bootloader) {
|
||||||
virBufferEscapeString(buf, " <bootloader>%s</bootloader>\n",
|
virBufferEscapeString(buf, " <bootloader>%s</bootloader>\n",
|
||||||
def->os.bootloader);
|
def->os.bootloader);
|
||||||
if (def->os.bootloaderArgs)
|
virBufferEscapeString(buf,
|
||||||
virBufferEscapeString(buf, " <bootloader_args>%s</bootloader_args>\n",
|
" <bootloader_args>%s</bootloader_args>\n",
|
||||||
def->os.bootloaderArgs);
|
def->os.bootloaderArgs);
|
||||||
}
|
}
|
||||||
virBufferAddLit(buf, " <os>\n");
|
|
||||||
|
|
||||||
|
virBufferAddLit(buf, " <os>\n");
|
||||||
virBufferAddLit(buf, " <type");
|
virBufferAddLit(buf, " <type");
|
||||||
if (def->os.arch)
|
if (def->os.arch)
|
||||||
virBufferAsprintf(buf, " arch='%s'", def->os.arch);
|
virBufferAsprintf(buf, " arch='%s'", def->os.arch);
|
||||||
@ -10789,24 +10778,18 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
else
|
else
|
||||||
virBufferAsprintf(buf, ">%s</type>\n", def->os.type);
|
virBufferAsprintf(buf, ">%s</type>\n", def->os.type);
|
||||||
|
|
||||||
if (def->os.init)
|
virBufferEscapeString(buf, " <init>%s</init>\n",
|
||||||
virBufferEscapeString(buf, " <init>%s</init>\n",
|
def->os.init);
|
||||||
def->os.init);
|
virBufferEscapeString(buf, " <loader>%s</loader>\n",
|
||||||
if (def->os.loader)
|
def->os.loader);
|
||||||
virBufferEscapeString(buf, " <loader>%s</loader>\n",
|
virBufferEscapeString(buf, " <kernel>%s</kernel>\n",
|
||||||
def->os.loader);
|
def->os.kernel);
|
||||||
if (def->os.kernel)
|
virBufferEscapeString(buf, " <initrd>%s</initrd>\n",
|
||||||
virBufferEscapeString(buf, " <kernel>%s</kernel>\n",
|
def->os.initrd);
|
||||||
def->os.kernel);
|
virBufferEscapeString(buf, " <cmdline>%s</cmdline>\n",
|
||||||
if (def->os.initrd)
|
def->os.cmdline);
|
||||||
virBufferEscapeString(buf, " <initrd>%s</initrd>\n",
|
virBufferEscapeString(buf, " <root>%s</root>\n",
|
||||||
def->os.initrd);
|
def->os.root);
|
||||||
if (def->os.cmdline)
|
|
||||||
virBufferEscapeString(buf, " <cmdline>%s</cmdline>\n",
|
|
||||||
def->os.cmdline);
|
|
||||||
if (def->os.root)
|
|
||||||
virBufferEscapeString(buf, " <root>%s</root>\n",
|
|
||||||
def->os.root);
|
|
||||||
|
|
||||||
if (!def->os.bootloader) {
|
if (!def->os.bootloader) {
|
||||||
for (n = 0 ; n < def->os.nBootDevs ; n++) {
|
for (n = 0 ; n < def->os.nBootDevs ; n++) {
|
||||||
@ -10876,7 +10859,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
virDomainClockOffsetTypeToString(def->clock.offset));
|
virDomainClockOffsetTypeToString(def->clock.offset));
|
||||||
switch (def->clock.offset) {
|
switch (def->clock.offset) {
|
||||||
case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
|
case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
|
||||||
virBufferAsprintf(buf, " adjustment='%lld'", def->clock.data.adjustment);
|
virBufferAsprintf(buf, " adjustment='%lld'",
|
||||||
|
def->clock.data.adjustment);
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE:
|
case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE:
|
||||||
virBufferEscapeString(buf, " timezone='%s'", def->clock.data.timezone);
|
virBufferEscapeString(buf, " timezone='%s'", def->clock.data.timezone);
|
||||||
@ -10908,9 +10892,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
|
|
||||||
virBufferAddLit(buf, " <devices>\n");
|
virBufferAddLit(buf, " <devices>\n");
|
||||||
|
|
||||||
if (def->emulator)
|
virBufferEscapeString(buf, " <emulator>%s</emulator>\n",
|
||||||
virBufferEscapeString(buf, " <emulator>%s</emulator>\n",
|
def->emulator);
|
||||||
def->emulator);
|
|
||||||
|
|
||||||
for (n = 0 ; n < def->ndisks ; n++)
|
for (n = 0 ; n < def->ndisks ; n++)
|
||||||
if (virDomainDiskDefFormat(buf, def->disks[n], flags) < 0)
|
if (virDomainDiskDefFormat(buf, def->disks[n], flags) < 0)
|
||||||
@ -11006,10 +10989,10 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (def->watchdog)
|
if (def->watchdog)
|
||||||
virDomainWatchdogDefFormat (buf, def->watchdog, flags);
|
virDomainWatchdogDefFormat(buf, def->watchdog, flags);
|
||||||
|
|
||||||
if (def->memballoon)
|
if (def->memballoon)
|
||||||
virDomainMemballoonDefFormat (buf, def->memballoon, flags);
|
virDomainMemballoonDefFormat(buf, def->memballoon, flags);
|
||||||
|
|
||||||
virBufferAddLit(buf, " </devices>\n");
|
virBufferAddLit(buf, " </devices>\n");
|
||||||
|
|
||||||
@ -11023,18 +11006,19 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
(flags & VIR_DOMAIN_XML_INACTIVE)) {
|
(flags & VIR_DOMAIN_XML_INACTIVE)) {
|
||||||
/* This is the default for inactive xml, so nothing to output. */
|
/* This is the default for inactive xml, so nothing to output. */
|
||||||
} else {
|
} else {
|
||||||
virBufferAsprintf(buf, " <seclabel type='%s' model='%s' relabel='%s'>\n",
|
virBufferAsprintf(buf, " <seclabel type='%s' model='%s' "
|
||||||
|
"relabel='%s'>\n",
|
||||||
sectype, def->seclabel.model,
|
sectype, def->seclabel.model,
|
||||||
def->seclabel.norelabel ? "no" : "yes");
|
def->seclabel.norelabel ? "no" : "yes");
|
||||||
if (def->seclabel.label)
|
virBufferEscapeString(buf, " <label>%s</label>\n",
|
||||||
virBufferEscapeString(buf, " <label>%s</label>\n",
|
def->seclabel.label);
|
||||||
def->seclabel.label);
|
if (!def->seclabel.norelabel)
|
||||||
if (!def->seclabel.norelabel && def->seclabel.imagelabel)
|
virBufferEscapeString(buf,
|
||||||
virBufferEscapeString(buf, " <imagelabel>%s</imagelabel>\n",
|
" <imagelabel>%s</imagelabel>\n",
|
||||||
def->seclabel.imagelabel);
|
def->seclabel.imagelabel);
|
||||||
if (def->seclabel.baselabel &&
|
if (def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC)
|
||||||
(def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC))
|
virBufferEscapeString(buf,
|
||||||
virBufferEscapeString(buf, " <baselabel>%s</baselabel>\n",
|
" <baselabel>%s</baselabel>\n",
|
||||||
def->seclabel.baselabel);
|
def->seclabel.baselabel);
|
||||||
virBufferAddLit(buf, " </seclabel>\n");
|
virBufferAddLit(buf, " </seclabel>\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user