networkctl,networkd: add --no-reconfigure flag to networkctl reload
Add a new --no-reconfigure flag to 'networkctl reload' that reloads .network and .netdev files from disk without reconfiguring any network interfaces. This may be useful to avoid reconfiguring multiple interfaces simultaneously when multiple .network files are updated, or when an updated .network file is applied to multiple interfaces. On the networkd side, manager_reload() gains a reconfigure_links parameter that gates the per-link reconfiguration loop. A new io.systemd.Network.Reload varlink method is added that exposes this as an optional reconfigureLinks boolean (defaults to true). Both plain 'networkctl reload' and '--no-reconfigure' now unconditionally call this method first. If an older networkd returns MethodNotFound, plain reload falls back to io.systemd.service.Reload for backward compatibility; '--no-reconfigure' fails with a clear error in that case.
This commit is contained in:
committed by
Yu Watanabe
parent
1166f4472d
commit
13aec9fddf
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "bus-polkit.h"
|
||||
#include "varlink-io.systemd.Network.h"
|
||||
|
||||
/* Helper macro to define address fields with both binary and string representation */
|
||||
@@ -544,6 +545,12 @@ SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||
SD_VARLINK_FIELD_COMMENT("Current transmit/receive bitrates from speed meter"),
|
||||
SD_VARLINK_DEFINE_FIELD_BY_TYPE(BitRates, BitRates, SD_VARLINK_NULLABLE));
|
||||
|
||||
static SD_VARLINK_DEFINE_METHOD(
|
||||
Reload,
|
||||
SD_VARLINK_FIELD_COMMENT("If true (default), reload config files and reconfigure all matching network interfaces. If false, only reload config files without reconfiguring interfaces; use 'networkctl reconfigure' afterwards to apply changes selectively."),
|
||||
SD_VARLINK_DEFINE_INPUT(reconfigureLinks, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||
VARLINK_DEFINE_POLKIT_INPUT);
|
||||
|
||||
static SD_VARLINK_DEFINE_METHOD(
|
||||
Describe,
|
||||
SD_VARLINK_FIELD_COMMENT("All network interfaces managed by systemd-networkd"),
|
||||
@@ -612,6 +619,7 @@ SD_VARLINK_DEFINE_INTERFACE(
|
||||
&vl_method_GetStates,
|
||||
&vl_method_GetNamespaceId,
|
||||
&vl_method_GetLLDPNeighbors,
|
||||
&vl_method_Reload,
|
||||
&vl_method_SetPersistentStorage,
|
||||
&vl_type_Address,
|
||||
&vl_type_BitRates,
|
||||
|
||||
Reference in New Issue
Block a user