Feature #1683

Option for OpenNebula to bootstrap the database.

Added by Robert Schweikert over 8 years ago. Updated over 7 years ago.

Status:ClosedStart date:12/06/2012
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Core & System
Target version:Release 4.4
Resolution:fixed Pull request:

Description

Add init functionality that allows a user/administrator to just initialize the database without running the oned process after the initialization.

At present the only way to get the DB base bootstrapped is by actually running the oned process. This has the disadvantage that in automated proceses, such as demonstrated here http://en.opensuse.org/SDB:KIWI_Cookbook_ONebula_Cloud one has to start the oned process and then hope DB initialization completes in the expected time before killing the process. An init function will take the "guess work" out of DB bootstrap. One can call init and the process will just bootstrap the DB if necessary and then exit.

A second problem addressed with the init functionality is that we can assure that the DB is bootstrapped prior to checking the version. This avoid confusing messages in the log file. At present a "not the proper version" message is written to the log file if the DB does not exist.

It would be great to get this for 4.0

0001-implement-an-init-method-for-the-nebula-daemon.patch Magnifier (12.2 KB) Robert Schweikert, 12/06/2012 09:46 PM

0001-create-a-way-to-initialize-without-service-start.patch Magnifier (9.83 KB) Robert Schweikert, 10/05/2013 07:48 PM

Associated revisions

Revision 20548363
Added by Robert Schweikert over 7 years ago

Feature #1683: create a way to initialize without service start + This allows a mode to just initialize the database + Changes the decision making about DB bootstrapping such that a missing DB no longer produces misleading messages in the log file + Allows the DB to be initialized/bootstrapped during an automated install process without having to wait for some arbitrary time to kill the daemon - return the SQL error code from the DB::exec method + This allows to make decisions about DB bootstrapping earlier and avoids misleading messages in the log file

Revision a9bccd44
Added by Carlos Martín over 7 years ago

Feature #1683: Simplify bootstrap methods

Revision 4cc34621
Added by Carlos Martín over 7 years ago

Feature #1683: Make initial sql queries quiet, so errors do not show in log

Revision 09fe471a
Added by Ruben S. Montero over 7 years ago

feature #1683: Renamed Nebula::init() to Nebula::bootstrap_db()

History

#1 Updated by Robert Schweikert over 8 years ago

The attached patch implements an init method on the Nebula class. This meets the requirements described in the issue description and addresses the issue with the confusing error message.

The patch needs some additional testing for the mysql option. I tested the implementation when using the sqlite code path. I do not have a mysql setup handy for testing sorry.

#2 Updated by Jaime Melis about 8 years ago

Hi Robert,

what are the benefits of having the DB bootstrapped before the first run?

#3 Updated by Robert Schweikert about 8 years ago

We can avoid the misleading eroor/warning messages in the log file that we get today.

When installing the code inside an image and activating the service in a firstboot procedure the problem is that it is unknown when the initialization of the DB is complete, thus when the service is restarted after first boot the DB may be in an inconsistent state causing problems.

#4 Updated by Ruben S. Montero about 8 years ago

  • Category set to Core & System

#5 Updated by Ruben S. Montero about 8 years ago

We can implement this as an option of oned (oned --bootstrap). That way it'll easy.
Robert Schweikert wrote:

We can avoid the misleading eroor/warning messages in the log file that we get today.

When installing the code inside an image and activating the service in a firstboot procedure the problem is that it is unknown when the initialization of the DB is complete, thus when the service is restarted after first boot the DB may be in an inconsistent state causing problems.

#6 Updated by Ruben S. Montero about 8 years ago

  • Priority changed from Normal to Low

#7 Updated by Ruben S. Montero about 8 years ago

  • Subject changed from Add init functionality to Option for OpenNebula to bootstrap the database.

#8 Updated by Robert Schweikert over 7 years ago

Hi,

I forward ported this patch to the current HEAD. It is a pain for me to maintain and test the packages without this patch.

I understand that there may be other ways to get the same thing done. However, as there is no other implementation could you please be so kind and apply this patch.

If you ever get around to implement a different way to get the same result this is reasonably easy to remove.

It is not quite fair to make me duplicate my own work over and over for every release of openNebula.

AFAIK, the changes have no ill effect on current behavior and they meet the apparent coding style. This issue has been open for almost a year which is quite frustrating.

If there is a bug in the code or some other code related issue with the patch please let me know and I'll fix it. However don't make me sit here waiting for an alternate implementation that you guys obviously have not time to implement.

#9 Updated by Carlos Martín over 7 years ago

  • Target version set to Release 4.4

Hi Robert,

Thanks a lot for the patch. Code looks great, I redid the Nebula.cc part just because with less changes we can forget about writing specific tests.

Sometimes it is hard to find the time to review everything, and some low priority tickets simply get forgotten...

Cheers

#10 Updated by Ruben S. Montero over 7 years ago

This is now in master

#11 Updated by Ruben S. Montero over 7 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Also available in: Atom PDF