Skip to content

Provides a prompt oriented interface to explore the XAPI database

License

Notifications You must be signed in to change notification settings

gthvn1/xapidb_in_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This tool parses an XAPI database XML file, builds an in-memory relational database, and provides a prompt-oriented interface to explore the database using OpaqueRef identifiers.

Requirements

Usage

  • Show help:
dune exec xapidb_in_shell -- -help
  • Open a REPL using local sample.xml file:
dune exec xapidb_in_shell -- sample.xml
  • Query a specific OpaqueRef from sample.xml:
dune exec xapidb_in_shell -- sample.xml 3ec68fc0-3c60-ffa4-e499-6142c369ea39
  • Use a remote database:
dune exec xapidb_in_shell -- -host 10.1.38.11 /var/lib/xcp/state.db

Status

⚠️ Work in progress ⚠️

  • A full interactive REPL is not available yet (See section below).
  • Local and remote databases work.

Planned REPL commands

  • The goal is to provide an interactive shell with the following commands:
    • ls: display all fields of the current OpaqueRef or tables if no OpaqueRef is selected
    • ls <table>: list all OpaqueRef of the given table
    • cd <opaqueref>: open the OpaqueRef
    • cd ..: navigate up
    • pwd: show the path we followed
    • help: display available commands
    • exit: exit the REPL

Examples

  • With multiple OpaqueRef:
❯ dune exec xapidb_in_shell -- sample.xml 082d1948-c3f7-91ae-8793-568c9e888810 3ec68fc0-3c60-ffa4-e499-6142c369ea39
Entering directory '/home/gthouvenin/devel/ocaml/ocaml_sandkasten'
Leaving directory '/home/gthouvenin/devel/ocaml/ocaml_sandkasten'
Found 3 entries in DB
----------------------------------------
OpaqueRef 082d1948-c3f7-91ae-8793-568c9e888810:
  table                 Certificate
  uuid                  bd62e7eb-ab54-82df-9c76-bea4981bf48d
  type                  host_internal
  name
  host                  3ec68fc0-3c60-ffa4-e499-6142c369ea39
  ref                   082d1948-c3f7-91ae-8793-568c9e888810
----------------------------------------
OpaqueRef 3ec68fc0-3c60-ffa4-e499-6142c369ea39:
  table                 host
  uuid                  6ff4b261-3e37-47f8-ace1-53556da6fcf2
  CERTIFICATEs          ('OpaqueRef:2b3b5149-e164-25b8-3e5c-b3da1765d060'%.'OpaqueRef:082d1948-c3f7-91ae-8793-568c9e888810')
  ref                   3ec68fc0-3c60-ffa4-e499-6142c369ea39
  • Without OpaqueRef it starts the REPL
❯ dune exec xapidb_in_shell sample.xml
Found 3 OpaqueRefs in DB
XAPI DB 0.1, type 'help' for more information
no ref  > ls
  Certificate
  Cluster
  Cluster_host
  host
  pool_update
  probe_result
  role
no ref  > cd 082d1948-c3f7-91ae-8793-568c9e888810
082d1948> ls
OpaqueRef 082d1948-c3f7-91ae-8793-568c9e888810:
  table               	Certificate
  uuid                	bd62e7eb-ab54-82df-9c76-bea4981bf48d
  type                	host_internal
  name                	
  host                	3ec68fc0-3c60-ffa4-e499-6142c369ea39
  ref                 	082d1948-c3f7-91ae-8793-568c9e888810
082d1948> quit
Bye

About

Provides a prompt oriented interface to explore the XAPI database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published