diff mbox series

[ovs-dev,05/22] ovsdb: trigger: Do not allow conversion in read-only mode.

Message ID 20231214010431.1664005-6-i.maximets@ovn.org
State Accepted
Commit 94371c0996b4fb92133ebdda847ad279265a2803
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,01/22] ovsdb-server.at: Enbale debug logs in active-backup tests. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets Dec. 14, 2023, 1:04 a.m. UTC
It's not a big problem, but it would be nice to ensure that
the backup database cannot be locally converted.

Fixes: e51879e99b3e ("ovsdb: Make OVSDB backup sever read only")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 ovsdb/trigger.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Mike Pattrick Jan. 2, 2024, 3:54 p.m. UTC | #1
On Wed, Dec 13, 2023 at 8:05 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> It's not a big problem, but it would be nice to ensure that
> the backup database cannot be locally converted.
>
> Fixes: e51879e99b3e ("ovsdb: Make OVSDB backup sever read only")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Acked-by: Mike Pattrick <mkp@redhat.com>
Ilya Maximets Jan. 9, 2024, 12:07 p.m. UTC | #2
On 1/2/24 16:54, Mike Pattrick wrote:
> On Wed, Dec 13, 2023 at 8:05 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>>
>> It's not a big problem, but it would be nice to ensure that
>> the backup database cannot be locally converted.
>>
>> Fixes: e51879e99b3e ("ovsdb: Make OVSDB backup sever read only")
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> 
> Acked-by: Mike Pattrick <mkp@redhat.com>
> 

Thanks!  I applied all the bug and test fixes (first 5 patches)
to appropriate branches.  I'll work on v2 of the rest of the set
addressing the accumulated comments.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c
index 0edcdd89c..2a48ccc64 100644
--- a/ovsdb/trigger.c
+++ b/ovsdb/trigger.c
@@ -278,6 +278,14 @@  ovsdb_trigger_try(struct ovsdb_trigger *t, long long int now)
                 return false;
             }
 
+            if (t->read_only) {
+                trigger_convert_error(
+                    t, ovsdb_error("not allowed", "conversion is not allowed "
+                                                  "for read-only database %s",
+                                                  t->db->schema->name));
+                return false;
+            }
+
             /* Validate parameters. */
             const struct json *params = t->request->params;
             if (params->type != JSON_ARRAY || params->array.n != 2) {