cfme.utils.appliance.db module

class cfme.utils.appliance.db.ApplianceDB(appliance, ssh_client=None)[source]

Bases: cfme.utils.appliance.plugin.AppliancePlugin

Holder for appliance DB related methods and functions

__eq__(other)

Automatically created by attrs.

__ge__(other)

Automatically created by attrs.

__gt__(other)

Automatically created by attrs.

__le__(other)

Automatically created by attrs.

__lt__(other)

Automatically created by attrs.

__ne__(other)

Automatically created by attrs.

__repr__()

Automatically created by attrs.

address
backup(database_path='/tmp/evm_db.backup')[source]

Backup VMDB database

client
drop()[source]

Drops the vmdb_production database

Note: EVM service has to be stopped for this to work.

enable_external(db_address, region=0, db_name=None, db_username=None, db_password=None)[source]

Enables external database

Parameters:
  • db_address – Address of the external database
  • region – Number of region to join
  • db_name – Name of the external DB
  • db_username – Username to access the external DB
  • db_password – Password to access the external DB

Returns a tuple of (exitstatus, script_output) for reporting, if desired

enable_internal(region=0, key_address=None, db_password=None, ssh_password=None, db_disk=None)[source]

Enables internal database

Parameters:
  • region – Region number of the CFME appliance.
  • key_address – Address of CFME appliance where key can be fetched.
  • db_disk – Path of the db disk for –dbdisk appliance_console_cli. If not specified it tries to load it from the appliance.

Note

If key_address is None, a new encryption key is generated for the appliance.

extend_partition()[source]

Extends the /var partition with DB while shrinking the unused /repo partition

has_database

Does database have a database defined

has_tables

Does database have tables defined

is_dedicated_active
is_enabled

Is database enabled

is_internal

Is database internal

is_online

Is database online

is_partition_extended
is_ready

Is database ready

loosen_pgssl(with_ssl=False)[source]

Loosens postgres connections

postgres_version = 'rh-postgresql95'
restore(database_path='/tmp/evm_db.backup')[source]

Restore VMDB database

service_name = 'rh-postgresql95-postgresql'
setup(**kwargs)[source]

Configure database

On downstream appliances, invokes the internal database setup. On all appliances waits for database to be ready.

ssh_client
start_db_service()[source]

Starts the postgresql service via systemctl

stop_db_service()[source]

Starts the postgresql service via systemctl

wait_for(timeout=600)[source]

Waits for appliance database to be ready

Parameters:timeout – Number of seconds to wait until timeout (default 180)
exception cfme.utils.appliance.db.ApplianceDBException[source]

Bases: cfme.utils.appliance.plugin.AppliancePluginException

Basic Exception for Appliance DB object