Skip to content

Commit c4f6493

Browse files
committed
add configurable group option for virtiofsd socket
1 parent 61fb452 commit c4f6493

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* `bin/virtiofsd-run` (`[email protected]`) now starts the
1919
multiple virtiofsd instances through supervisord.
2020
* The `microvm` module allows configuration of
21+
`microvm.virtiofsd.group` and
2122
`microvm.virtiofsd.inodeFileHandles` and
2223
`microvm.virtiofsd.threadPoolSize` now.
2324
* Add the [alioth VMM](https://github.com/google/alioth)

nixos-modules/microvm/options.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,15 @@ in
565565
'';
566566
};
567567

568+
virtiofsd.group = mkOption {
569+
type = with types; nullOr str;
570+
default = "kvm";
571+
description = ''
572+
The name of the group that will own the Unix domain socket file that virtiofsd creates for communication with the hypervisor.
573+
If null, the socket will have group ownership of the user running the hypervisor.
574+
'';
575+
};
576+
568577
virtiofsd.extraArgs = mkOption {
569578
type = with types; listOf str;
570579
default = [];

nixos-modules/microvm/virtiofsd/default.nix

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ let
1010
inherit (pkgs.python3Packages) supervisor;
1111
supervisord = lib.getExe' supervisor "supervisord";
1212
supervisorctl = lib.getExe' supervisor "supervisorctl";
13-
14-
# TODO: don't hardcode
15-
group = "kvm";
16-
1713
in
1814
{
1915
microvm.binScripts = lib.mkIf requiresVirtiofsd {
@@ -45,7 +41,9 @@ in
4541
fi
4642
exec ${lib.getExe pkgs.virtiofsd} \
4743
--socket-path=${lib.escapeShellArg socket} \
48-
--socket-group=${group} \
44+
${lib.optionalString (config.microvm.virtiofsd.group != null)
45+
"--socket-group=${config.microvm.virtiofsd.group}"
46+
} \
4947
--shared-dir=${lib.escapeShellArg source} \
5048
$OPT_RLIMIT \
5149
--thread-pool-size ${toString config.microvm.virtiofsd.threadPoolSize} \

0 commit comments

Comments
 (0)