public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Markus Frank <m.frank@proxmox.com>
Subject: Re: [pve-devel] [PATCH guest-common v12 2/12] add dir mapping section config
Date: Sun, 17 Nov 2024 18:29:52 +0100	[thread overview]
Message-ID: <cf5bc59b-b9c9-43d5-b285-a5168cc421fa@proxmox.com> (raw)
In-Reply-To: <20241115140037.191682-3-m.frank@proxmox.com>

Am 15.11.24 um 15:00 schrieb Markus Frank:
> Adds a config file for directories by using a 'map' property string for
> each node mapping.

To be used for exposing Virtiofs and bindmounts (?) to VMs/CTs respectively.

Out of interest, can you (or anybody else) think of any other specific use
case this mapping could serve to?
 
> Next to node & path, there is the optional submounts parameter in the
> map property string that is used to announce other mounted file systems
> in the specified directory.

Announce to where? And should that be encoded in the name? Like with
'expose-sub-mounts'

> 
> Additionally there are the default settings for xattr & acl.

Might be good to mention what effect they have also in the docs patch,
I just saw the interaction between them described there.

Also, they seem very virtiofs specific, maybe sum them up in a format
string else it might get weird if we reuse this for other places where
those options might not make any sense. E.g.:


virtiofs-opts: [expose-xacl=<1|0>][,expose-acl=<1|0>]
> 
> example config:
> ```
> some-dir-id

Are you sure this is valid? doesn't the section config also needs a type?

> 	map node=node1,path=/mnt/share/,submounts=1
> 	map node=node2,path=/mnt/share/,
> 	xattr 1
> 	acl 1
> ```
> 

FWIW, I considered if a new content-type of the storage could be re-used, and
 it would be doable, but it would be probably quite odd to use and not have any
extra benefits.

> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
>  src/Makefile           |   1 +
>  src/PVE/Mapping/Dir.pm | 204 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 205 insertions(+)
>  create mode 100644 src/PVE/Mapping/Dir.pm
> 
> diff --git a/src/Makefile b/src/Makefile
> index cbc40c1..030e7f7 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -15,6 +15,7 @@ install: PVE
>  	install -m 0644 PVE/StorageTunnel.pm ${PERL5DIR}/PVE/
>  	install -m 0644 PVE/Tunnel.pm ${PERL5DIR}/PVE/
>  	install -d ${PERL5DIR}/PVE/Mapping
> +	install -m 0644 PVE/Mapping/Dir.pm ${PERL5DIR}/PVE/Mapping/
>  	install -m 0644 PVE/Mapping/PCI.pm ${PERL5DIR}/PVE/Mapping/
>  	install -m 0644 PVE/Mapping/USB.pm ${PERL5DIR}/PVE/Mapping/
>  	install -d ${PERL5DIR}/PVE/VZDump
> diff --git a/src/PVE/Mapping/Dir.pm b/src/PVE/Mapping/Dir.pm
> new file mode 100644
> index 0000000..6a343b1
> --- /dev/null
> +++ b/src/PVE/Mapping/Dir.pm
> @@ -0,0 +1,204 @@
> +package PVE::Mapping::Dir;
> +
> +use strict;
> +use warnings;
> +
> +use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_lock_file cfs_write_file);
> +use PVE::INotify;
> +use PVE::JSONSchema qw(get_standard_option parse_property_string);
> +use PVE::SectionConfig;
> +
> +use base qw(PVE::SectionConfig);
> +
> +my $FILENAME = 'mapping/dir.cfg';
> +
> +cfs_register_file($FILENAME,
> +    sub { __PACKAGE__->parse_config(@_); },
> +    sub { __PACKAGE__->write_config(@_); });
> +
> +
> +# so we don't have to repeat the type every time
> +sub parse_section_header {
> +    my ($class, $line) = @_;
> +
> +    if ($line =~ m/^(\S+)\s*$/) {
> +	my $id = $1;
> +	my $errmsg = undef; # set if you want to skip whole section
> +	eval { PVE::JSONSchema::pve_verify_configid($id) };
> +	$errmsg = $@ if $@;
> +	my $config = {}; # to return additional attributes
> +	return ('dir', $id, $errmsg, $config);
> +    }
> +    return undef;
> +}
> +
> +sub format_section_header {
> +    my ($class, $type, $sectionId, $scfg, $done_hash) = @_;
> +
> +    return "$sectionId\n";
> +}
> +
> +sub type {
> +    return 'dir';
> +}
> +
> +my $map_fmt = {
> +    node => get_standard_option('pve-node'),
> +    path => {
> +	description => "Absolute directory path that should be shared with the guest.",
> +	type => 'string',
> +	format => 'pve-storage-path',
> +    },
> +    submounts => {
> +	type => 'boolean',
> +	description => "Announce that the directory contains other mounted"
> +	    ." file systems. If this is not set and multiple file systems are"
> +	    ." mounted, the guest may encounter duplicates due to file system"
> +	    ." specific inode IDs.",


it's fine to go to 100 character columns per line for these


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


  reply	other threads:[~2024-11-17 17:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 14:00 [pve-devel] [PATCH cluster/guest-common/docs/qemu-server/manager v12 0/12] virtiofs Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH cluster v12 1/12] add mapping/dir.cfg for resource mapping Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH guest-common v12 2/12] add dir mapping section config Markus Frank
2024-11-17 17:29   ` Thomas Lamprecht [this message]
2024-11-15 14:00 ` [pve-devel] [PATCH docs v12 3/12] add doc section for the shared filesystem virtio-fs Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH qemu-server v12 4/12] control: add virtiofsd as runtime dependency for qemu-server Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH qemu-server v12 5/12] fix #1027: virtio-fs support Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH qemu-server v12 6/12] migration: check for virtiofs devices Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH qemu-server v12 7/12] disable snapshot (with RAM) and hibernate with virtio-fs devices Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH manager v12 08/12] api: add resource map api endpoints for directories Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH manager v12 09/12] ui: add edit window for dir mappings Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH manager v12 10/12] ui: add resource mapping view for directories Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH manager v12 11/12] ui: form: add selector for directory mappings Markus Frank
2024-11-15 14:00 ` [pve-devel] [PATCH manager v12 12/12] ui: add option to add virtio-fs to qemu config Markus Frank

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=cf5bc59b-b9c9-43d5-b285-a5168cc421fa@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=m.frank@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