Samba configuration enhancements #1540

Merged
merged 6 commits into from Nov 23, 2016

Projects

None yet

4 participants

@MFlyer
Member
MFlyer commented Nov 21, 2016

Hi all guys,
opening this PR, but this is only 1 of 3 mods, so @schakrava please wait merging to avoid more PRs

71a7f09 adds some extra infos to users about smb.conf params syntax & a direct link to smb.conf docu
warning

On 8e03a68 we've a general improvement I had to code to grant a bigger tooltip!
This is how usually have tooltips:

        this.$('#docker-form #root_share').tooltip({
            html: true,
            placement: 'right',
            title: 'bla bla bla.'
        });

But Bootstrap tooltips let us define an on the fly new template like this:

        this.$('#smb-form #global_config').tooltip({
            html: true,
            placement: 'right',
            template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div> \
                    <div class="tooltip-inner size300"></div></div>',
            title: 'These lines will be added to the [global] section of smb.conf<br/><br/> etc etc'
        });

To grant tooltips to work templates have to be always like this

<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner size300"></div></div>'

To have a custom size for a better UX (Samba text was too much long), added new 4 classes over tooltip-inner (template body), so now with size200, size250, size300, size350 you can have 200,250,300,350px width tooltips (more than 350px comes to big, more then modals)

To @priyaganti : there's a width: 400px inside tooltip-inner, but that's totally skipped by Rockstor (having bootstrap default size)

Going on with other Sambas :)

M.

MFlyer added some commits Nov 21, 2016
@MFlyer MFlyer Samba global configuration - Improve warnings
Fixes #1525 by adding some info over configuration textarea tooltip
Added warning about no inline comments with ; or #
Added small syntax reference both for simple params like param = value
and "complex params" like socket options with equal signs inside value field
"Complex params" right syntax: param = valuea=x valueb=y (no spaces for equals on right side)

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
71a7f09
@MFlyer MFlyer Samba global custom params - required new css classes for better UX
Added 4 classes to have custom tooltip sizes (200, 250, 300, 350)
Not going over 350px to avoid tooltips bigger than modals
More infos coming over PR (Not yet to be merged - part 1 out of 3)

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
8e03a68
@MFlyer MFlyer Enforcing correct Samba syntax, ref to #1527
samba_service POST function has been modified this way:
custom params split no more on '=', but on ' = ' and this
grant us having 'complex param' like socket options (equal signs right side too)
While allowing this we also had some syntax checking:
each custom params line splits in 2 parts (param name and value),
we ensure not having = signs inside paran name and raise an error
Ex. socket options = SO_SNDBUF=131072 is ok ('socket options', 'SO_SNDBUF=131072')
socket options=SO_SNDBUF = 131072 fails ('socket options=SO_SNDBUF', '131072')
Having all equal signs without spaces or any array with length < 2
will discard values (samba_service already had this)

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
2c0bc9c
@MFlyer MFlyer #1527 - Remove unrequired line
Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
bf8abe6
@MFlyer MFlyer Enforcing samba syntax part 2
Reading samba global custom params now we split lines with ' = '
so we grant rendering of params like socket options with multiple
equal signs (socket options = something=value)

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
b77ceeb
@MFlyer MFlyer Enforcing correct Samba syntax(part 3/3) - beautify - Fixes #1527
Updates over configure_services view and samba configuration template
Added new Handlebars function to grant
1)skipping workgroup (already present)
2)avoid trailing spaces inside samba custom params textarea
Custom param textarea reduced to 1 line because textarea html tag
catches every indent/tab/etc

Signed-off-by: Mirko Arena <mirko.arena@gmail.com>
1269b1e
@MFlyer
Member
MFlyer commented Nov 22, 2016

Hi all again,
here we come with our 2 out of 3 mods: allow "complex custom params" (ex. socket options by @tomtom13 )

Every commit has a detailed description, but here we come with a summary:

