mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
get rid of virBufferAsprintf where possible
Use virBufferAddLit or virBufferAddChar instead.
This commit is contained in:
parent
8cd40e7e0d
commit
dcea5a492f
@ -13255,7 +13255,7 @@ static void
|
||||
virSecurityDeviceLabelDefFormat(virBufferPtr buf,
|
||||
virSecurityDeviceLabelDefPtr def)
|
||||
{
|
||||
virBufferAsprintf(buf, "<seclabel");
|
||||
virBufferAddLit(buf, "<seclabel");
|
||||
|
||||
if (def->model)
|
||||
virBufferAsprintf(buf, " model='%s'", def->model);
|
||||
@ -13542,9 +13542,9 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, " <auth username='%s'>\n",
|
||||
def->auth.username);
|
||||
if (def->protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI) {
|
||||
virBufferAsprintf(buf, " <secret type='iscsi'");
|
||||
virBufferAddLit(buf, " <secret type='iscsi'");
|
||||
} else if (def->protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
|
||||
virBufferAsprintf(buf, " <secret type='ceph'");
|
||||
virBufferAddLit(buf, " <secret type='ceph'");
|
||||
}
|
||||
|
||||
if (def->auth.secretType == VIR_DOMAIN_DISK_SECRET_TYPE_UUID) {
|
||||
@ -15010,13 +15010,13 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, " port='0'");
|
||||
|
||||
if (def->data.rdp.autoport)
|
||||
virBufferAsprintf(buf, " autoport='yes'");
|
||||
virBufferAddLit(buf, " autoport='yes'");
|
||||
|
||||
if (def->data.rdp.replaceUser)
|
||||
virBufferAsprintf(buf, " replaceUser='yes'");
|
||||
virBufferAddLit(buf, " replaceUser='yes'");
|
||||
|
||||
if (def->data.rdp.multiUser)
|
||||
virBufferAsprintf(buf, " multiUser='yes'");
|
||||
virBufferAddLit(buf, " multiUser='yes'");
|
||||
|
||||
if (listenAddr)
|
||||
virBufferAsprintf(buf, " listen='%s'", listenAddr);
|
||||
@ -15536,7 +15536,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
|
||||
if (def->cputune.emulatorpin) {
|
||||
char *cpumask;
|
||||
virBufferAsprintf(buf, " <emulatorpin ");
|
||||
virBufferAddLit(buf, " <emulatorpin ");
|
||||
|
||||
if (!(cpumask = virBitmapFormat(def->cputune.emulatorpin->cpumask))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -2011,7 +2011,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
|
||||
if (def->srvs[i].weight)
|
||||
virBufferAsprintf(buf, " weight='%d'", def->srvs[i].weight);
|
||||
|
||||
virBufferAsprintf(buf, "/>\n");
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2028,7 +2028,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
|
||||
def->hosts[ii].names[j]);
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAsprintf(buf, "</host>\n");
|
||||
virBufferAddLit(buf, "</host>\n");
|
||||
VIR_FREE(ip);
|
||||
}
|
||||
}
|
||||
|
@ -1092,7 +1092,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
|
||||
virBufferAsprintf(buf," <auth username='%s' type='ceph'>\n",
|
||||
src->auth.cephx.username);
|
||||
|
||||
virBufferAsprintf(buf," %s", "<secret");
|
||||
virBufferAddLit(buf," <secret");
|
||||
if (src->auth.cephx.secret.uuidUsable) {
|
||||
virUUIDFormat(src->auth.cephx.secret.uuid, uuid);
|
||||
virBufferAsprintf(buf," uuid='%s'", uuid);
|
||||
@ -1101,9 +1101,9 @@ virStoragePoolSourceFormat(virBufferPtr buf,
|
||||
if (src->auth.cephx.secret.usage != NULL) {
|
||||
virBufferAsprintf(buf," usage='%s'", src->auth.cephx.secret.usage);
|
||||
}
|
||||
virBufferAsprintf(buf,"%s", "/>\n");
|
||||
virBufferAddLit(buf,"/>\n");
|
||||
|
||||
virBufferAsprintf(buf," %s", "</auth>\n");
|
||||
virBufferAddLit(buf," </auth>\n");
|
||||
}
|
||||
|
||||
if (src->vendor != NULL) {
|
||||
|
@ -417,7 +417,7 @@ learnIPAddressThread(void *arg)
|
||||
req->status = EINVAL;
|
||||
goto done;
|
||||
}
|
||||
virBufferAsprintf(&buf, "src port 67 and dst port 68");
|
||||
virBufferAddLit(&buf, "src port 67 and dst port 68");
|
||||
break;
|
||||
default:
|
||||
if (techdriver->applyBasicRules(req->ifname,
|
||||
|
@ -1684,12 +1684,12 @@ phypGetVIOSFreeSCSIAdapter(virConnectPtr conn)
|
||||
virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '",
|
||||
managed_system, vios_id);
|
||||
|
||||
virBufferAsprintf(&buf, "lsmap -all -field svsa backing -fmt , ");
|
||||
virBufferAddLit(&buf, "lsmap -all -field svsa backing -fmt , ");
|
||||
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed '/,[^.*]/d; s/,//g; q'");
|
||||
virBufferAddLit(&buf, "|sed '/,[^.*]/d; s/,//g; q'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
|
||||
|
||||
if (exit_status < 0)
|
||||
@ -1882,7 +1882,7 @@ phypStorageVolGetKey(virConnectPtr conn, const char *name)
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed -e 's/^LV IDENTIFIER://' -e 's/ //g'");
|
||||
virBufferAddLit(&buf, "|sed -e 's/^LV IDENTIFIER://' -e 's/ //g'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
|
||||
|
||||
if (exit_status < 0)
|
||||
@ -1912,7 +1912,7 @@ phypGetStoragePoolDevice(virConnectPtr conn, char *name)
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed '1d; s/ //g'");
|
||||
virBufferAddLit(&buf, "|sed '1d; s/ //g'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
|
||||
|
||||
if (exit_status < 0)
|
||||
@ -1941,7 +1941,7 @@ phypGetStoragePoolSize(virConnectPtr conn, char *name)
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed '1d; s/ //g'");
|
||||
virBufferAddLit(&buf, "|sed '1d; s/ //g'");
|
||||
phypExecInt(session, &buf, conn, &sp_size);
|
||||
return sp_size;
|
||||
}
|
||||
@ -2123,7 +2123,7 @@ phypStorageVolGetPhysicalVolumeByStoragePool(virStorageVolPtr vol, char *sp)
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed 1d");
|
||||
virBufferAddLit(&buf, "|sed 1d");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
|
||||
|
||||
if (exit_status < 0)
|
||||
@ -2155,7 +2155,7 @@ phypStorageVolLookupByPath(virConnectPtr conn, const char *volname)
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'");
|
||||
virBufferAddLit(&buf, "|sed -e 's/^VOLUME GROUP://g' -e 's/ //g'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, true);
|
||||
|
||||
if (exit_status < 0 || ret == NULL)
|
||||
@ -2199,7 +2199,7 @@ phypGetStoragePoolUUID(virConnectPtr conn, unsigned char *uuid,
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed '1,2d'");
|
||||
virBufferAddLit(&buf, "|sed '1,2d'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
|
||||
|
||||
if (exit_status < 0 || ret == NULL)
|
||||
@ -2385,7 +2385,7 @@ phypStoragePoolListVolumes(virStoragePoolPtr pool, char **const volumes,
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|sed '1,2d'");
|
||||
virBufferAddLit(&buf, "|sed '1,2d'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
|
||||
|
||||
/* I need to parse the textual return in order to get the volumes */
|
||||
@ -2442,7 +2442,7 @@ phypStoragePoolNumOfVolumes(virStoragePoolPtr pool)
|
||||
virBufferAsprintf(&buf, "lsvg -lv %s -field lvname", pool->name);
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
virBufferAsprintf(&buf, "|grep -c '^.*$'");
|
||||
virBufferAddLit(&buf, "|grep -c '^.*$'");
|
||||
if (phypExecInt(session, &buf, conn, &nvolumes) < 0)
|
||||
return -1;
|
||||
|
||||
@ -2551,12 +2551,12 @@ phypConnectNumOfStoragePools(virConnectPtr conn)
|
||||
virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '",
|
||||
managed_system, vios_id);
|
||||
|
||||
virBufferAsprintf(&buf, "lsvg");
|
||||
virBufferAddLit(&buf, "lsvg");
|
||||
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
|
||||
virBufferAsprintf(&buf, "|grep -c '^.*$'");
|
||||
virBufferAddLit(&buf, "|grep -c '^.*$'");
|
||||
phypExecInt(session, &buf, conn, &nsp);
|
||||
return nsp;
|
||||
}
|
||||
@ -2583,7 +2583,7 @@ phypConnectListStoragePools(virConnectPtr conn, char **const pools, int npools)
|
||||
virBufferAsprintf(&buf, "viosvrcmd -m %s --id %d -c '",
|
||||
managed_system, vios_id);
|
||||
|
||||
virBufferAsprintf(&buf, "lsvg");
|
||||
virBufferAddLit(&buf, "lsvg");
|
||||
|
||||
if (system_type == HMC)
|
||||
virBufferAddChar(&buf, '\'');
|
||||
@ -3219,7 +3219,7 @@ phypConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames
|
||||
virBufferAddLit(&buf, "lssyscfg -r lpar");
|
||||
if (system_type == HMC)
|
||||
virBufferAsprintf(&buf, " -m %s", managed_system);
|
||||
virBufferAsprintf(&buf, " -F name,state"
|
||||
virBufferAddLit(&buf, " -F name,state"
|
||||
"|sed -n '/Not Activated/ {\n s/,.*$//\n p\n}'");
|
||||
ret = phypExecBuffer(session, &buf, &exit_status, conn, false);
|
||||
|
||||
|
@ -2226,7 +2226,7 @@ static void
|
||||
qemuUsbId(virBufferPtr buf, int idx)
|
||||
{
|
||||
if (idx == 0)
|
||||
virBufferAsprintf(buf, "usb");
|
||||
virBufferAddLit(buf, "usb");
|
||||
else
|
||||
virBufferAsprintf(buf, "usb%d", idx);
|
||||
}
|
||||
@ -2271,9 +2271,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
||||
}
|
||||
} else {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS))
|
||||
virBufferAsprintf(buf, ",bus=pci.0");
|
||||
virBufferAddLit(buf, ",bus=pci.0");
|
||||
else
|
||||
virBufferAsprintf(buf, ",bus=pci");
|
||||
virBufferAddLit(buf, ",bus=pci");
|
||||
}
|
||||
if (info->addr.pci.multi == VIR_DEVICE_ADDRESS_PCI_MULTI_ON)
|
||||
virBufferAddLit(buf, ",multifunction=on");
|
||||
@ -2283,7 +2283,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
||||
if (info->addr.pci.function != 0)
|
||||
virBufferAsprintf(buf, ".0x%x", info->addr.pci.function);
|
||||
} else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
|
||||
virBufferAsprintf(buf, ",bus=");
|
||||
virBufferAddLit(buf, ",bus=");
|
||||
qemuUsbId(buf, info->addr.usb.bus);
|
||||
virBufferAsprintf(buf, ".0,port=%s", info->addr.usb.port);
|
||||
} else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
|
||||
@ -3818,11 +3818,11 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
|
||||
virBufferAsprintf(buf, "%s", smodel);
|
||||
|
||||
if (def->info.mastertype == VIR_DOMAIN_CONTROLLER_MASTER_USB) {
|
||||
virBufferAsprintf(buf, ",masterbus=");
|
||||
virBufferAddLit(buf, ",masterbus=");
|
||||
qemuUsbId(buf, def->idx);
|
||||
virBufferAsprintf(buf, ".0,firstport=%d", def->info.master.usb.startport);
|
||||
} else {
|
||||
virBufferAsprintf(buf, ",id=");
|
||||
virBufferAddLit(buf, ",id=");
|
||||
qemuUsbId(buf, def->idx);
|
||||
}
|
||||
|
||||
@ -4567,33 +4567,33 @@ qemuBuildRedirdevDevStr(virDomainDefPtr def,
|
||||
goto error;
|
||||
}
|
||||
|
||||
virBufferAsprintf(&buf, ",filter=");
|
||||
virBufferAddLit(&buf, ",filter=");
|
||||
|
||||
for (i = 0; i < redirfilter->nusbdevs; i++) {
|
||||
virDomainRedirFilterUsbDevDefPtr usbdev = redirfilter->usbdevs[i];
|
||||
if (usbdev->usbClass >= 0)
|
||||
virBufferAsprintf(&buf, "0x%02X:", usbdev->usbClass);
|
||||
else
|
||||
virBufferAsprintf(&buf, "-1:");
|
||||
virBufferAddLit(&buf, "-1:");
|
||||
|
||||
if (usbdev->vendor >= 0)
|
||||
virBufferAsprintf(&buf, "0x%04X:", usbdev->vendor);
|
||||
else
|
||||
virBufferAsprintf(&buf, "-1:");
|
||||
virBufferAddLit(&buf, "-1:");
|
||||
|
||||
if (usbdev->product >= 0)
|
||||
virBufferAsprintf(&buf, "0x%04X:", usbdev->product);
|
||||
else
|
||||
virBufferAsprintf(&buf, "-1:");
|
||||
virBufferAddLit(&buf, "-1:");
|
||||
|
||||
if (usbdev->version >= 0)
|
||||
virBufferAsprintf(&buf, "0x%04X:", usbdev->version);
|
||||
else
|
||||
virBufferAsprintf(&buf, "-1:");
|
||||
virBufferAddLit(&buf, "-1:");
|
||||
|
||||
virBufferAsprintf(&buf, "%u", usbdev->allow);
|
||||
if (i < redirfilter->nusbdevs -1)
|
||||
virBufferAsprintf(&buf, "|");
|
||||
virBufferAddLit(&buf, "|");
|
||||
}
|
||||
}
|
||||
|
||||
@ -5740,7 +5740,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
|
||||
* machine->init in QEMU, it needs to set usb=off
|
||||
*/
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT))
|
||||
virBufferAsprintf(&buf, ",usb=off");
|
||||
virBufferAddLit(&buf, ",usb=off");
|
||||
|
||||
if (def->mem.dump_core) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) {
|
||||
@ -6057,10 +6057,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
|
||||
if (graphics->data.spice.mousemode) {
|
||||
switch (graphics->data.spice.mousemode) {
|
||||
case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER:
|
||||
virBufferAsprintf(&opt, ",agent-mouse=off");
|
||||
virBufferAddLit(&opt, ",agent-mouse=off");
|
||||
break;
|
||||
case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT:
|
||||
virBufferAsprintf(&opt, ",agent-mouse=on");
|
||||
virBufferAddLit(&opt, ",agent-mouse=on");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -6079,10 +6079,10 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
|
||||
|
||||
switch (defaultMode) {
|
||||
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
|
||||
virBufferAsprintf(&opt, ",tls-channel=default");
|
||||
virBufferAddLit(&opt, ",tls-channel=default");
|
||||
break;
|
||||
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
|
||||
virBufferAsprintf(&opt, ",plaintext-channel=default");
|
||||
virBufferAddLit(&opt, ",plaintext-channel=default");
|
||||
break;
|
||||
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
|
||||
/* nothing */
|
||||
@ -6750,9 +6750,9 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virBufferAddChar(&boot_buf, ',');
|
||||
|
||||
if (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_ENABLED)
|
||||
virBufferAsprintf(&boot_buf, "menu=on");
|
||||
virBufferAddLit(&boot_buf, "menu=on");
|
||||
else
|
||||
virBufferAsprintf(&boot_buf, "menu=off");
|
||||
virBufferAddLit(&boot_buf, "menu=off");
|
||||
} else {
|
||||
/* We cannot emit an error when bootmenu is enabled but
|
||||
* unsupported because of backward compatibility */
|
||||
|
@ -330,7 +330,7 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
|
||||
priv->job.active = job;
|
||||
|
||||
if (priv->fakeReboot)
|
||||
virBufferAsprintf(buf, " <fakereboot/>\n");
|
||||
virBufferAddLit(buf, " <fakereboot/>\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ qemuMigrationCookieNetworkXMLFormat(virBufferPtr buf,
|
||||
/* If optr->net[i].vporttype is not set, there is nothing to transfer */
|
||||
if (optr->net[i].vporttype != VIR_NETDEV_VPORT_PROFILE_NONE) {
|
||||
if (empty) {
|
||||
virBufferAsprintf(buf, " <network>\n");
|
||||
virBufferAddLit(buf, " <network>\n");
|
||||
empty = false;
|
||||
}
|
||||
virBufferAsprintf(buf, " <interface index='%d' vporttype='%s'",
|
||||
@ -604,7 +604,7 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver,
|
||||
virUUIDFormat(mig->uuid, uuidstr);
|
||||
virUUIDFormat(mig->localHostuuid, hostuuidstr);
|
||||
|
||||
virBufferAsprintf(buf, "<qemu-migration>\n");
|
||||
virBufferAddLit(buf, "<qemu-migration>\n");
|
||||
virBufferEscapeString(buf, " <name>%s</name>\n", mig->name);
|
||||
virBufferAsprintf(buf, " <uuid>%s</uuid>\n", uuidstr);
|
||||
virBufferEscapeString(buf, " <hostname>%s</hostname>\n", mig->localHostname);
|
||||
|
@ -790,7 +790,7 @@ vah_add_file(virBufferPtr buf, const char *path, const char *perms)
|
||||
|
||||
virBufferAsprintf(buf, " \"%s\" %s,\n", tmp, perms);
|
||||
if (readonly) {
|
||||
virBufferAsprintf(buf, " # don't audit writes to readonly files\n");
|
||||
virBufferAddLit(buf, " # don't audit writes to readonly files\n");
|
||||
virBufferAsprintf(buf, " deny \"%s\" w,\n", tmp);
|
||||
}
|
||||
|
||||
|
@ -1503,7 +1503,7 @@ virLogGetOutputs(void)
|
||||
for (i = 0; i < virLogNbOutputs; i++) {
|
||||
virLogDestination dest = virLogOutputs[i].dest;
|
||||
if (i)
|
||||
virBufferAsprintf(&outputbuf, " ");
|
||||
virBufferAddChar(&outputbuf, ' ');
|
||||
switch (dest) {
|
||||
case VIR_LOG_TO_SYSLOG:
|
||||
case VIR_LOG_TO_FILE:
|
||||
|
@ -3396,7 +3396,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
|
||||
return -1;
|
||||
}
|
||||
|
||||
virBufferAsprintf(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n");
|
||||
virBufferAddLit(buffer, "RemoteDisplay.vnc.enabled = \"true\"\n");
|
||||
|
||||
if (def->data.vnc.autoport) {
|
||||
VIR_WARN("VNC autoport is enabled, but the automatically assigned "
|
||||
|
@ -526,7 +526,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
||||
virBufferAddLit(&buf, ">\n");
|
||||
|
||||
if (driver || subdriver || cache) {
|
||||
virBufferAsprintf(&buf, " <driver");
|
||||
virBufferAddLit(&buf, " <driver");
|
||||
|
||||
if (driver)
|
||||
virBufferAsprintf(&buf, " name='%s'", driver);
|
||||
@ -550,7 +550,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
|
||||
virBufferAsprintf(&buf, " <serial>%s</serial>\n", serial);
|
||||
|
||||
if (vshCommandOptBool(cmd, "shareable"))
|
||||
virBufferAsprintf(&buf, " <shareable/>\n");
|
||||
virBufferAddLit(&buf, " <shareable/>\n");
|
||||
|
||||
if (straddr) {
|
||||
if (str2DiskAddress(straddr, &diskAddr) != 0) {
|
||||
@ -814,14 +814,14 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
||||
virBufferAsprintf(&buf, " <model type='%s'/>\n", model);
|
||||
|
||||
if (inboundStr || outboundStr) {
|
||||
virBufferAsprintf(&buf, " <bandwidth>\n");
|
||||
virBufferAddLit(&buf, " <bandwidth>\n");
|
||||
if (inboundStr && inbound.average > 0) {
|
||||
virBufferAsprintf(&buf, " <inbound average='%llu'", inbound.average);
|
||||
if (inbound.peak > 0)
|
||||
virBufferAsprintf(&buf, " peak='%llu'", inbound.peak);
|
||||
if (inbound.burst > 0)
|
||||
virBufferAsprintf(&buf, " burst='%llu'", inbound.burst);
|
||||
virBufferAsprintf(&buf, "/>\n");
|
||||
virBufferAddLit(&buf, "/>\n");
|
||||
}
|
||||
if (outboundStr && outbound.average > 0) {
|
||||
virBufferAsprintf(&buf, " <outbound average='%llu'", outbound.average);
|
||||
@ -829,9 +829,9 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
|
||||
virBufferAsprintf(&buf, " peak='%llu'", outbound.peak);
|
||||
if (outbound.burst > 0)
|
||||
virBufferAsprintf(&buf, " burst='%llu'", outbound.burst);
|
||||
virBufferAsprintf(&buf, "/>\n");
|
||||
virBufferAddLit(&buf, "/>\n");
|
||||
}
|
||||
virBufferAsprintf(&buf, " </bandwidth>\n");
|
||||
virBufferAddLit(&buf, " </bandwidth>\n");
|
||||
}
|
||||
|
||||
virBufferAddLit(&buf, "</interface>\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user