Backlog #4289

onedb patch should permit to apply several modifications in one pass

Added by EOLE Team over 5 years ago. Updated over 5 years ago.

Status:PendingStart date:01/13/2016
Priority:HighDue date:
Assignee:-% Done:

0%

Category:CLI
Target version:-

Description

Hello,

I hit #4000 and apply the procedure of onedb patch to fix the history time.

I have several VMs with several sequences each, I need to run the onedb patch command several time which is long since the command will do a backup of the database before doing anything.

The tool should ask after each VM if the user wants to make another change or quit (default action), something likeĀ :

onedb patch -v --sqlite /var/lib/one/one.db /usr/lib/one/ruby/onedb/patches/history_times.rb
Version read:
Shared tables 4.11.80 : OpenNebula 4.14.1 daemon bootstrap
Local tables  4.13.85 : OpenNebula 4.14.1 daemon bootstrap

Sqlite database backup stored in /var/lib/one/one.db_2015-10-13_12:40:2.bck
Use 'onedb restore' or copy the file back to restore the DB.

  > Running patch /usr/lib/one/ruby/onedb/patches/history_times.rb
This tool will allow you to edit the timestamps of VM history records, used to calculate accounting and showback.
VM ID or q|quit to quit: 1
History sequence number: 0

STIME   Start time          : 2015-10-08 15:24:06 UTC
PSTIME  Prolog start time   : 2015-10-08 15:24:06 UTC
PETIME  Prolog end time     : 2015-10-08 15:24:29 UTC
RSTIME  Running start time  : 2015-10-08 15:24:29 UTC
RETIME  Running end time    : 2015-10-08 15:42:35 UTC
ESTIME  Epilog start time   : 2015-10-08 15:42:35 UTC
EETIME  Epilog end time     : 2015-10-08 15:42:36 UTC
ETIME   End time            : 2015-10-08 15:42:36 UTC

To set new values:
  empty to use current value; <YYYY-MM-DD HH:MM:SS> in UTC; or 0 to leave unset (open history record).
STIME   Start time          : 2015-10-08 15:24:06 UTC
New value                   :

ETIME   End time            : 2015-10-08 15:42:36 UTC
New value                   :

The history record # 0 for VM 1 will be updated with these new values:
STIME   Start time          : 2015-10-08 15:24:06 UTC
PSTIME  Prolog start time   : 2015-10-08 15:24:06 UTC
PETIME  Prolog end time     : 2015-10-08 15:24:29 UTC
RSTIME  Running start time  : 2015-10-08 15:24:29 UTC
RETIME  Running end time    : 2015-10-08 15:42:35 UTC
ESTIME  Epilog start time   : 2015-10-08 15:42:35 UTC
EETIME  Epilog end time     : 2015-10-08 15:42:36 UTC
ETIME   End time            : 2015-10-08 15:42:36 UTC

Confirm to write to the database [Y/n]: y
  > Done

This tool will allow you to edit the timestamps of VM history records, used to calculate accounting and showback.
VM ID or q|quit to quit: q

  > Total time: 27.79s

This way, a single DB backup can be done for several modifications.

Regards.

History

#1 Updated by Ruben S. Montero over 5 years ago

  • Tracker changed from Request to Backlog
  • Priority changed from Normal to High

Also available in: Atom PDF