FreeNAS/freenas b8913ddsrc/middlewared/middlewared/alembic/versions/25.10 2025-07-31_10-00_add_webshare_complete.py, src/middlewared/middlewared/api/v25_10_0 webshare.py

NAS-133371: Add complete WebShare service implementation

- Add WebShare service plugin with dataset management
- Add API endpoints and database migrations
- Add systemd service definitions for webshare and truesearch
- Add integration and unit tests
- Fix circular dependency in service startup by adding skip_reload parameter
DeltaFile
+955-0src/middlewared/middlewared/plugins/webshare.py
+475-0tests/unit/test_webshare_service.py
+414-0tests/api2/test_webshare.py
+230-0src/middlewared/middlewared/etc_files/local/nginx/nginx.conf.mako
+123-0src/middlewared/middlewared/alembic/versions/25.10/2025-07-31_10-00_add_webshare_complete.py
+102-0src/middlewared/middlewared/api/v25_10_0/webshare.py
+2,299-014 files not shown
+2,424-320 files

FreeNAS/freenas 7a8bd00src/middlewared/middlewared/api/v25_04_2 vm_device.py

Fix cdrom device path validation
DeltaFile
+1-1src/middlewared/middlewared/api/v25_04_2/vm_device.py
+1-11 files

FreeNAS/freenas c5206cdsrc/middlewared/middlewared/etc_files/sssd sssd.conf.mako

Ldap timeout bump
DeltaFile
+2-0src/middlewared/middlewared/etc_files/sssd/sssd.conf.mako
+2-01 files

FreeNAS/freenas fb04f11src/middlewared/middlewared/plugins/vm clone.py

simplify while True loops
DeltaFile
+22-22src/middlewared/middlewared/plugins/vm/clone.py
+22-221 files

FreeNAS/freenas b927a23src/middlewared/middlewared/api current.py, src/middlewared/middlewared/plugins/catalog apps.py

Update current api
DeltaFile
+1-1src/middlewared/middlewared/api/current.py
+1-1src/middlewared/middlewared/plugins/catalog/apps.py
+2-22 files

FreeNAS/freenas 96b3b21src/middlewared/middlewared/api/v26_04_0 pool_dataset.py smb.py

Add 2604 api directory
DeltaFile
+809-0src/middlewared/middlewared/api/v26_04_0/pool_dataset.py
+755-0src/middlewared/middlewared/api/v26_04_0/smb.py
+652-0src/middlewared/middlewared/api/v26_04_0/directory_services.py
+601-0src/middlewared/middlewared/api/v26_04_0/pool.py
+591-0src/middlewared/middlewared/api/v26_04_0/app.py
+556-0src/middlewared/middlewared/api/v26_04_0/vm.py
+3,964-0123 files not shown
+19,419-0129 files

FreeNAS/freenas 9ccfd3asrc/middlewared/middlewared/plugins/apps ix_volumes.py

remove zfs.dataset.query from apps/ix_volumes.py
DeltaFile
+8-4src/middlewared/middlewared/plugins/apps/ix_volumes.py
+8-41 files

FreeNAS/freenas 53f1179src/middlewared/middlewared alembic.ini, src/middlewared/middlewared/alembic/versions/26.04 .gitkeep

