Re: [libvirt] [PATCH 2/2] Don't overwrite errors from virNetDevBandwidthSet

2014-07-30 Thread John Ferlan


On 07/28/2014 09:30 AM, Ján Tomko wrote:
> Otherwise this beautiful error would be overwritten when
> the function is called with a really high rate number:
> 
> 2014-07-28 12:51:47.920+: 2304: error : virCommandWait:2399 :
> internal error: Child process (/sbin/tc class add dev vnet0 parent 1:
> classid 1:1 htb rate 4294968kbps) unexpected exit status 1: Illegal "rate"
> Usage: ... qdisc add ... htb [default N] [r2q N]
>  default  minor id of class to which unclassified packets are sent {0}
>  r2q  DRR quantums are computed as rate in Bps/r2q {10}
>  debugstring of 16 numbers each 0-3 {0}
> 
> ... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]
>   [prio P] [slot S] [pslot PS]
>   [ceil R2] [cburst B2] [mtu MTU] [quantum Q]
>  rate rate allocated to this class (class can still borrow)
>  burstmax bytes burst which can be accumulated during idle period 
> {computed}
>  mpu  minimum packet size used in rate computations
>  overhead per-packet size overhead used in rate computations
>  linklay  adapting to a linklayer e.g. atm
>  ceil definite upper class rate (no borrows) {rate}
>  cburst   burst but for ceil {computed}
>  mtu  max packet size we create rate map for {1600}
>  prio priority of leaf; lowe
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1043735
> ---
>  src/lxc/lxc_process.c   | 6 +-
>  src/network/bridge_driver.c | 6 +-
>  src/qemu/qemu_command.c | 6 +-
>  src/qemu/qemu_driver.c  | 6 +-
>  src/qemu/qemu_hotplug.c | 6 +-
>  src/util/virnetdevmacvlan.c | 3 ---
>  6 files changed, 5 insertions(+), 28 deletions(-)
> 

ACK -

Although TBH the concept of losing/overwriting the last error message
still confounds me :-)

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/2] Don't overwrite errors from virNetDevBandwidthSet

2014-07-28 Thread Ján Tomko
Otherwise this beautiful error would be overwritten when
the function is called with a really high rate number:

2014-07-28 12:51:47.920+: 2304: error : virCommandWait:2399 :
internal error: Child process (/sbin/tc class add dev vnet0 parent 1:
classid 1:1 htb rate 4294968kbps) unexpected exit status 1: Illegal "rate"
Usage: ... qdisc add ... htb [default N] [r2q N]
 default  minor id of class to which unclassified packets are sent {0}
 r2q  DRR quantums are computed as rate in Bps/r2q {10}
 debugstring of 16 numbers each 0-3 {0}

... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]
  [prio P] [slot S] [pslot PS]
  [ceil R2] [cburst B2] [mtu MTU] [quantum Q]
 rate rate allocated to this class (class can still borrow)
 burstmax bytes burst which can be accumulated during idle period {computed}
 mpu  minimum packet size used in rate computations
 overhead per-packet size overhead used in rate computations
 linklay  adapting to a linklayer e.g. atm
 ceil definite upper class rate (no borrows) {rate}
 cburst   burst but for ceil {computed}
 mtu  max packet size we create rate map for {1600}
 prio priority of leaf; lowe

https://bugzilla.redhat.com/show_bug.cgi?id=1043735
---
 src/lxc/lxc_process.c   | 6 +-
 src/network/bridge_driver.c | 6 +-
 src/qemu/qemu_command.c | 6 +-
 src/qemu/qemu_driver.c  | 6 +-
 src/qemu/qemu_hotplug.c | 6 +-
 src/util/virnetdevmacvlan.c | 3 ---
 6 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 4912035..3353dc1 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -276,12 +276,8 @@ char *virLXCProcessSetupInterfaceBridged(virConnectPtr 
conn,
 
 if (virNetDevBandwidthSet(net->ifname,
   virDomainNetGetActualBandwidth(net),
-  false) < 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot set bandwidth limits on %s"),
-   net->ifname);
+  false) < 0)
 goto cleanup;
-}
 
 if (net->filter &&
 virDomainConfNWFilterInstantiate(conn, vm->uuid, net) < 0)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 6ccc6e2..4a53f8a 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2080,12 +2080,8 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr 
driver,
 }
 
 if (virNetDevBandwidthSet(network->def->bridge,
-  network->def->bandwidth, true) < 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot set bandwidth limits on %s"),
-   network->def->bridge);
+  network->def->bandwidth, true) < 0)
 goto err5;
-}
 
 VIR_FREE(macTapIfName);
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index beb8ca8..fb8b75f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -382,12 +382,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
 
 if (virNetDevBandwidthSet(net->ifname,
   virDomainNetGetActualBandwidth(net),
-  false) < 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot set bandwidth limits on %s"),
-   net->ifname);
+  false) < 0)
 goto cleanup;
-}
 
 if (net->filter && net->ifname &&
 virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0) {
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 704ba39..199858e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9966,12 +9966,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
sizeof(*newBandwidth->out));
 }
 
-if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot set bandwidth limits on %s"),
-   device);
+if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0)
 goto cleanup;
-}
 
 virNetDevBandwidthFree(net->bandwidth);
 if (newBandwidth->in || newBandwidth->out) {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 729744c..004b6a4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2181,12 +2181,8 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
 if (needBandwidthSet) {
 if (virNetDevBandwidthSet(newdev->ifname,
   virDomainNetGetActualBandwidth(newdev),
-  false) < 0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("cannot set bandwidth limits on %s"),
-   newdev->ifname);
+