]> git.proxmox.com Git - qemu-server.git/commitdiff
drives: ro: code reduction/refactor
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Oct 2021 15:00:24 +0000 (17:00 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 27 Oct 2021 15:00:24 +0000 (17:00 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm

index ba6308cf0e249de4f07fbc41d797fe594701eb7e..e0a89aa4b96b0aab780c05cb9004d0d4d3c6c30d 100644 (file)
@@ -1597,10 +1597,8 @@ sub print_drive_commandline_full {
        $opts .= ",snapshot=$v";
     }
 
-    # ro is 'readonly', and only accepts on|off
-    if (defined($drive->{ro})) {
-       my $v = $drive->{ro} ? 'on' : 'off';
-       $opts .= ",readonly=$v";
+    if (defined($drive->{ro})) { # ro maps to QEMUs `readonly`, which accepts `on` or `off` only
+       $opts .= ",readonly=" . ($drive->{ro} ? 'on' : 'off');
     }
 
     foreach my $type (['', '-total'], [_rd => '-read'], [_wr => '-write']) {