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

__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)

Check equality and either forward a NotImplemented or return the result negated.

__repr__()

Automatically created by attrs.

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

Backup VMDB database Changed from Rake task due to a bug in 5.9

client
create()[source]

Creates new vmdb_production database

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

create_db_lvm(size=5)[source]

Set up a partition for the CFME DB to run on.

Parameters:size (int) –
Returns:True if it worked False if it failed

As a work-around for having to provide a separate disk to a CFME appliance for the database, we instead partition the single disk we have and run the DB on the new partition.

This requires that the appliance’s disk has more space than CFME requires. For example, on RHOS, downstream CFME uses 43GB on a disk but the flavor used to deploy the template has a 75GB disk. Therefore, we have extra space which we can partition.

Note that this is not the ‘ideal’ way of doing things and should be a stop-gap measure until we are capabale of attaching additional disks to an appliance via automation on all infra types.

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

fix_auth_dbyml()[source]
fix_auth_key()[source]
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

migrate()[source]

migrates a given database and updates REGION/GUID files

postgres_version = 'rh-postgresql95'
reset_user_pass()[source]
restart_db_service()[source]

restarts the postgresql service via systemctl

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