libvirt-hook-qemu icon indicating copy to clipboard operation
libvirt-hook-qemu copied to clipboard

Use Range port

Open davidcassany opened this issue 9 years ago • 4 comments

Hi,

I have been using this scripts for while and I am pretty satisfied with them, great job and so great you shared it. Anyhow some days ago I needed to open a port range so i modified a little the script and the schema in order to accept an entrance like:

"port_range": [{"range": [10000, 10128], "protocol": "udp"}]

Assuming that the mapping is done using the same port numbers. I was wondering if it would be of your interest to include such a modifications in your code, I can provide a Pull Request if you'd like. Some modifications or enhancements could be done, like provide start port number and the number of port to open (instead of min-max ports).

Thanks, David

davidcassany avatar Apr 25 '16 08:04 davidcassany

Sure! I'd be great to have unit tests for that too

saschpe avatar Apr 25 '16 14:04 saschpe

Hi, just done the pull request. I did not have time now to make the unit test, I foresee that maybe tomorrow I am gonna have time to make them. You'll see I am suggesting a different name for the script, as I am no using it for qemu but lxc.

davidcassany avatar May 01 '16 14:05 davidcassany

I sure do wish this came with an example.

tgwaste avatar Dec 07 '19 02:12 tgwaste

In case anyone ever comes across this here is an example of usage in hooks.json:

                               "port_range": [
                                       {
                                               "init_port": 5060,
                                               "ports_num": 21,
                                               "protocol": "udp"
                                       },
                                       {
                                               "init_port": 10000,
                                               "ports_num": 10001,
                                               "protocol": "udp"
                                       }
                               ]

Obviously this is for Asterisk but unfortunately it does not work. There is some problem with the data going FROM the vm -> host -> end_user that just isnt working.

tgwaste avatar Dec 07 '19 03:12 tgwaste