diff --git a/libnmstate/nm/applier.py b/libnmstate/nm/applier.py index 4d40862..26a057f 100644 --- a/libnmstate/nm/applier.py +++ b/libnmstate/nm/applier.py @@ -125,6 +125,7 @@ def apply_changes(context, net_state, save_to_disk): and cur_con_profile and cur_con_profile.profile and not net_state.ifaces[ifname].is_changed + and cur_con_profile.is_memory_only != save_to_disk ): # Don't create new profile if original desire does not ask # anything besides state:up and not been marked as changed. diff --git a/libnmstate/nm/connection.py b/libnmstate/nm/connection.py index 5804f13..1f6c734 100644 --- a/libnmstate/nm/connection.py +++ b/libnmstate/nm/connection.py @@ -163,6 +163,16 @@ class ConnectionProfile: self._con_profile = con_profile @property + def is_memory_only(self): + if self._con_profile: + profile_flags = self._con_profile.get_flags() + return ( + NM.SettingsConnectionFlags.UNSAVED & profile_flags + or NM.SettingsConnectionFlags.VOLATILE & profile_flags + ) + return False + + @property def devname(self): if self._con_profile: return self._con_profile.get_interface_name()