diff mbox series

[ovs-dev] ovs-sandbox: Allow specifying initial contents for OVS and VTEP databases.

Message ID 20220517104746.7798-1-dceara@redhat.com
State Accepted
Headers show
Series [ovs-dev] ovs-sandbox: Allow specifying initial contents for OVS and VTEP databases. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Dumitru Ceara May 17, 2022, 10:47 a.m. UTC
This makes it easier to troubleshoot OVN in a sandbox when initial
contents for the NB/SB/OVS DBs are provided (e.g., from a production
environment).

A way to load the DBs locally and run OVN against them is:
$ SANDBOXFLAGS="--nbdb-source=path-to-nb.db --sbdb-source=path-to-sb.db --ovs-source=path-to-conf.db" make sandbox

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
 tutorial/ovs-sandbox | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

Comments

Mark Michelson May 19, 2022, 8:16 p.m. UTC | #1
Acked-by: Mark Michelson <mmichels@redhat.com>

Since this is a new feature introduced after soft freeze for 22.06, this 
shouldn't be a candidate for 22.06. However, personally I feel this is 
so low-risk (and so useful) that it should be included. Does anyone 
disagree?

On 5/17/22 06:47, Dumitru Ceara wrote:
> This makes it easier to troubleshoot OVN in a sandbox when initial
> contents for the NB/SB/OVS DBs are provided (e.g., from a production
> environment).
> 
> A way to load the DBs locally and run OVN against them is:
> $ SANDBOXFLAGS="--nbdb-source=path-to-nb.db --sbdb-source=path-to-sb.db --ovs-source=path-to-conf.db" make sandbox
> 
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>
> ---
>   tutorial/ovs-sandbox | 28 ++++++++++++++++++++++++++--
>   1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
> index d81e00496..2219b0e99 100755
> --- a/tutorial/ovs-sandbox
> +++ b/tutorial/ovs-sandbox
> @@ -79,6 +79,8 @@ ovn_rbac=true
>   n_northds=1
>   n_ics=1
>   n_controllers=1
> +ovs_source=
> +vtep_source=
>   nbdb_model=standalone
>   nbdb_servers=3
>   nbdb_source=
> @@ -307,6 +309,18 @@ EOF
>           --sbdb-so*)
>               prev=ovnsb_source
>               ;;
> +        --ovs-so*=*)
> +            ovs_source=$optarg
> +            ;;
> +        --ovs-so*)
> +            prev=ovs_source
> +            ;;
> +        --vtep-so*=*)
> +            vtep_source=$optarg
> +            ;;
> +        --vtep-so*)
> +            prev=vtep_source
> +            ;;
>           --ic-nb-s*=*)
>               ic_nb_servers=$optarg
>               ic_nb_model=clustered
> @@ -474,10 +488,20 @@ trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15
>   
>   # Create database and start ovsdb-server.
>   touch "$sandbox"/.conf.db.~lock~
> -run ovsdb-tool create conf.db "$schema"
> +if test ! -e "$ovs_source"; then
> +    run ovsdb-tool create conf.db "$schema"
> +else
> +    run cp "$ovs_source" conf.db
> +    run ovsdb-tool convert conf.db "$schema"
> +fi
>   ovsdb_server_args=
>   
> -run ovsdb-tool create vtep.db "$vtep_schema"
> +if test ! -e "$vtep_source"; then
> +    run ovsdb-tool create vtep.db "$vtep_schema"
> +else
> +    run cp "$vtep_source" vtep.db
> +    run ovsdb-tool convert vtep.db "$vtep_schema"
> +fi
>   ovsdb_server_args="vtep.db conf.db"
>   
>   if [ "$HAVE_OPENSSL" = yes ]; then
>
Numan Siddique May 19, 2022, 8:19 p.m. UTC | #2
On Thu, May 19, 2022 at 4:17 PM Mark Michelson <mmichels@redhat.com> wrote:
>
> Acked-by: Mark Michelson <mmichels@redhat.com>
>
> Since this is a new feature introduced after soft freeze for 22.06, this
> shouldn't be a candidate for 22.06. However, personally I feel this is
> so low-risk (and so useful) that it should be included. Does anyone
> disagree?

I'm fine.  It would be helpful for debugging.
I can take a look and merge it.

