From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7C9D26D55C for ; Tue, 28 Sep 2021 11:16:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6C811B76D for ; Tue, 28 Sep 2021 11:15:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 90795B762 for ; Tue, 28 Sep 2021 11:15:34 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 64754423FD for ; Tue, 28 Sep 2021 11:15:34 +0200 (CEST) Date: Tue, 28 Sep 2021 11:15:27 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20210928090211.2082146-1-d.csapak@proxmox.com> In-Reply-To: <20210928090211.2082146-1-d.csapak@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1632820448.4l68m4o6ly.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.351 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [drive.pm, proxmox.com, qemuserver.pm] Subject: Re: [pve-devel] [PATCH qemu-server v2] drives: expose 'readonly' flag of qemu for scsi/virtio X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 09:16:05 -0000 On September 28, 2021 11:02 am, Dominik Csapak wrote: > this allows a user to set a drive to 'read-only'. This can be useful > if a disk should not be written to, or if the backing file/source is > not writable (like a mapped pbs backup to /dev/loopX). >=20 > while this could also be achieved by setting 'snapshot=3D1', this would > create a temporary file in /var/tmp which can get quite big. >=20 > Signed-off-by: Dominik Csapak > --- > changes from v1: > * limit that setting to scsi/virtio as it is not possible to use it on > ide/sata >=20 > PVE/QemuServer.pm | 10 ++++++---- > PVE/QemuServer/Drive.pm | 11 +++++++++++ > 2 files changed, 17 insertions(+), 4 deletions(-) >=20 > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index 0fb8628..5209f51 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -1569,10 +1569,12 @@ sub print_drive_commandline_full { > $opts .=3D ",$o=3D$drive->{$o}" if defined($drive->{$o}); > } > =20 > - # snapshot only accepts on|off > - if (defined($drive->{snapshot})) { > - my $v =3D $drive->{snapshot} ? 'on' : 'off'; > - $opts .=3D ",snapshot=3D$v"; > + # some options only accepts on|off > + foreach my $o (qw(snapshot readonly)) { > + if (defined($drive->{$o})) { > + my $v =3D $drive->{$o} ? 'on' : 'off'; > + $opts .=3D ",$o=3D$v"; > + } > } > =20 > foreach my $type (['', '-total'], [_rd =3D> '-read'], [_wr =3D> '-wr= ite']) { > diff --git a/PVE/QemuServer/Drive.pm b/PVE/QemuServer/Drive.pm > index 5110190..af7aafe 100644 > --- a/PVE/QemuServer/Drive.pm > +++ b/PVE/QemuServer/Drive.pm > @@ -175,6 +175,14 @@ my %queues_fmt =3D ( > } > ); > =20 > +my %readonly_fmt =3D ( > + readonly =3D> { we have a very similar CT mountpoint property called 'ro', might make sense= =20 to have it consistent? > + type =3D> 'boolean', > + description =3D> "Whether the drive is read-only.", > + optional =3D> 1, > + }, > +); > + > my %scsiblock_fmt =3D ( > scsiblock =3D> { > type =3D> 'boolean', > @@ -269,6 +277,7 @@ my $scsi_fmt =3D { > %drivedesc_base, > %iothread_fmt, > %queues_fmt, > + %readonly_fmt, > %scsiblock_fmt, > %ssd_fmt, > %wwn_fmt, > @@ -297,6 +306,7 @@ PVE::JSONSchema::register_standard_option("pve-qm-sat= a", $satadesc); > my $virtio_fmt =3D { > %drivedesc_base, > %iothread_fmt, > + %readonly_fmt, > }; > my $virtiodesc =3D { > optional =3D> 1, > @@ -311,6 +321,7 @@ my $alldrive_fmt =3D { > %iothread_fmt, > %model_fmt, > %queues_fmt, > + %readonly_fmt, > %scsiblock_fmt, > %ssd_fmt, > %wwn_fmt, > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20