public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Filip Schauer <f.schauer@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH proxmox-perl-rs v3 03/13] add Perl mapping for OCI container image parser/extractor
Date: Thu, 10 Jul 2025 12:39:22 +0200	[thread overview]
Message-ID: <k2ab43c6sdf7sntrthhzpkg5kzqe5ux2ecxiifmt4enkl4fprt@lfdhzn73ksi3> (raw)
In-Reply-To: <20250709123435.64796-4-f.schauer@proxmox.com>

On Wed, Jul 09, 2025 at 02:34:20PM +0200, Filip Schauer wrote:
> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
> ---
> This patch depends on the proxmox-oci crate added in patch 02/13.
> 
> Changed since v2:
> * rebase onto newest master (6132d4d36cbd)
> * forward all errors to Perl
> * remove oci-spec dependency
> 
> Changed since v1:
> * rebase on latest master (3d9806cb3c7f)
> * add new dependencies to debian/control
> 
>  pve-rs/Cargo.toml          |  1 +
>  pve-rs/Makefile            |  1 +
>  pve-rs/debian/control      |  1 +
>  pve-rs/src/bindings/mod.rs |  3 +++
>  pve-rs/src/bindings/oci.rs | 21 +++++++++++++++++++++
>  5 files changed, 27 insertions(+)
>  create mode 100644 pve-rs/src/bindings/oci.rs
> 
> diff --git a/pve-rs/Cargo.toml b/pve-rs/Cargo.toml
> index c7f11a3..4d38a5c 100644
> --- a/pve-rs/Cargo.toml
> +++ b/pve-rs/Cargo.toml
> @@ -37,6 +37,7 @@ proxmox-http = { version = "1", features = ["client-sync", "client-trait"] }
>  proxmox-http-error = "1"
>  proxmox-log = "1"
>  proxmox-notify = { version = "1", features = ["pve-context"] }
> +proxmox-oci = "0.1.0"
>  proxmox-openid = "1"
>  proxmox-resource-scheduling = "1"
>  proxmox-shared-cache = "1"
> diff --git a/pve-rs/Makefile b/pve-rs/Makefile
> index 773156a..d813766 100644
> --- a/pve-rs/Makefile
> +++ b/pve-rs/Makefile
> @@ -27,6 +27,7 @@ PERLMOD_GENPACKAGE := /usr/lib/perlmod/genpackage.pl \
>  
>  PERLMOD_PACKAGES := \
>  	  PVE::RS::Firewall::SDN \
> +	  PVE::RS::OCI \
>  	  PVE::RS::OpenId \
>  	  PVE::RS::ResourceScheduling::Static \
>  	  PVE::RS::TFA
> diff --git a/pve-rs/debian/control b/pve-rs/debian/control
> index 9e424ec..869ca50 100644
> --- a/pve-rs/debian/control
> +++ b/pve-rs/debian/control
> @@ -24,6 +24,7 @@ Build-Depends: cargo:native <!nocheck>,
>                 librust-proxmox-log-1+default-dev,
>                 librust-proxmox-notify-1+default-dev (>= 0.5.4),
>                 librust-proxmox-notify-1+pve-context-dev,
> +               librust-proxmox-oci-0.1+default-dev,
>                 librust-proxmox-openid-1+default-dev (>= 0.10.4-~~),
>                 librust-proxmox-resource-scheduling-1+default-dev,
>                 librust-proxmox-shared-cache-1+default-dev,
> diff --git a/pve-rs/src/bindings/mod.rs b/pve-rs/src/bindings/mod.rs
> index e4fb4db..17247f6 100644
> --- a/pve-rs/src/bindings/mod.rs
> +++ b/pve-rs/src/bindings/mod.rs
> @@ -1,5 +1,8 @@
>  //! This contains all the perl bindings.
>  
> +mod oci;
> +pub use oci::pve_rs_oci;
> +
>  mod resource_scheduling_static;
>  pub use resource_scheduling_static::pve_rs_resource_scheduling_static;
>  
> diff --git a/pve-rs/src/bindings/oci.rs b/pve-rs/src/bindings/oci.rs
> new file mode 100644
> index 0000000..f7cfe41
> --- /dev/null
> +++ b/pve-rs/src/bindings/oci.rs
> @@ -0,0 +1,21 @@
> +#[perlmod::package(name = "PVE::RS::OCI")]
> +pub mod pve_rs_oci {
> +    //! The `PVE::RS::OCI` package.
> +    //!
> +    //! Provides bindings for the proxmox-oci crate.

[`proxmox-oci`]

> +
> +    use anyhow::Error;
> +    use proxmox_oci::Config;
> +
> +    /// Method: Extract the rootfs of an OCI image tar and return the image config.

Not a method - just a regular function. (iow. called via
`PVE::RS::OCI::parse_and_extract_image`.

Methods would be `$an_instance->parse_and_extract_image(…)` and `Class
methods` would be `PVE::RS::OCI->parse_and_extract_image(…)`.

> +    #[export]
> +    pub fn parse_and_extract_image(
> +        oci_tar_path: &str,
> +        rootfs_path: &str,
> +    ) -> Result<Option<Config>, Error> {

We don't seem to have a case where we return `Ok(None)` now?

> +        match proxmox_oci::parse_and_extract_image(oci_tar_path, rootfs_path) {
> +            Ok(config) => Ok(Some(config.unwrap_or_default())),
> +            Err(err) => Err(err.into()),
> +        }
> +    }
> +}
> -- 
> 2.47.2


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  reply	other threads:[~2025-07-10 10:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 12:34 [pve-devel] [PATCH container/docs/lxcfs/manager/proxmox{, -perl-rs}/storage v3 00/13] support OCI images as container templates Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH proxmox v3 01/13] io: introduce RangeReader for bounded reads Filip Schauer
2025-07-10  6:04   ` Thomas Lamprecht
2025-07-09 12:34 ` [pve-devel] [PATCH proxmox v3 02/13] add proxmox-oci crate Filip Schauer
2025-07-10  8:46   ` Wolfgang Bumiller
2025-07-09 12:34 ` [pve-devel] [PATCH proxmox-perl-rs v3 03/13] add Perl mapping for OCI container image parser/extractor Filip Schauer
2025-07-10 10:39   ` Wolfgang Bumiller [this message]
2025-07-09 12:34 ` [pve-devel] [PATCH container v3 04/13] add support for OCI images as container templates Filip Schauer
2025-07-10 10:31   ` Wolfgang Bumiller
2025-07-09 12:34 ` [pve-devel] [PATCH container v3 05/13] config: add entrypoint parameter Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH container v3 06/13] configure static IP in LXC config for custom entrypoint Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH container v3 07/13] setup: debian: create /etc/network path if missing Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH container v3 08/13] setup: recursively mkdir /etc/systemd/{network, system-preset} Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH container v3 09/13] manage DHCP for containers with custom entrypoint Filip Schauer
2025-07-09 13:41   ` Filip Schauer
2025-07-10 10:34   ` Wolfgang Bumiller
2025-07-09 12:34 ` [pve-devel] [PATCH lxcfs v3 10/13] lxc.mount.hook: override env variables from container config Filip Schauer
2025-07-10  9:30   ` Wolfgang Bumiller
2025-07-09 12:34 ` [pve-devel] [PATCH storage v3 11/13] allow .tar container templates Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH manager v3 12/13] ui: storage upload: accept *.tar files as vztmpl Filip Schauer
2025-07-09 12:34 ` [pve-devel] [PATCH docs v3 13/13] ct: add OCI image docs Filip Schauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=k2ab43c6sdf7sntrthhzpkg5kzqe5ux2ecxiifmt4enkl4fprt@lfdhzn73ksi3 \
    --to=w.bumiller@proxmox.com \
    --cc=f.schauer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal