Using HyperV with Samba 4.2

Richard Sharpe realrichardsharpe at gmail.com
Wed Oct 15 06:05:24 MDT 2014


Hi folks,

Sending this out in the hope that it will be useful to some people.

INTRODUCTION

This document describes how to get Samba 4.2 (or the Samba master
branch at this time) to work with HyperV.

The work described here was requested by Hedvig Inc and made possible
with technical help from Ata E Hussain and Abhijit Shennoy, who
provided packet captures and integrated the changes supplied into
Samba and tested that things worked.

We are making this information available so that more people can try
it out and provide feedback on the problems etc.

CAVEATS

This code is not production ready. Support for reconnection of
persistent handles is still being developed and there are likely to be
corner cases that are not handled.

However, it can be used for testing.

PROCESS

There are two things that are needed to allow HyperV at least work
against Samba. You will need to start with the Samba 4.2 sources (the
latest master branch is probably best.)

Firstly, you will need a patch that implements
FSCTL_LMR_REQUEST_RESILIENCY. A patch for this was posted to the
samba-technical mailing list a short while ago and is attached.

Secondly, you will need to create a VFS module (or modify your
existing VFS module if you have one) to assert that your file system
supports compression and to implement the set_compression and
get_compression entry points.

These two functions do not really have to do much. The set_compression
function can simply return NT_STATUS_SUCCESS without doing anything
and the get_compression function should return that compression is not
set (COMPRESSION_FORMAT_NONE). A patch for a sample HyperV VFS module
is also attached to implement these functions for you. You will need
to add "hyperv" to the vfs objects you define for any share that will
be used with HyperV if you use this module.

This steps are required because when HyperV creates the VHD/VSV file
it opens the file, then sets resiliency and then sets compression off.
Creation of the virtual disk will fail if any of these steps returns
an error status.

You will need to configure Samba slightly differently to include this
module for the moment:

   ./configure --with-shared-modules=vfs_hyperv

You could also modify source3/wscript to add vfs_hyperv to the list of
modules being built by default.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-definition-of-the-NETWORK_RESILIENCY_REQUEST-s.patch
Type: text/x-patch
Size: 821 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141015/5d4c364d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-simple-module-that-allows-HyperV-to-work-with-.patch
Type: text/x-patch
Size: 3769 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141015/5d4c364d/attachment-0001.bin>


More information about the samba-technical mailing list