diff options
author | Ben Pfaff <blp@ovn.org> | 2016-04-02 09:46:30 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-04-11 21:02:26 -0700 |
commit | 3df3584256321527c1ecd192906a8a4bd89be17a (patch) | |
tree | 07dc77c35b993d35b6231b76699a7d731027a107 /python | |
parent | c775160f247487c1e5e7255a482fc2d1659bfbba (diff) | |
download | openvswitch-3df3584256321527c1ecd192906a8a4bd89be17a.tar.gz |
ovsdb: Force columns that contain weak references to be immutable.
An immutable weak reference is a hole in the constraint system: if
referenced rows are deleted, then the weak reference needs to change.
Therefore, force columsn that contain weak references to be mutable.
Reported-by: "Elluru, Krishna Mohan" <elluru.kri.mohan@hpe.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Diffstat (limited to 'python')
-rw-r--r-- | python/ovs/db/schema.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/python/ovs/db/schema.py b/python/ovs/db/schema.py index 92782df6d..8917e5d69 100644 --- a/python/ovs/db/schema.py +++ b/python/ovs/db/schema.py @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2010, 2011 Nicira, Inc. +# Copyright (c) 2009, 2010, 2011, 2016 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -265,6 +265,12 @@ class ColumnSchema(object): type_ = ovs.db.types.Type.from_json(parser.get("type", _types)) parser.finish() + if not mutable and (type_.key.is_weak_ref() + or (type_.value and type_.value.is_weak_ref())): + # We cannot allow a weak reference to be immutable: if referenced + # rows are deleted, then the weak reference needs to change. + mutable = True + return ColumnSchema(name, mutable, not ephemeral, type_) def to_json(self): |