Numan

>
> On 5/17/22 06:47, Dumitru Ceara wrote:
> > This makes it easier to troubleshoot OVN in a sandbox when initial
> > contents for the NB/SB/OVS DBs are provided (e.g., from a production
> > environment).
> >
> > A way to load the DBs locally and run OVN against them is:
> > $ SANDBOXFLAGS="--nbdb-source=path-to-nb.db --sbdb-source=path-to-sb.db --ovs-source=path-to-conf.db" make sandbox
> >
> > Signed-off-by: Dumitru Ceara <dceara@redhat.com>
> > ---
> >   tutorial/ovs-sandbox | 28 ++++++++++++++++++++++++++--
> >   1 file changed, 26 insertions(+), 2 deletions(-)
> >
> > diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
> > index d81e00496..2219b0e99 100755
> > --- a/tutorial/ovs-sandbox
> > +++ b/tutorial/ovs-sandbox
> > @@ -79,6 +79,8 @@ ovn_rbac=true
> >   n_northds=1
> >   n_ics=1
> >   n_controllers=1
> > +ovs_source=
> > +vtep_source=
> >   nbdb_model=standalone
> >   nbdb_servers=3
> >   nbdb_source=
> > @@ -307,6 +309,18 @@ EOF
> >           --sbdb-so*)
> >               prev=ovnsb_source
> >               ;;
> > +        --ovs-so*=*)
> > +            ovs_source=$optarg
> > +            ;;
> > +        --ovs-so*)
> > +            prev=ovs_source
> > +            ;;
> > +        --vtep-so*=*)
> > +            vtep_source=$optarg
> > +            ;;
> > +        --vtep-so*)
> > +            prev=vtep_source
> > +            ;;
> >           --ic-nb-s*=*)
> >               ic_nb_servers=$optarg
> >               ic_nb_model=clustered
> > @@ -474,10 +488,20 @@ trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15
> >
> >   # Create database and start ovsdb-server.
> >   touch "$sandbox"/.conf.db.~lock~
> > -run ovsdb-tool create conf.db "$schema"
> > +if test ! -e "$ovs_source"; then
> > +    run ovsdb-tool create conf.db "$schema"
> > +else
> > +    run cp "$ovs_source" conf.db
> > +    run ovsdb-tool convert conf.db "$schema"
> > +fi
> >   ovsdb_server_args=
> >
> > -run ovsdb-tool create vtep.db "$vtep_schema"
> > +if test ! -e "$vtep_source"; then
> > +    run ovsdb-tool create vtep.db "$vtep_schema"
> > +else
> > +    run cp "$vtep_source" vtep.db
> > +    run ovsdb-tool convert vtep.db "$vtep_schema"
> > +fi
> >   ovsdb_server_args="vtep.db conf.db"
> >
> >   if [ "$HAVE_OPENSSL" = yes ]; then
> >
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Numan Siddique May 19, 2022, 8:36 p.m. UTC | #3
On Thu, May 19, 2022 at 4:19 PM Numan Siddique <numans@ovn.org> wrote:
>
> On Thu, May 19, 2022 at 4:17 PM Mark Michelson <mmichels@redhat.com> wrote:
> >
> > Acked-by: Mark Michelson <mmichels@redhat.com>
> >
> > Since this is a new feature introduced after soft freeze for 22.06, this
> > shouldn't be a candidate for 22.06. However, personally I feel this is
> > so low-risk (and so useful) that it should be included. Does anyone
> > disagree?
>
> I'm fine.  It would be helpful for debugging.
> I can take a look and merge it.

Applied to main,

Thanks
Numan

