On Tue, May 10, 2022 at 01:51:05PM +0100, Daniel P. Berrangé wrote:
> In 7.0.0 we can now generate
>
>    type BlockResizeArguments struct {
>        V500 *BlockResizeArgumentsV500
>        V520 *BlockResizeArgumentsV520
>        V700 *BlockResizeArgumentsV700
>    }
>
>    type BlockResizeArgumentsV500 struct {
>        Device string
>        Size int
>    }
>
>    type BlockResizeArgumentsV520 struct {
>        Device *string
>        NodeName *string
>        Size int
>    }
>
>    type BlockResizeArgumentsV700 struct {
>        NodeName string
>        Size int
>    }
>
> App can use the same as before, or switch to
>
>     node := "nodedev0"
>     cmd := BlockResizeArguments{
>         V700: &BlockResizeArguments700{
>             NodeName: node,
>             Size: 1 * GiB
>         }
>     }

This honestly looks pretty unwieldy.

If the application already knows it's targeting a specific version of
the QEMU API, which for the above code to make any sense it will have
to, couldn't it do something like

  import qemu .../qemu/v700

at the beginning of the file and then use regular old

  cmd := qemu.BlockResizeArguments{
      NodeName: nodeName,
      Size: size,
  }

instead?

-- 
Andrea Bolognani / Red Hat / Virtualization


Reply via email to