[pve-devel] [RFC qemu-server 12/16] Implement abstract foreach_volume and print_volume

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Feb 5 10:34:26 CET 2020


On January 29, 2020 2:30 pm, Fabian Ebner wrote:
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>  PVE/QemuConfig.pm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
> index 1ba728a..a983e52 100644
> --- a/PVE/QemuConfig.pm
> +++ b/PVE/QemuConfig.pm
> @@ -130,6 +130,18 @@ sub get_replicatable_volumes {
>      return $volhash;
>  }
>  
> +sub foreach_volume {
> +    my ($class, $conf, $func, @param) = @_;
> +
> +    PVE::QemuServer::foreach_drive($conf, $func, @param);
> +}
> +
> +sub print_volume {
> +    my ($class, $volume) = @_;
> +
> +    return PVE::QemuServer::print_drive($volume);
> +}
> +

I kind of feel like I should apply the same standards as with previous 
patch series, and get you to investigate moving drive-related code to 
their own files instead of increasing the coupling between QemuConfig 
and QemuServer even further ;)

foreach_drive could then remain as a backwards-compatible wrapper around 
the new foreach_volume, which could have a new interface (hint: also 
taking pve-container into account!) and/or 
additional functionality

did you already do that? ideally, it would look similar to what Stefan 
did with Machine/CPU/.. related code, so that we end up with 
QemuDrive.pm (or multiple such files) which can be called from 
QemuServer or QemuConfig, and which contains the schema and helpers, 
with the implementation of the new abstract iterator in QemuConfig 
re-using the new module(s).

>  sub __snapshot_save_vmstate {
>      my ($class, $vmid, $conf, $snapname, $storecfg, $statestorage, $suspend) = @_;
>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 



More information about the pve-devel mailing list