class Manager(manager.Manager): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__('vertica') @property def status(self): return self.appStatus @property def configuration_manager(self): return self.app.configuration_manager def do_prepare(self, context, packages, databases, memory_mb, users, device_path, mount_point, backup_info, config_contents, root_password, overrides, cluster_config, snapshot): """This is called from prepare in the base class.""" if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if os.path.exists(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() self.app.add_udls() if config_contents: self.app.configuration_manager.save_configuration( config_contents) elif cluster_config['instance_type'] not in ["member", "master"]: raise RuntimeError( _("Bad cluster configuration: instance type " "given as %s.") % cluster_config['instance_type']) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def enable_root(self, context): LOG.debug("Enabling root.") return self.app.enable_root() def enable_root_with_password(self, context, root_password=None): LOG.debug("Enabling root.") return self.app.enable_root(root_password) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return self.app.is_root_enabled() def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) self.app.add_udls() LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def update_overrides(self, context, overrides, remove=False): LOG.debug("Updating overrides.") if remove: self.app.remove_overrides() else: self.app.update_overrides(context, overrides, remove) def apply_overrides(self, context, overrides): if overrides: LOG.debug("Applying overrides: " + str(overrides)) self.app.apply_overrides(overrides) def grow_cluster(self, context, members): try: LOG.debug("Growing cluster to members: %s." % members) self.app.grow_cluster(members) LOG.debug("grow_cluster call has finished.") except Exception: LOG.exception(_('Cluster grow failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def shrink_cluster(self, context, members): try: LOG.debug("Shrinking cluster members: %s." % members) self.app.shrink_cluster(members) LOG.debug("shrink_cluster call has finished.") except Exception: LOG.exception(_('Cluster shrink failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def mark_design_ksafe(self, context, k): try: LOG.debug("Setting vertica k-safety to %s." % k) self.app.mark_design_ksafe(k) except Exception: LOG.exception(_('K-safety setting failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise
def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__('vertica')
class Manager(periodic_task.PeriodicTasks): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__(CONF) @periodic_task.periodic_task def update_status(self, context): """Update the status of the Vertica service.""" self.appStatus.update() def rpc_ping(self, context): LOG.debug("Responding to RPC ping.") return True def prepare(self, context, packages, databases, memory_mb, users, device_path=None, mount_point=None, backup_info=None, config_contents=None, root_password=None, overrides=None, cluster_config=None, snapshot=None, path_exists_function=os.path.exists): """Makes ready DBAAS on a Guest container.""" try: LOG.info(_("Setting instance status to BUILDING.")) self.appStatus.begin_install() if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if path_exists_function(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() self.app.complete_install_or_restart() elif cluster_config['instance_type'] == "member": self.appStatus.set_status(rd_ins.ServiceStatuses.BUILD_PENDING) else: LOG.error(_("Bad cluster configuration; instance type " "given as %s.") % cluster_config['instance_type']) raise RuntimeError("Bad cluster configuration.") LOG.info(_('Completed setup of Vertica database instance.')) except Exception: LOG.exception(_('Cannot prepare Vertica database instance.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def get_filesystem_stats(self, context, fs_path): """Gets the filesystem stats for the path given.""" LOG.debug("Finding the file-systems stats.") mount_point = CONF.get(MANAGER).mount_point return dbaas.get_filesystem_volume_stats(mount_point) def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def mount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Mounting the volume.") device = volume.VolumeDevice(device_path) device.mount(mount_point, write_to_fstab=False) LOG.debug("Mounted the volume.") def unmount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Unmounting the volume.") device = volume.VolumeDevice(device_path) device.unmount(mount_point) LOG.debug("Unmounted the volume.") def resize_fs(self, context, device_path=None, mount_point=None): LOG.debug("Resizing the filesystem.") device = volume.VolumeDevice(device_path) device.resize_fs(mount_point) LOG.debug("Resized the filesystem.") def reset_configuration(self, context, configuration): """ Currently this method does nothing. This method needs to be implemented to enable rollback of flavor-resize on guestagent side. """ LOG.debug("Resetting Vertica configuration.") pass def change_passwords(self, context, users): LOG.debug("Changing password.") raise exception.DatastoreOperationNotSupported( operation='change_passwords', datastore=MANAGER) def update_attributes(self, context, username, hostname, user_attrs): LOG.debug("Updating database attributes.") raise exception.DatastoreOperationNotSupported( operation='update_attributes', datastore=MANAGER) def create_database(self, context, databases): LOG.debug("Creating database.") raise exception.DatastoreOperationNotSupported( operation='create_database', datastore=MANAGER) def create_user(self, context, users): LOG.debug("Creating user.") raise exception.DatastoreOperationNotSupported( operation='create_user', datastore=MANAGER) def delete_database(self, context, database): LOG.debug("Deleting database.") raise exception.DatastoreOperationNotSupported( operation='delete_database', datastore=MANAGER) def delete_user(self, context, user): LOG.debug("Deleting user.") raise exception.DatastoreOperationNotSupported( operation='delete_user', datastore=MANAGER) def get_user(self, context, username, hostname): LOG.debug("Getting user.") raise exception.DatastoreOperationNotSupported( operation='get_user', datastore=MANAGER) def grant_access(self, context, username, hostname, databases): LOG.debug("Granting acccess.") raise exception.DatastoreOperationNotSupported( operation='grant_access', datastore=MANAGER) def revoke_access(self, context, username, hostname, database): LOG.debug("Revoking access.") raise exception.DatastoreOperationNotSupported( operation='revoke_access', datastore=MANAGER) def list_access(self, context, username, hostname): LOG.debug("Listing access.") raise exception.DatastoreOperationNotSupported( operation='list_access', datastore=MANAGER) def list_databases(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing databases.") raise exception.DatastoreOperationNotSupported( operation='list_databases', datastore=MANAGER) def list_users(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing users.") raise exception.DatastoreOperationNotSupported( operation='list_users', datastore=MANAGER) def enable_root(self, context): LOG.debug("Enabling root.") return self.app.enable_root() def enable_root_with_password(self, context, root_password=None): LOG.debug("Enabling root.") return self.app.enable_root(root_password) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return self.app.is_root_enabled() def create_backup(self, context, backup_info): LOG.debug("Creating backup.") raise exception.DatastoreOperationNotSupported( operation='create_backup', datastore=MANAGER) def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def cluster_complete(self, context): LOG.debug("Cluster creation complete, starting status checks.") status = self.appStatus._get_actual_db_status() self.appStatus.set_status(status)
def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__(CONF)
class Manager(manager.Manager): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__('vertica') @property def status(self): return self.appStatus def do_prepare(self, context, packages, databases, memory_mb, users, device_path, mount_point, backup_info, config_contents, root_password, overrides, cluster_config, snapshot): """This is called from prepare in the base class.""" if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if os.path.exists(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() elif cluster_config['instance_type'] != "member": raise RuntimeError(_("Bad cluster configuration: instance type " "given as %s.") % cluster_config['instance_type']) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def mount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Mounting the volume.") device = volume.VolumeDevice(device_path) device.mount(mount_point, write_to_fstab=False) LOG.debug("Mounted the volume.") def unmount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Unmounting the volume.") device = volume.VolumeDevice(device_path) device.unmount(mount_point) LOG.debug("Unmounted the volume.") def resize_fs(self, context, device_path=None, mount_point=None): LOG.debug("Resizing the filesystem.") device = volume.VolumeDevice(device_path) device.resize_fs(mount_point) LOG.debug("Resized the filesystem.") def reset_configuration(self, context, configuration): """ Currently this method does nothing. This method needs to be implemented to enable rollback of flavor-resize on guestagent side. """ LOG.debug("Resetting Vertica configuration.") pass def change_passwords(self, context, users): LOG.debug("Changing password.") raise exception.DatastoreOperationNotSupported( operation='change_passwords', datastore=self.manager) def update_attributes(self, context, username, hostname, user_attrs): LOG.debug("Updating database attributes.") raise exception.DatastoreOperationNotSupported( operation='update_attributes', datastore=self.manager) def create_database(self, context, databases): LOG.debug("Creating database.") raise exception.DatastoreOperationNotSupported( operation='create_database', datastore=self.manager) def create_user(self, context, users): LOG.debug("Creating user.") raise exception.DatastoreOperationNotSupported( operation='create_user', datastore=self.manager) def delete_database(self, context, database): LOG.debug("Deleting database.") raise exception.DatastoreOperationNotSupported( operation='delete_database', datastore=self.manager) def delete_user(self, context, user): LOG.debug("Deleting user.") raise exception.DatastoreOperationNotSupported( operation='delete_user', datastore=self.manager) def get_user(self, context, username, hostname): LOG.debug("Getting user.") raise exception.DatastoreOperationNotSupported( operation='get_user', datastore=self.manager) def grant_access(self, context, username, hostname, databases): LOG.debug("Granting acccess.") raise exception.DatastoreOperationNotSupported( operation='grant_access', datastore=self.manager) def revoke_access(self, context, username, hostname, database): LOG.debug("Revoking access.") raise exception.DatastoreOperationNotSupported( operation='revoke_access', datastore=self.manager) def list_access(self, context, username, hostname): LOG.debug("Listing access.") raise exception.DatastoreOperationNotSupported( operation='list_access', datastore=self.manager) def list_databases(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing databases.") raise exception.DatastoreOperationNotSupported( operation='list_databases', datastore=self.manager) def list_users(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing users.") raise exception.DatastoreOperationNotSupported( operation='list_users', datastore=self.manager) def enable_root(self, context): LOG.debug("Enabling root.") return self.app.enable_root() def enable_root_with_password(self, context, root_password=None): LOG.debug("Enabling root.") return self.app.enable_root(root_password) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return self.app.is_root_enabled() def create_backup(self, context, backup_info): LOG.debug("Creating backup.") raise exception.DatastoreOperationNotSupported( operation='create_backup', datastore=self.manager) def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise
class Manager(manager.Manager): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__('vertica') @property def status(self): return self.appStatus def do_prepare(self, context, packages, databases, memory_mb, users, device_path, mount_point, backup_info, config_contents, root_password, overrides, cluster_config, snapshot): """This is called from prepare in the base class.""" if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if os.path.exists(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() elif cluster_config['instance_type'] not in ["member", "master"]: raise RuntimeError(_("Bad cluster configuration: instance type " "given as %s.") % cluster_config['instance_type']) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def enable_root(self, context): LOG.debug("Enabling root.") return self.app.enable_root() def enable_root_with_password(self, context, root_password=None): LOG.debug("Enabling root.") return self.app.enable_root(root_password) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return self.app.is_root_enabled() def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise
class Manager(periodic_task.PeriodicTasks): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__(CONF) @periodic_task.periodic_task def update_status(self, context): """Update the status of the Vertica service.""" self.appStatus.update() def rpc_ping(self, context): LOG.debug("Responding to RPC ping.") return True def prepare(self, context, packages, databases, memory_mb, users, device_path=None, mount_point=None, backup_info=None, config_contents=None, root_password=None, overrides=None, cluster_config=None, snapshot=None, path_exists_function=os.path.exists): """Makes ready DBAAS on a Guest container.""" try: LOG.info(_("Setting instance status to BUILDING.")) self.appStatus.begin_install() if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if path_exists_function(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() self.app.complete_install_or_restart() elif cluster_config['instance_type'] == "member": self.appStatus.set_status(rd_ins.ServiceStatuses.BUILD_PENDING) else: LOG.error(_("Bad cluster configuration; instance type " "given as %s.") % cluster_config['instance_type']) raise RuntimeError("Bad cluster configuration.") LOG.info(_('Completed setup of Vertica database instance.')) except Exception: LOG.exception(_('Cannot prepare Vertica database instance.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def get_filesystem_stats(self, context, fs_path): """Gets the filesystem stats for the path given.""" LOG.debug("Finding the file-systems stats.") mount_point = CONF.get(MANAGER).mount_point return dbaas.get_filesystem_volume_stats(mount_point) def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def mount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Mounting the volume.") device = volume.VolumeDevice(device_path) device.mount(mount_point, write_to_fstab=False) LOG.debug("Mounted the volume.") def unmount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Unmounting the volume.") device = volume.VolumeDevice(device_path) device.unmount(mount_point) LOG.debug("Unmounted the volume.") def resize_fs(self, context, device_path=None, mount_point=None): LOG.debug("Resizing the filesystem.") device = volume.VolumeDevice(device_path) device.resize_fs(mount_point) LOG.debug("Resized the filesystem.") def reset_configuration(self, context, configuration): """ Currently this method does nothing. This method needs to be implemented to enable rollback of flavor-resize on guestagent side. """ LOG.debug("Resetting Vertica configuration.") pass def change_passwords(self, context, users): LOG.debug("Changing password.") raise exception.DatastoreOperationNotSupported( operation='change_passwords', datastore=MANAGER) def update_attributes(self, context, username, hostname, user_attrs): LOG.debug("Updating database attributes.") raise exception.DatastoreOperationNotSupported( operation='update_attributes', datastore=MANAGER) def create_database(self, context, databases): LOG.debug("Creating database.") raise exception.DatastoreOperationNotSupported( operation='create_database', datastore=MANAGER) def create_user(self, context, users): LOG.debug("Creating user.") raise exception.DatastoreOperationNotSupported( operation='create_user', datastore=MANAGER) def delete_database(self, context, database): LOG.debug("Deleting database.") raise exception.DatastoreOperationNotSupported( operation='delete_database', datastore=MANAGER) def delete_user(self, context, user): LOG.debug("Deleting user.") raise exception.DatastoreOperationNotSupported( operation='delete_user', datastore=MANAGER) def get_user(self, context, username, hostname): LOG.debug("Getting user.") raise exception.DatastoreOperationNotSupported( operation='get_user', datastore=MANAGER) def grant_access(self, context, username, hostname, databases): LOG.debug("Granting acccess.") raise exception.DatastoreOperationNotSupported( operation='grant_access', datastore=MANAGER) def revoke_access(self, context, username, hostname, database): LOG.debug("Revoking access.") raise exception.DatastoreOperationNotSupported( operation='revoke_access', datastore=MANAGER) def list_access(self, context, username, hostname): LOG.debug("Listing access.") raise exception.DatastoreOperationNotSupported( operation='list_access', datastore=MANAGER) def list_databases(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing databases.") raise exception.DatastoreOperationNotSupported( operation='list_databases', datastore=MANAGER) def list_users(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing users.") raise exception.DatastoreOperationNotSupported( operation='list_users', datastore=MANAGER) def enable_root(self, context): LOG.debug("Enabling root.") raise exception.DatastoreOperationNotSupported( operation='enable_root', datastore=MANAGER) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") raise exception.DatastoreOperationNotSupported( operation='is_root_enabled', datastore=MANAGER) def create_backup(self, context, backup_info): LOG.debug("Creating backup.") raise exception.DatastoreOperationNotSupported( operation='create_backup', datastore=MANAGER) def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def cluster_complete(self, context): LOG.debug("Cluster creation complete, starting status checks.") status = self.appStatus._get_actual_db_status() self.appStatus.set_status(status)
def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus)
class Manager(manager.Manager): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__('vertica') @property def status(self): return self.appStatus def do_prepare(self, context, packages, databases, memory_mb, users, device_path, mount_point, backup_info, config_contents, root_password, overrides, cluster_config, snapshot): """This is called from prepare in the base class.""" if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if os.path.exists(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() elif cluster_config['instance_type'] != "member": raise RuntimeError( _("Bad cluster configuration: instance type " "given as %s.") % cluster_config['instance_type']) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def mount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Mounting the volume.") device = volume.VolumeDevice(device_path) device.mount(mount_point, write_to_fstab=False) LOG.debug("Mounted the volume.") def unmount_volume(self, context, device_path=None, mount_point=None): LOG.debug("Unmounting the volume.") device = volume.VolumeDevice(device_path) device.unmount(mount_point) LOG.debug("Unmounted the volume.") def resize_fs(self, context, device_path=None, mount_point=None): LOG.debug("Resizing the filesystem.") device = volume.VolumeDevice(device_path) device.resize_fs(mount_point) LOG.debug("Resized the filesystem.") def reset_configuration(self, context, configuration): """ Currently this method does nothing. This method needs to be implemented to enable rollback of flavor-resize on guestagent side. """ LOG.debug("Resetting Vertica configuration.") pass def change_passwords(self, context, users): LOG.debug("Changing password.") raise exception.DatastoreOperationNotSupported( operation='change_passwords', datastore=self.manager) def update_attributes(self, context, username, hostname, user_attrs): LOG.debug("Updating database attributes.") raise exception.DatastoreOperationNotSupported( operation='update_attributes', datastore=self.manager) def create_database(self, context, databases): LOG.debug("Creating database.") raise exception.DatastoreOperationNotSupported( operation='create_database', datastore=self.manager) def create_user(self, context, users): LOG.debug("Creating user.") raise exception.DatastoreOperationNotSupported(operation='create_user', datastore=self.manager) def delete_database(self, context, database): LOG.debug("Deleting database.") raise exception.DatastoreOperationNotSupported( operation='delete_database', datastore=self.manager) def delete_user(self, context, user): LOG.debug("Deleting user.") raise exception.DatastoreOperationNotSupported(operation='delete_user', datastore=self.manager) def get_user(self, context, username, hostname): LOG.debug("Getting user.") raise exception.DatastoreOperationNotSupported(operation='get_user', datastore=self.manager) def grant_access(self, context, username, hostname, databases): LOG.debug("Granting acccess.") raise exception.DatastoreOperationNotSupported( operation='grant_access', datastore=self.manager) def revoke_access(self, context, username, hostname, database): LOG.debug("Revoking access.") raise exception.DatastoreOperationNotSupported( operation='revoke_access', datastore=self.manager) def list_access(self, context, username, hostname): LOG.debug("Listing access.") raise exception.DatastoreOperationNotSupported(operation='list_access', datastore=self.manager) def list_databases(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing databases.") raise exception.DatastoreOperationNotSupported( operation='list_databases', datastore=self.manager) def list_users(self, context, limit=None, marker=None, include_marker=False): LOG.debug("Listing users.") raise exception.DatastoreOperationNotSupported(operation='list_users', datastore=self.manager) def enable_root(self, context): LOG.debug("Enabling root.") return self.app.enable_root() def enable_root_with_password(self, context, root_password=None): LOG.debug("Enabling root.") return self.app.enable_root(root_password) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return self.app.is_root_enabled() def create_backup(self, context, backup_info): LOG.debug("Creating backup.") raise exception.DatastoreOperationNotSupported( operation='create_backup', datastore=self.manager) def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise
class Manager(manager.Manager): def __init__(self): self.appStatus = VerticaAppStatus() self.app = VerticaApp(self.appStatus) super(Manager, self).__init__('vertica') @property def status(self): return self.appStatus @property def configuration_manager(self): return self.app.configuration_manager def do_prepare(self, context, packages, databases, memory_mb, users, device_path, mount_point, backup_info, config_contents, root_password, overrides, cluster_config, snapshot): """This is called from prepare in the base class.""" if device_path: device = volume.VolumeDevice(device_path) # unmount if device is already mounted device.unmount_device(device_path) device.format() if os.path.exists(mount_point): # rsync any existing data device.migrate_data(mount_point) # mount the volume device.mount(mount_point) LOG.debug("Mounted the volume.") self.app.install_if_needed(packages) self.app.prepare_for_install_vertica() if cluster_config is None: self.app.install_vertica() self.app.create_db() self.app.add_udls() if config_contents: self.app.configuration_manager.save_configuration( config_contents) elif cluster_config['instance_type'] not in ["member", "master"]: raise RuntimeError(_("Bad cluster configuration: instance type " "given as %s.") % cluster_config['instance_type']) def restart(self, context): LOG.debug("Restarting the database.") self.app.restart() LOG.debug("Restarted the database.") def stop_db(self, context, do_not_start_on_reboot=False): LOG.debug("Stopping the database.") self.app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot) LOG.debug("Stopped the database.") def reset_configuration(self, context, configuration): """ Currently this method does nothing. This method needs to be implemented to enable rollback of flavor-resize on guestagent side. """ LOG.debug("Resetting Vertica configuration.") pass def enable_root(self, context): LOG.debug("Enabling root.") return self.app.enable_root() def enable_root_with_password(self, context, root_password=None): LOG.debug("Enabling root.") return self.app.enable_root(root_password) def is_root_enabled(self, context): LOG.debug("Checking if root is enabled.") return self.app.is_root_enabled() def start_db_with_conf_changes(self, context, config_contents): LOG.debug("Starting with configuration changes.") self.app.start_db_with_conf_changes(config_contents) def get_public_keys(self, context, user): LOG.debug("Retrieving public keys for %s." % user) return self.app.get_public_keys(user) def authorize_public_keys(self, context, user, public_keys): LOG.debug("Authorizing public keys for %s." % user) return self.app.authorize_public_keys(user, public_keys) def install_cluster(self, context, members): try: LOG.debug("Installing cluster on members: %s." % members) self.app.install_cluster(members) self.app.add_udls() LOG.debug("install_cluster call has finished.") except Exception: LOG.exception(_('Cluster installation failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def update_overrides(self, context, overrides, remove=False): LOG.debug("Updating overrides.") if remove: self.app.remove_overrides() else: self.app.update_overrides(context, overrides, remove) def apply_overrides(self, context, overrides): if overrides: LOG.debug("Applying overrides: " + str(overrides)) self.app.apply_overrides(overrides) def grow_cluster(self, context, members): try: LOG.debug("Growing cluster to members: %s." % members) self.app.grow_cluster(members) LOG.debug("grow_cluster call has finished.") except Exception: LOG.exception(_('Cluster grow failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def shrink_cluster(self, context, members): try: LOG.debug("Shrinking cluster members: %s." % members) self.app.shrink_cluster(members) LOG.debug("shrink_cluster call has finished.") except Exception: LOG.exception(_('Cluster shrink failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise def mark_design_ksafe(self, context, k): try: LOG.debug("Setting vertica k-safety to %s." % k) self.app.mark_design_ksafe(k) except Exception: LOG.exception(_('K-safety setting failed.')) self.appStatus.set_status(rd_ins.ServiceStatuses.FAILED) raise