2c0bc9c & bf8abe6 grant our Rockstor a way to enforce samba syntax (no more things like param=param_option=value) and accept socket options like params:

  • params splits now with ' = ' (spaces around) and not '=' (no spaces), so we can receive a param like socket options = SO_SNDBUF=131072 and save it
  • syntax check over param name, if has = inside it user had a bad syntax like this socket options=SO_SNDBUF = 131072 (Samba syntax = first equal sign with spaces, others without)
  • if splitting we get a 1 element array like on socket options=SO_SNDBUF=131072 (splitting with = we don't find equal with spaces, so 1 elem), param discarding (check already existing, nothing changed)

b77ceeb is first 2 commits brother for returning params to WebUI (split with =)

Last but not least 1269b1e is a beautifier:
Samba global custom params textarea had some traling spaces because of code indentation (textarea html tag "likes" indent, tabs, spaces, etc), so moved to a one line textarea html tag + Handlebars helper full rewrite

Going on with part 3 #1526
(@tomtom13 prepare your guinea piggies to join battle! :P)

@MFlyer
Member
MFlyer commented Nov 22, 2016 edited

Hi @schakrava ,
from my side this is ready to your review/merge and this let us close #1526 (manually close it, not having a commit just to auto-close it :) ) too without other commits

Why closing #1526 without code?
Had some tests by

  1. Full reset for Active Directory and Samba having null null vals on PostgreSQ
  2. Cleaned smb.conf file to simulate a new environment
  3. Turn off Samba service
  4. Check Samba workgroup empty from samba configuration page
  5. Add a workgroup and submit
  6. Open again samba configuration page and workgroup name is there on first try (both with samba service on / off)
  7. Repeated 1to6 3 times without any issue and/or latency in getting samba workgroup name
@MFlyer
Member
MFlyer commented Nov 23, 2016

@tomtom13 can your confirm (or not) last message?
@phillxnet do you have any feedback on #1526

Worst case: we merge and leave #1526 open to further checks
M.

@tomtom13
Contributor

@MFlyer you will have to vait for me on that. I'll drop another nuke on my vmware install and start fresh to prove that everything is OK ... I was ocupied trying to get couch potato and deluge automation working ( sometimes I know why people are throwing curses, it was that !@#$!@%$ simple )

Also I need to hire 3 software guys now and my agent is playing fucking tricks and this is is seriously stressing me out lately. I'm considering calling his boss (my old mate) and telling him to shove it ... and I seriously don't want to loose that connections :/

@MFlyer
Member
MFlyer commented Nov 23, 2016

Hi @tomtom13 , no problem, if @schakrava agree we can go on and have #1526 left open ;)

M.

P.S.: Also I need to hire 3 software guys : do you accept remote coders? :P

@tomtom13
Contributor

Nope, my team runs in slavery mode so they have to be present ... you know, not a massive proponent but:

slavery-gets-shit-done-funny-529567-480x320

@phillxnet
Contributor

@MFlyer We can always close it later once it's confirmed your changes sort it.

@schakrava
Member

Nicely done @MFlyer and a superb job on comments too!

@schakrava schakrava merged commit dc1826d into rockstor:master Nov 23, 2016
@MFlyer MFlyer deleted the MFlyer:Samba_Configuration_enhancements branch Nov 23, 2016
@tomtom13
Contributor

Hi @MFlyer I can confirm that everything work a OK now, tips are brilliant, checking "just works" one can do a lot of nice stuff ... also this crazy white spaces stuff is gone as well !
Great job !

@MFlyer
Member
MFlyer commented Nov 26, 2016

Hi @tomtom13 , thanks for your checking :)

My suggestion :
usually samba running on linux is fine without tuning hacks, so please be careful (sometimes tuning params supposed to improve performance have instead opposite effect) and have tons of tests :)

@tomtom13
Contributor

Thing is that realisticly it doesn't .... samba out of the box is nicelly setup for having windows clients ... not linux clients :/ So if you connect with ubuntu you are shatfed :/

@tomtom13
Contributor

Update, need to log on to my work station to get you those screen shots.
So, on windows I get 103MB/s ....
On ubuntu it's not so rosy - I get 48MB with my hacks, which is I start shuffling UP and DOWN is actually split in half between streams:

screenshot from 2016-11-25 23-57-32

I'm trying to solve it in between work and looking after my kid :/ but If I'll crack it I'll write nice write up on rockstor forum - this should drive more traffic out of google to us :)

@phillxnet
Contributor
phillxnet commented Nov 26, 2016 edited

@tomtom13 I think you will find that this is a known issue with the subsystems employed by nautilus (ie client side).

Try mounting your samba share via cli and then do a speed test to the resulting mount. Real shame and quite shameful, it used to be much worse but now and for a while it's been around 1/2 the speed of a regular mount. I'll try and look up the long standing bug on this.

Also the forum is a better area for this discussion I would have though.

@tomtom13
Contributor

@phillxnet I know that gvfs is responsibe for this mess ... cli smb mounts are fine, even running a vmware with windows in it with virtualbox inside runnning osx gives 100MB/s (yes cpu glows red, but still it works). I'm trying to find a cofiguration options for this darn gvfs but there seems to be none.

In terms of discussion, forums tend to get bad signal to noise so I preffer just o search :/ Here I was pointing out to @MFlyer that nasty hacks are required to make linux box work with linux box - which is insane in my rule book - I don't see microsoft putting that much effort in making windows work with linux :/

@phillxnet
Contributor

OK, apparently gvfs uses libsmbclient which is the slow bit (bottle neck)
26th feb comment 13:
https://bugzilla.gnome.org/show_bug.cgi?id=738535
The same chap (inf3rno) also posted here:-
https://askubuntu.com/questions/194475/slow-gvfs-smb-performance
and again here (march 2016):
https://bugzilla.samba.org/show_bug.cgi?id=10879

(They play with buffer sizes but see my test below)

Where as if one by passes libsmbclient ie:
sudo mount -t cifs -o username=test,password=testpass //rockhp.lan/samba-test /mnt/
then a full gigabit (with default Rockstor settings) is had:

sudo cp CentOS-7-x86_64-DVD-1511.iso /mnt/
Gave 102 to 104 MB/s so full gigabit.

To double check (as I did) one can also mount via command line using gvfs via the likes of:
gvfs-mount smb://SERVER-IP/Share

Haven't looked again at this for a few months and meant to post findings on Forum but it just never came up and I didn't get around to it. Might be a good thread to start though. Reference to this thread might also be useful given others are likely to reach the same (current) conclusion you had.

@MFlyer You are the SAMBA master so I will of course stand corrected if I have miss understood the above links (which I haven't looked at since I'm afraid).

Got only this far myself as was via sudo mount -t cifs able to fully populate gigabit so seemed like the client (gvfs via libsmbclient) was the issue.

@MFlyer
Member
MFlyer commented Nov 26, 2016

Hi @phillxnet , I'm not the "SAMBA master" eheh

Talking about samba, when having it linux to linux I'm used to mount cifs and can confirm good performace like you, although other solutions have better results (NFS in a well known network or with some hacks to overcome NFS poor security)

M.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment