Add VirtualSmbShares configuration support#50
Conversation
|
If preferred, this PR may be split into 2 PRs of VirtualSmbShares support and Mounts support. |
|
Thanks, although this PR still has some issues.
At least, according to this in the project ReadMe. I don't think putting files into ProgramData or having global states is a good design. Kenji Mouri |
|
I think NanaBox's host side will only accept the Virtual SMB support. Mount configurations should be kept only on the guest side. Although we can provide guest tools to set that up. Also, the Virtual SMB support also needs to provide NanaBox's default mount points when having the GPU's EnableHostDriverStore enabled. Also, we should not limit it only to Windows because it should be OK for POSIX if we can modify Samba to support SMB2-only negotiation style connection. Kenji Mouri |
|
Note: Here are some reasons why I hope NanaBox can be portable and not have system-wide global states. https://github.com/SherryPlatform/RelayLab#why-named-relaylab Kenji Mouri |
|
I have recalled that it should be OK even if we don't set DirectFileMappingInMB explicitly. So, I also want to know why you want to modify and expose that. Kenji Mouri |
I tested different |
Yes, I intentionally didn't add That said, now that hcsshim has open-sourced the VSMB guest init code, it may provide enough reference for you to build a POSIX equivalent. I will add |
|
I think I will manually partially merge your PR because I need to do some standardization and formalization. Of course, I will use Co-authored-by to note you. Kenji Mouri |
Add first-class Virtual SMB share configuration to the .7b config file with Name, Path, ReadOnly fields. Generate HCS VirtualSmb device JSON with DirectFileMappingInMB hardcoded to 1024 (matching hcsshim default). User shares use TakeBackupPrivilege to bypass host ACL restrictions. When EnableHostDriverStore is set, auto-inject HostDriverStore, NanaBox.HostDrivers and NanaBox.HostLxssLib as read-only VirtualSmb shares alongside the existing Plan 9 shares.
a02d287 to
554e537
Compare
|
I've scoped this PR down to VirtualSmb support only, removing NanaBoxStateDirectory and Mounts.
I have to point out that, once the VM guest side is taken into account (as a factor other than host in the system dimension):
On portabilityThe The proposed On "registering virtual machine configurations into the system"If I understand correctly, the original statement is about registering global configurations on the host, as Hyper-V Manager does. You could argue this "registers configuration into the system" at the guest VM level, since it introduces In summary, while any preference against |
|
I prefer declaring the mounts in the
What do you think of method 2 in terms of "global state" here? Regarding Hyper-V socket/VMBus, I think both Plan9 50001 port or Virtual SMB shares are all "global states" in guest VM's namespace, and a Nanabox's HvSocket is no different from them. |
…igilans.) Co-authored-by: Vigilans <vigilans@foxmail.com>
|
In general, I have manually merged the Virtual SMB configuration support into the master. You can review and do some tests. For the guest side, I think we can provide a utility to configure the share, and we can make that as a service. Kenji Mouri |
|
Actually, I don't think we should expose mount information states to VMs, which will add more unnecessary attack surfaces. The host side only exposes the share, and the guest side uses a small tool to configure it explicitly. I don't think it's good for providing a way for guests to enumerate all shares exposed to the VMs. Kenji Mouri |
|
I think for the small Virtual SMB configuration tool, I will make a standalone project which will need to be co-authored by you at least several times. Because I don‘t think we should limited that only to NanaBox, maybe for Hyper-V researchers will be much happy for playing Windows Sandbox, lol. I won't close this PR until I have done that tool. Kenji Mouri |
Reviewed your commit:
Cannot tell the exact difference in these options, just leaving comments here.
Personally I think a script installer to download tool and install as service would be ideal (like astral/uv): |
Kenji Mouri |
…igilans.) Co-authored-by: Vigilans <vigilans@foxmail.com>





Summary
VirtualSmbSharesconfiguration to the.7bconfig file (Name,Path,ReadOnly)VirtualSmbdevice JSON withDirectFileMappingInMBhardcoded to 1024 (matching hcsshim default). User shares useTakeBackupPrivilegeto bypass host ACL restrictionsEnableHostDriverStoreis set, auto-injectHostDriverStore,NanaBox.HostDriversandNanaBox.HostLxssLibas read-only VirtualSmb shares alongside the existing Plan 9 sharesTest plan
.7bconfig withVirtualSmbSharesround-trips correctly through serialize/deserializeHostDriverStore,NanaBox.HostDriversandNanaBox.HostLxssLibVirtualSmb shares appear in HCS JSON whenEnableHostDriverStoreis set