On 08/16/2016 03:52 AM, like...@cs2c.com.cn wrote:
> I'm using ovirt3.6.7, and i want to use QoS function by restapi. But i
> fount i can't update the qos to unlimited.
> For example, i assigned a qos named qos1 to a vnic profile named
> vprofile1, then i want to set the qos of vprofile1 to unlimited,
> so i set the qos to None in sdk when update vnic profile, but after
> update the vnic profile still has qos named qos1.
> So, how should i do if i want to set qos of a vnic profile to unlimited?
> Look forward to your help!
This is a general issue with the way the API works: we don't have
different methods for updating or replacing completely the
representation of an object, we use PUT for everything. This means that
we have to assume that when you send a request without an attribute what
you mean is that you want to preserve it. For example, when you send
something like this:
We have to assume that you want to preserve the attributes, as otherwise
we would just remove all of them. A side effect of this is that there is
no way to express that what you want to do is remove the QoS.
The workaround for that is to create an unlimited QoS (manually or via
the API) and then update the VNIC profile to use that instead of the
previous one. For example:
# Find the data center:
dc = api.datacenters.get(name='mydc')
# Find the "unlimited" QoS, or create it if it doesn't exit
unlimited = dc.qoss.get(name='unlimitednetwork')
if unlimited is None:
unlimited = dc.qoss.add(
# Find the VNIC profile:
profile = api.vnicprofiles.get(name='myprofile')
# Change the VNIC profile to use the unlimited QoS:
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.
Users mailing list