>
> Numan
>
> >
> > On 5/17/22 06:47, Dumitru Ceara wrote:
> > > This makes it easier to troubleshoot OVN in a sandbox when initial
> > > contents for the NB/SB/OVS DBs are provided (e.g., from a production
> > > environment).
> > >
> > > A way to load the DBs locally and run OVN against them is:
> > > $ SANDBOXFLAGS="--nbdb-source=path-to-nb.db --sbdb-source=path-to-sb.db --ovs-source=path-to-conf.db" make sandbox
> > >
> > > Signed-off-by: Dumitru Ceara <dceara@redhat.com>
> > > ---
> > >   tutorial/ovs-sandbox | 28 ++++++++++++++++++++++++++--
> > >   1 file changed, 26 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
> > > index d81e00496..2219b0e99 100755
> > > --- a/tutorial/ovs-sandbox
> > > +++ b/tutorial/ovs-sandbox
> > > @@ -79,6 +79,8 @@ ovn_rbac=true
> > >   n_northds=1
> > >   n_ics=1
> > >   n_controllers=1
> > > +ovs_source=
> > > +vtep_source=
> > >   nbdb_model=standalone
> > >   nbdb_servers=3
> > >   nbdb_source=
> > > @@ -307,6 +309,18 @@ EOF
> > >           --sbdb-so*)
> > >               prev=ovnsb_source
> > >               ;;
> > > +        --ovs-so*=*)
> > > +            ovs_source=$optarg
> > > +            ;;
> > > +        --ovs-so*)
> > > +            prev=ovs_source
> > > +            ;;
> > > +        --vtep-so*=*)
> > > +            vtep_source=$optarg
> > > +            ;;
> > > +        --vtep-so*)
> > > +            prev=vtep_source
> > > +            ;;
> > >           --ic-nb-s*=*)
> > >               ic_nb_servers=$optarg
> > >               ic_nb_model=clustered
> > > @@ -474,10 +488,20 @@ trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15
> > >
> > >   # Create database and start ovsdb-server.
> > >   touch "$sandbox"/.conf.db.~lock~
> > > -run ovsdb-tool create conf.db "$schema"
> > > +if test ! -e "$ovs_source"; then
> > > +    run ovsdb-tool create conf.db "$schema"
> > > +else
> > > +    run cp "$ovs_source" conf.db
> > > +    run ovsdb-tool convert conf.db "$schema"
> > > +fi
> > >   ovsdb_server_args=
> > >
> > > -run ovsdb-tool create vtep.db "$vtep_schema"
> > > +if test ! -e "$vtep_source"; then
> > > +    run ovsdb-tool create vtep.db "$vtep_schema"
> > > +else
> > > +    run cp "$vtep_source" vtep.db
> > > +    run ovsdb-tool convert vtep.db "$vtep_schema"
> > > +fi
> > >   ovsdb_server_args="vtep.db conf.db"
> > >
> > >   if [ "$HAVE_OPENSSL" = yes ]; then
> > >
> >
> > _______________________________________________
> > dev mailing list
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
diff mbox series

Patch

diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox
index d81e00496..2219b0e99 100755
--- a/tutorial/ovs-sandbox
+++ b/tutorial/ovs-sandbox
@@ -79,6 +79,8 @@  ovn_rbac=true
 n_northds=1
 n_ics=1
 n_controllers=1
+ovs_source=
+vtep_source=
 nbdb_model=standalone
 nbdb_servers=3
 nbdb_source=
@@ -307,6 +309,18 @@  EOF
         --sbdb-so*)
             prev=ovnsb_source
             ;;
+        --ovs-so*=*)
+            ovs_source=$optarg
+            ;;
+        --ovs-so*)
+            prev=ovs_source
+            ;;
+        --vtep-so*=*)
+            vtep_source=$optarg
+            ;;
+        --vtep-so*)
+            prev=vtep_source
+            ;;
         --ic-nb-s*=*)
             ic_nb_servers=$optarg
             ic_nb_model=clustered
@@ -474,10 +488,20 @@  trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15
 
 # Create database and start ovsdb-server.
 touch "$sandbox"/.conf.db.~lock~
-run ovsdb-tool create conf.db "$schema"
+if test ! -e "$ovs_source"; then
+    run ovsdb-tool create conf.db "$schema"
+else
+    run cp "$ovs_source" conf.db
+    run ovsdb-tool convert conf.db "$schema"
+fi
 ovsdb_server_args=
 
-run ovsdb-tool create vtep.db "$vtep_schema"
+if test ! -e "$vtep_source"; then
+    run ovsdb-tool create vtep.db "$vtep_schema"
+else
+    run cp "$vtep_source" vtep.db
+    run ovsdb-tool convert vtep.db "$vtep_schema"
+fi
 ovsdb_server_args="vtep.db conf.db"
 
 if [ "$HAVE_OPENSSL" = yes ]; then