Skip to content
  • Manos Pitsidianakis's avatar
    block: convert ThrottleGroup to object with QOM · 432d889e
    Manos Pitsidianakis authored
    
    
    ThrottleGroup is converted to an object. This will allow the future
    throttle block filter drive easy creation and configuration of throttle
    groups in QMP and cli.
    
    A new QAPI struct, ThrottleLimits, is introduced to provide a shared
    struct for all throttle configuration needs in QMP.
    
    ThrottleGroups can be created via CLI as
        -object throttle-group,id=foo,x-iops-total=100,x-..
    where x-* are individual limit properties. Since we can't add non-scalar
    properties in -object this interface must be used instead. However,
    setting these properties must be disabled after initialization because
    certain combinations of limits are forbidden and thus configuration
    changes should be done in one transaction. The individual properties
    will go away when support for non-scalar values in CLI is implemented
    and thus are marked as experimental.
    
    ThrottleGroup also has a `limits` property that uses the ThrottleLimits
    struct.  It can be used to create ThrottleGroups or set the
    configuration in existing groups as follows:
    
    { "execute": "object-add",
      "arguments": {
        "qom-type": "throttle-group",
        "id": "foo",
        "props" : {
          "limits": {
              "iops-total": 100
          }
        }
      }
    }
    { "execute" : "qom-set",
        "arguments" : {
            "path" : "foo",
            "property" : "limits",
            "value" : {
                "iops-total" : 99
            }
        }
    }
    
    This also means a group's configuration can be fetched with qom-get.
    
    Signed-off-by: default avatarManos Pitsidianakis <el13635@mail.ntua.gr>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    432d889e