NAS-136960 / 26.04 / Add halfmoon migration directory for alembic (#16847)

DeltaFile
+1-1src/middlewared/middlewared/alembic.ini
+0-0src/middlewared/middlewared/alembic/versions/26.04/.gitkeep
+1-12 files

FreeNAS/freenas 5a40097src/middlewared/middlewared/api/base model.py, src/middlewared/middlewared/pytest/unit/api/base test_model.py

NAS-136763 / 26.04 / Allow no args on some API methods (#16774)

The `single_argument_arg` decorator makes the single dictionary argument
required, even if all of its fields have defaults. This PR makes the
following methods so that they can be called without passing any
arguments instead of passing an empty dictionary.

* `filesystem.acltemplate.by_path`
* `catalog.apps`
* `core.arp`
* `core.debug`
* `group.get_group_obj`
* `sharing.smb.share_precheck`
* `user.get_user_obj`

http://jenkins.eng.ixsystems.net:8080/job/tests/job/api_tests/5370/
DeltaFile
+19-0src/middlewared/middlewared/pytest/unit/api/base/test_model.py
+8-2src/middlewared/middlewared/api/base/model.py
+27-22 files

FreeNAS/freenas d34d5b1src/middlewared/middlewared/plugins/service_/services base.py incus.py

NAS-136921 / 25.10-RC.1 / plug a slow memory leak in service.* api (by yocalebo) (#16846)

Investigating the peculiar scenario outlined in
https://github.com/truenas/middleware/pull/16836, I saw that the parent
process was consuming ~19GB of resident memory. The loop was spinning
running `core.bulk` api calls, more specifically `service.restart`. I
created a very simple script that runs `service.restart <service>` in a
`while True` loop. Monitoring the parent process in top, the resident
memory would grow sporadically in chunks. A bit more investigation using
`tracemalloc` and `resource` modules, I saw that there were some
left-over references to objects from `pystemd` module. I found that
upstream had a memory leak related to the `Unit` class but that was
fixed back in 2018. I also confirmed that our version doesn't suffer
from that memory leak but I was still suspicious.

I ended up forcefully `del unit` and `del job_object` items and ran my
script again. With my changes, there are still some allocations taking
up memory in the parent process, however, they stabilized and did not
produce the same behavior from before my changes.

    [9 lines not shown]
DeltaFile
+81-63src/middlewared/middlewared/plugins/service_/services/base.py
+5-2src/middlewared/middlewared/plugins/service_/services/incus.py
+86-652 files

FreeNAS/freenas a80be1asrc/middlewared/middlewared/plugins/service_/services base.py incus.py

NAS-136921 / 26.04 / plug a slow memory leak in service.* api (#16842)

Investigating the peculiar scenario outlined in
https://github.com/truenas/middleware/pull/16836, I saw that the parent
process was consuming ~19GB of resident memory. The loop was spinning
running `core.bulk` api calls, more specifically `service.restart`. I
created a very simple script that runs `service.restart <service>` in a
`while True` loop. Monitoring the parent process in top, the resident
memory would grow sporadically in chunks. A bit more investigation using
`tracemalloc` and `resource` modules, I saw that there were some
left-over references to objects from `pystemd` module. I found that
upstream had a memory leak related to the `Unit` class but that was
fixed back in 2018. I also confirmed that our version doesn't suffer
from that memory leak but I was still suspicious.

I ended up forcefully `del unit` and `del job_object` items and ran my
script again. With my changes, there are still some allocations taking
up memory in the parent process, however, they stabilized and did not
produce the same behavior from before my changes.

    [3 lines not shown]
DeltaFile
+81-63src/middlewared/middlewared/plugins/service_/services/base.py
+5-2src/middlewared/middlewared/plugins/service_/services/incus.py
+86-652 files

FreeNAS/freenas 0bb573fsrc/middlewared/middlewared/api/v25_10_0 directory_services.py, src/middlewared/middlewared/plugins/directoryservices_ datastore.py

Fix choices endpoint
DeltaFile
+1-1src/middlewared/middlewared/api/v25_10_0/directory_services.py
+1-1src/middlewared/middlewared/plugins/directoryservices_/datastore.py
+2-22 files

FreeNAS/freenas 8006066src/middlewared/middlewared/api/v25_04_2 vm_device.py, src/middlewared/middlewared/plugins/vm/devices display.py

NAS-136941 / 25.04.2.1 / Fix display device password/port validation (by Qubad786) (#16843)

Automatic cherry-pick failed. Please resolve conflicts by running:

    git reset --hard HEAD~1
    git cherry-pick -x 8a5acc7c88b1761c8de39334eff876dff1a3596f

If the original PR was merged via a squash, you can just cherry-pick the
squashed commit:

    git reset --hard HEAD~1
    git cherry-pick -x 362936694803252db897818607dac614182ad741

## Problem

We have users who had old VMs where `web_port` could be 5800 and also
`passoword` as an optional field. Around bluefin, we changed this
behaviour to make sure that ports below 5900 cannot be used for new
display devices and that display devices require a password.

    [10 lines not shown]
DeltaFile
+9-0src/middlewared/middlewared/plugins/vm/devices/display.py
+2-2src/middlewared/middlewared/api/v25_04_2/vm_device.py
+11-22 files

FreeNAS/freenas 7399428src/middlewared/middlewared/api/v25_10_0 vm_device.py, src/middlewared/middlewared/plugins/vm/devices display.py

NAS-136941 / 25.10 / Fix display device password/port validation (#16839)

## Problem

We have users who had old VMs where `web_port` could be 5800 and also
`passoword` as an optional field. Around bluefin, we changed this
behaviour to make sure that ports below 5900 cannot be used for new
display devices and that display devices require a password.
However with the change to pydantic, these validations got moved to
query as well which breaks these existing consumers.

## Solution

Make sure we do not validate this data when we are querying these
devices as we don't want to break existing consumers.
DeltaFile
+9-0src/middlewared/middlewared/plugins/vm/devices/display.py
+2-2src/middlewared/middlewared/api/v25_10_0/vm_device.py
+11-22 files

FreeNAS/freenas 50d3345src/middlewared/middlewared/etc_files/local/openldap ldap.conf.mako, src/middlewared/middlewared/etc_files/sssd sssd.conf.mako

Fix validation and handling of MTLS cert for LDAP

This commit fixes several bugs related to handling of MTLS certificates
in the LDAP / SSSD config as well as the datastore plugin. CI tests will
be added in separate PR once we have a google domain for jenkins
testing.
DeltaFile
+4-4src/middlewared/middlewared/plugins/directoryservices_/datastore.py
+1-1src/middlewared/middlewared/etc_files/local/openldap/ldap.conf.mako
+1-1src/middlewared/middlewared/etc_files/sssd/sssd.conf.mako
+1-1src/middlewared/middlewared/plugins/directoryservices_/cert_attachments.py
+7-74 files

FreeNAS/freenas 9b23ce1src/middlewared/middlewared/api/v25_04_2 vm_device.py, src/middlewared/middlewared/plugins/vm/devices display.py

Fix display device password/port validation
DeltaFile
+9-0src/middlewared/middlewared/plugins/vm/devices/display.py
+2-2src/middlewared/middlewared/api/v25_04_2/vm_device.py
+11-22 files

FreeNAS/freenas 912d77c

Empty commit to create PR on github.

You should reset it
DeltaFile
+0-00 files

FreeNAS/freenas 9513224src/middlewared/middlewared/plugins usage.py

Include method stats in usage plugin
DeltaFile
+8-0src/middlewared/middlewared/plugins/usage.py
+8-01 files

FreeNAS/freenas 0926678src/middlewared/middlewared/plugins/audit audit.py

Add an endpoint to retrieve audit stats for middleware methods
DeltaFile
+50-0src/middlewared/middlewared/plugins/audit/audit.py
+50-01 files

FreeNAS/freenas 8a5acc7src/middlewared/middlewared/api/v25_10_0 vm_device.py, src/middlewared/middlewared/plugins/vm/devices display.py

Fix display device password/port validation
DeltaFile
+9-0src/middlewared/middlewared/plugins/vm/devices/display.py
+2-2src/middlewared/middlewared/api/v25_10_0/vm_device.py
+11-22 files

FreeNAS/freenas dee0b59src/middlewared/middlewared/plugins failover.py

NAS-136920 / 24.10.2.4 / fix busy loop on HA wrt to service.* actions (by yocalebo) (by bugclerk) (#16840)

On an internal system, an HA system was exposed to a network
segmentation between the controllers. This caused both controllers to
become MASTER. This caused a busy-loop of core.bulk service.restart
calls to be sent back and forth to each controller endlessly. To remedy
this situation I've added an extra check to ensure that
`failover.disabled.reasons` needs to be empty before forwarding the
remote call.

Original PR: https://github.com/truenas/middleware/pull/16836


Original PR: https://github.com/truenas/middleware/pull/16837

---------

Co-authored-by: Caleb <yocalebo at gmail.com>
DeltaFile
+16-0src/middlewared/middlewared/plugins/failover.py
+16-01 files

FreeNAS/freenas 46adf11src/middlewared/middlewared/plugins failover.py

fix missing import (#16841)

DeltaFile
+1-0src/middlewared/middlewared/plugins/failover.py
+1-01 files

FreeNAS/freenas b9428a1src/middlewared/middlewared/plugins failover.py

add missing import
DeltaFile
+1-0src/middlewared/middlewared/plugins/failover.py
+1-01 files

FreeNAS/freenas 6126269src/middlewared/middlewared/plugins/service_/services base.py incus.py

plug a slow memory leak in service.* api
DeltaFile
+78-63src/middlewared/middlewared/plugins/service_/services/base.py
+5-2src/middlewared/middlewared/plugins/service_/services/incus.py
+83-652 files

FreeNAS/freenas 0de2d39src/middlewared/middlewared/plugins failover.py

fix busy loop on HA wrt to service.* actions

(cherry picked from commit 7af06c7f3631dc1b908adcdb6cf4dec5f8bfbd33)
(cherry picked from commit 4a88c4a793b6cc13d153edcb3be9b7fded2b0c32)
DeltaFile
+15-0src/middlewared/middlewared/plugins/failover.py
+15-01 files

FreeNAS/freenas 0b7f7b2src/middlewared/middlewared/plugins failover.py

simplify logging statement

(cherry picked from commit f3de45e11bd1bd7c0237e413116286ee3529e8e5)
(cherry picked from commit aee61e87d77b75fd3b8dce02b4cf33d88de77905)
DeltaFile
+1-1src/middlewared/middlewared/plugins/failover.py
+1-11 files

FreeNAS/freenas 0c60af8src/middlewared/middlewared/api/v25_10_0 vm_device.py, src/middlewared/middlewared/plugins/vm/devices display.py

Fix display device password/port validation
DeltaFile
+9-0src/middlewared/middlewared/plugins/vm/devices/display.py
+2-2src/middlewared/middlewared/api/v25_10_0/vm_device.py
+11-22 files

FreeNAS/freenas 0f80d64src/middlewared/middlewared/plugins failover.py

NAS-136949 / 25.10 / Ignore libvirt service actions in service_remote on HA systems (#16838)

This is the "belt and suspenders" approach that compliments the changes
introduced here https://github.com/truenas/middleware/pull/16830. With
those changes this shouldn't be possible, however, it's better to be
safe than sorry. While I'm here, I went ahead and added some comments to
explain what each if-condition does and it's context.
DeltaFile
+26-7src/middlewared/middlewared/plugins/failover.py
+26-71 files

FreeNAS/freenas 7b7239dsrc/middlewared/middlewared/plugins failover.py

NAS-136920 / 25.04.2.1 / fix busy loop on HA wrt to service.* actions (by yocalebo) (#16837)

On an internal system, an HA system was exposed to a network
segmentation between the controllers. This caused both controllers to
become MASTER. This caused a busy-loop of core.bulk service.restart
calls to be sent back and forth to each controller endlessly. To remedy
this situation I've added an extra check to ensure that
`failover.disabled.reasons` needs to be empty before forwarding the
remote call.

Original PR: https://github.com/truenas/middleware/pull/16836

---------

Co-authored-by: Caleb <yocalebo at gmail.com>
DeltaFile
+15-0src/middlewared/middlewared/plugins/failover.py
+15-01 files

FreeNAS/freenas ddd2656src/middlewared/middlewared/plugins failover.py

NAS-136920 / 25.10 / fix busy loop on HA wrt to service.* actions (#16836)

On an internal system, an HA system was exposed to a network
segmentation between the controllers. This caused both controllers to
become MASTER. This caused a busy-loop of core.bulk service.restart
calls to be sent back and forth to each controller endlessly. To remedy
this situation I've added an extra check to ensure that
`failover.disabled.reasons` needs to be empty before forwarding the
remote call.
DeltaFile
+15-0src/middlewared/middlewared/plugins/failover.py
+15-01 files