On 11/5/21 2:29 PM, Terry Wilson wrote:
> On Fri, Nov 5, 2021 at 6:07 AM Dumitru Ceara <[email protected]> wrote:
>>
>> On 10/20/21 10:56 PM, Terry Wilson wrote:
>>> ovsdb-tool join-cluster requires a remote addr, so the existing
>>> code that tried to join a cluster without it when there was an
>>> existing $DB_FILE would fail.
>>>
>>> Instead, if we are trying to specifically join a cluster and there
>>> is an existing $DB_FILE, back it up and remove the original before
>>> continuing to join the cluster.
>>>
>>> Signed-off-by: Terry Wilson <[email protected]>
>>> ---
>>>  utilities/ovs-lib.in | 9 ++++-----
>>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
>>> index 3eda01d3c..a710f053a 100644
>>> --- a/utilities/ovs-lib.in
>>> +++ b/utilities/ovs-lib.in
>>> @@ -519,13 +519,12 @@ join_cluster() {
>>>      LOCAL_ADDR="$3"
>>>      REMOTE_ADDR="$4"
>>>
>>> +    if test -e "$DB_FILE" && ovsdb_tool db-is-standalone "$DB_FILE"; then
>>> +        backup_db || return 1
>>> +        rm $DB_FILE
>>
>> I think this is OK, but it's a behavior change (improvement I'd say),
>> should we mention it somewhere public (NEWS?) in case users had scripts
>> that handled migration from standalone to clustered externally?
> 
> I'm never against giving more information to users. The case the patch
> is handling was completely broken before, since ovsdb-tool would exit

Right, I meant the case when some users were aware of the fact that
ovn-ctl would fail to deal with a pre-existing DB file when migrating to
clustered mode and would deal with it themselves basically by just
removing the old file.

> with error. So if someone did have an external script, would the NEWS
> item just be "The case where ovs-ctl would try to join a cluster when
> a previous DB file existed in the specified location will no longer
> exit with error, but will instead backup the existing db file and
> continue joining the cluster."?

You're right, this seems a bit awkward, maybe we should drop it all
together and just log the action like discussed below.

> 
>> Also, it's probably useful to log something here to make it more visible
>> that we backed up the standalone DB and removed the original file.
>> Wdyt?
> 
> Good point. backup_db() will handle logging the backup and I'll make
> the call to ovsdb_tool an "action" so that we log that the file is
> created joining the cluster.
> 

Cool, thanks!

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to