2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/log=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileHandle=file:'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileName=str:'/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilter=_MyLoggerFilter:'filter' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logRemoveAtExit=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.dialog.misc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/dialect=str:'human' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.dialog.human.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/boundary=str:'--=451b80dc-996f-432e-9e4f-2b29ef6d1141=--' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.dialog.machine.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.connection.Plugin._boot 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._boot 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password', 'OVESETUP_CONFIG/adminPassword']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._boot 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password', 'OVESETUP_CONFIG/adminPassword', 'OVESETUP_PKI/storePassword']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.core.misc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:477 SEQUENCE DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE boot 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._preinit (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.core.misc.Plugin._preinit (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.log.Plugin._init (otopi.core.log.init) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.misc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.human.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.machine.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.connection.Plugin._boot (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._boot (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._boot (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.misc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._boot (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.info.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._boot (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.config.Plugin._init (otopi.core.config.init) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._init (otopi.packagers.detection) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._init (otopi.packagers.detection) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.command.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.transaction.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.cli.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.iptables.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.ssh.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.clock.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.reboot.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.answerfile.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.offlinepackager.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.postinstall.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.reconfigure.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.uninstall.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_firewalld.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.hostname.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.fence_kdump_listener.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.config.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.connection.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.config.java.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.core.protocols.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.provisioning.postgres.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.environment.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.websocket_proxy.core.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.core.misc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.dialog.preview.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.system.environment.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.cpu.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.storage.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.engine.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.domain_type.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.iso_domain.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.java.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.public_glance_repository.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.storage.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.advertise_dwh.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.misc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.distro-rpm.packages.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dbvalidations.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dwh.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.hosted_engine.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.core.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.misc.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.jboss.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.additional_packages.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.image_upload.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.public_glance_repository.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.showupgradekb.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.packages.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._setup_existence (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._setup_existence (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.config.Plugin._post_init (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.log.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.misc.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine_root_ssh.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.cpu.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.hostname.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.services.openrc.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.services.rhel.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.services.systemd.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.clock.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.reboot.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_firewalld.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_human.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_iptables.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.hostname.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine_manual_files.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.mem.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.misc.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.connection.Plugin._setup (osetup.db.connection.setup) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.core.misc.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.core.protocols.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.rhevm-setup-plugins.core.Plugin.setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.vmconsole_proxy_helper.core.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.websocket_proxy.core.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._keep_only_valid_firewall_managers (osetup.keep.only.valid.firewall.managers) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.jboss.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.misc.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._setup_prevent_dwh_32 (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._setup_prevent_reports_32 (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.setup_reinstallable.Plugin.setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.redhatsupportplugin.versionlock.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE internal_packages 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.transaction.Plugin._pre_prepare (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.hostname.Plugin._internal_packages (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._internal_packages_end (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._internal_packages_end (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.transaction.Plugin._pre_end (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE programs 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.command.Plugin._programs (otopi.system.command.detection) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.services.systemd.Plugin._programs (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.services.rhel.Plugin._programs (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.services.openrc.Plugin._programs (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._programs (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki.Plugin._setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE late_setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._late_setup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._late_setup_service_state (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.showupgradekb.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.config.Plugin._customize1 (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.cli.Plugin._customize (otopi.dialog.cli.customization) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.reconfigure.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_s_product_options (osetup.dialog.titles.productoptions.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.misc.Plugin._customization (osetup.engine.core.enable) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._customization (setup.config.websocket-proxy.customization) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_e_product_options (osetup.dialog.titles.productoptions.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._continueSetupWithoutAIO (osetup.aio.config.not.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._version_lock_customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.java.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.distro-rpm.packages.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.jboss.Plugin._version_lock_customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.packages.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_packages (osetup.dialog.titles.packaging.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.setup_reinstallable.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin._customization (osetup.distro-rpm.package.update.check) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_packages (osetup.dialog.titles.packages.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_allinone (osetup.dialog.titles.allinone.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._constomization (osetup.aio.config.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.storage.Plugin._customization (osetup.aio.config.storage) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_allinone (osetup.dialog.titles.allinone.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_network (osetup.dialog.titles.network.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.network.hostname.Plugin._customization (osetup.config.protocols.customization) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.protocols.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._customization_is_requested (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._customization (osetup.net.firewallmanager.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.firewall.Plugin._configuration (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.firewall.Plugin._configuration (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.firewall.Plugin._configuration (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._network_owners_config_customized (osetup.network.owners.config.customized) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._customizationNetwork (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._customization_network (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_network (osetup.dialog.titles.network.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_database (osetup.dialog.titles.database.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._customization_enable (osetup.engine.provisioning.pgsql.allow) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._customization_enable (osetup.engine.db.connection.allow) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._customization (osetup.db.connection.customization) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._db_owners_connections_customized (osetup.db.owners.connections.customized) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_database (osetup.dialog.titles.database.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_engine (osetup.dialog.titles.engine.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._customization_enable (osetup.engine.config.appmode.allow) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._customization (osetup.config.applicationMode.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.domain_type.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_engine (osetup.dialog.titles.engine.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_storage (osetup.dialog.titles.storage.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.storage.Plugin._configureSANWipeAfterDelete (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_storage (osetup.dialog.titles.storage.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_pki (osetup.dialog.titles.pki.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._customization_upgrade (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_pki (osetup.dialog.titles.pki.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_apache (osetup.dialog.titles.apache.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_apache (osetup.dialog.titles.apache.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_system (osetup.dialog.titles.system.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._customization_firewall (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._customization_enable (osetup.engine.system.nfs.allow) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._customization (osetup.system.nfs.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.iso_domain.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._customization_disable (osetup.engine.kdump.allow) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._customization_firewall (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_system (osetup.dialog.titles.system.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_misc (osetup.dialog.titles.misc.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_misc (osetup.dialog.titles.misc.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._firewall (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.config.Plugin._customize2 (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._customization_firewall (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE validation 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.misc.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._validation_enable (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._validateEnv (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._validate_enable (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._validation (otopi.network.firewalld.validation) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.hostname.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.iptables.Plugin._validate (otopi.network.iptables.validation) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.ssh.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.config.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass.Plugin._validation (osetup.db.connection.credentials.early) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.config.java.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._review_config (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.cpu.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._validateMemory (osetup.memory.check) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._validateContinueLowMemory (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._validateZombies (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.hosted_engine.Plugin._validate_hosted_engine (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._validate_ssl (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.image_upload.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.pki30.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.dialog.preview.Plugin._customization (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._validation_late (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaakerbldap.Plugin._validation_late (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._validateAsyncTasks (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dbvalidations.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaainternal.Plugin._validation (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE transaction-prepare 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.transaction.Plugin._main_prepare (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._transaction_begin (osetup.system.hostile.detection) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine.Plugin._transactionBegin (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.fence_kdump_listener.Plugin._transactionBegin (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.websocket_proxy.core.Plugin._transactionBegin (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE early_misc 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._early_misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dbvalidations.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE packages 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.iptables.Plugin._packages (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin.packages (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._packages (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._packages (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._packages (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE misc 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.jboss.Plugin._jboss (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.command.Plugin._misc (otopi.system.command.redetection) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._misc (osetup.system.sysctl.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.iptables.Plugin._store_iptables (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.ssh.Plugin._append_key (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.clock.Plugin._set_clock (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass.Plugin._misc (osetup.db.connection.credentials.late) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._prepare_examples (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.storage.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.engine.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaainternal.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.database.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.java.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.jboss.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.protocols.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.tools.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.advertise_dwh.Plugin._get_dwh_host (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dwh.Plugin._misc_stop_remote_dwh (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema.Plugin._misc (osetup.db.schema) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._connection (osetup.db.connection.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.domain_type.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.iso_domain.Plugin._add_iso_domain_to_db (osetup.config.iso_domain.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.options.Plugin._miscAlways (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.options.Plugin._miscNewDatabase (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.public_glance_repository.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.storage.Plugin._updateSANWipeAfterDelete (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._misc (osetup.aaa_jdbc.config.setup.admin.user) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._setupAdminPassword (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._miscUpgrade (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.pki30.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._misc (osetup.pki.ca.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.ca.Plugin._misc (osetup.config.encryption.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin.miscOptions (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh.Plugin._misc (osetup.pki.ssh.available) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.answerfile_fixup.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.selinux.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._network (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._storage (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._ui_locales (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._ui_popups (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._virt (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.image_upload.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._miscConfigVMConsoleHelper (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._miscConfigVMConsoleProxy (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki.Plugin._miscPKIEngine (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki.Plugin._miscPKIProxy (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._check_separate (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._misc_VDC (setup.config.websocket-proxy.remote_vdc) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._misc_config (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._misc_pki (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._misc (osetup.config.aaa.adminuser.setup) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._misc (osetup.setup.selinux) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.misc.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.postinstall.Plugin._misc (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE cleanup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.transaction.Plugin._main_end (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE closeup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.firewalld.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.network.iptables.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_s_summary (osetup.dialog.titles.summary.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._devenv_closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dwh.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.advertise_dwh.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.protocols.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_e_summary (osetup.dialog.titles.summary.end) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._closeup (osetup.aio.config.ssh) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.engine.Plugin._closeup (osetup.core.engine.start) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache.Plugin._closeup (osetup.apache.core.restart) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._closeup (osetup.aio.config.vdsm) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.reboot.Plugin._closeup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE cleanup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._cleanup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine.Plugin._cleanup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._cleanup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.uninstall.Plugin._cleanup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.answerfile.Plugin._cleanup (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE pre-terminate 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.misc.Plugin._preTerminate (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.cli.Plugin._pre_terminate (otopi.dialog.cli.termination) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE terminate 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._terminate (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.human.Plugin._terminate (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.dialog.machine.Plugin._terminate (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.core.log.Plugin._terminate (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:479 STAGE reboot 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:484 METHOD otopi.plugins.otopi.system.reboot.Plugin._reboot (None) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpSequence:486 SEQUENCE DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/aborted=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/debug=int:'0' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/error=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/exceptionInfo=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/executionDirectory=str:'/' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/exitCode=list:'[{'priority': 90001, 'code': 0}]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/log=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/pluginGroups=str:'otopi:ovirt-engine-common:ovirt-engine-setup' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/pluginPath=str:'/usr/share/otopi/plugins:/usr/share/ovirt-engine/setup/bin/../plugins' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/suppressEnvironmentKeys=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/configFileAppend=str:':/root/ovirt-engine-answers:/root/heanswers.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/configFileName=str:'/etc/ovirt-engine-setup.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/failOnPrioOverride=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logDir=str:'/var/log/ovirt-engine/setup' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileHandle=file:'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileName=str:'/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileNamePrefix=str:'ovirt-engine-setup' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilter=_MyLoggerFilter:'filter' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password', 'OVESETUP_CONFIG/adminPassword', 'OVESETUP_PKI/storePassword']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logRemoveAtExit=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/randomizeEvents=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/boundary=str:'--=451b80dc-996f-432e-9e4f-2b29ef6d1141=--' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/dialect=str:'human' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_NAME=str:'otopi' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_VERSION=str:'1.4.1' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/totalMemoryMB=NoneType:'None' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/offlinePackager=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumpackagerEnabled=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_NAME=str:'otopi' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_VERSION=str:'1.4.1' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._boot 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.packagers.dnfpackager dnfpackager._boot:178 Cannot initialize minidnf Traceback (most recent call last): File "/usr/share/otopi/plugins/otopi/packagers/dnfpackager.py", line 165, in _boot constants.PackEnv.DNF_DISABLED_PLUGINS File "/usr/share/otopi/plugins/otopi/packagers/dnfpackager.py", line 75, in _getMiniDNF from otopi import minidnf File "/usr/lib/python2.6/site-packages/otopi/minidnf.py", line 31, in import dnf ImportError: No module named dnf 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfDisabledPlugins=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfExpireCache=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfRollback=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfpackagerEnabled=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/keepAliveInterval=int:'30' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.system.info.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:51 SYSTEM INFORMATION - BEGIN 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:52 executable /usr/bin/python 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:53 python /usr/bin/python 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:54 platform linux2 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:55 distribution ('Red Hat Enterprise Linux Server', '6.8', 'Santiago') 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:56 host 'rhev.lab.localdomain' 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:62 uid 0 euid 0 gid 0 egid 0 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.system.info info._init:64 SYSTEM INFORMATION - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage boot METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._boot 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumDisabledPlugins=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumEnabledPlugins=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumExpireCache=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumRollback=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 INFO otopi.context context.runSequence:427 Stage: Initializing 2016-07-12 18:21:35 DEBUG otopi.context context.runSequence:431 STAGE init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.core.config.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureRootRedirection=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureRootRedirectionDefault=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureSsl=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminPassword=str:'**FILTERED**' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/applicationMode=str:'virt' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallChangesReview=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManager=str:'iptables' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdn=str:'rhev.lab.localdomain' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHome=str:'/usr/share/jbossas' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/pkiRenewalDocUrl=str:'https://access.redhat.com/solutions/1572983' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/sanWipeAfterDelete=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageType=str:'nfs' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/updateFirewall=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/validFirewallManagers=str:'iptables' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyConfig=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/database=str:'engine' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/host=str:'localhost' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/port=int:'5432' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/secured=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/securedHostValidation=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/user=str:'engine' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DIALOG/confirmSettings=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ENGINE_CORE/enable=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/organization=str:'lab.localdomain' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RHEVM_SUPPORT/redhatSupportProxyEnabled=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/enginePackages=str:'rhevm' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/engineSetupPackages=str:'rhevm-setup' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/upgradeYumGroup=str:'rhevm36' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckEnabled=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsConfigEnabled=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyConfig=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_WSP_RPMDISRO_PACKAGES=str:'rhevm-websocket-proxy' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_WSP_RPMDISRO_PACKAGES_SETUP=str:'rhevm-setup-plugin-websocket-proxy' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.system.command.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/commandPath=str:'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.core.misc misc._init:99 Package: rhevm-3.6.6.2 (3.6.6.2-0.1.el6) 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/developerMode=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/generatedByVersion=str:'3.6.6.2' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/upgradeSupportedVersions=str:'3.0,3.1,3.2,3.3,3.4,3.5,3.6' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.core.transaction.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/internalPackageTransaction=Transaction:'transaction' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/mainTransaction=Transaction:'transaction' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/modifiedFiles=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.dialog.cli.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/cliVersion=int:'1' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/customization=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.network.firewalld.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldAvailable=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldDisableServices=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldEnable=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.network.iptables.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesEnable=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.network.ssh.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshEnable=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshUser=str:'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.system.clock.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/clockMaxGap=int:'5' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/clockSet=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.otopi.system.reboot.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/reboot=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/rebootAllow=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/rebootDeferTime=int:'10' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.core.answerfile.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.core.offlinepackager.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.core.offlinepackager offlinepackager._init:80 Registering offline packager 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.core.postinstall.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/generatePostInstall=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.core.reconfigure.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.core.uninstall.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/registerUninstallGroups=RegisterGroups:'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_firewalld.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{}' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.network.hostname.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdnNonLoopback=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdnReverseValidation=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password', 'OVESETUP_CONFIG/adminPassword', 'OVESETUP_PKI/storePassword', 'OVESETUP_CONFIG/remoteEngineHostRootPassword']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyles=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/hostileServices=str:'ovirt-engine-dwhd,ovirt-engine-notifier' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxBooleans=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxContexts=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxRestorePaths=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineServiceStopNeeded=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.fence_kdump_listener.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fenceKdumpListenerStopNeeded=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.config.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineDbBackupDir=str:'/var/lib/ovirt-engine/backups' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.connection.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/dumper=str:'pg_custom' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/newDatabase=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/restoreJobs=int:'2' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.config.java.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaNeeded=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.core.protocols.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/httpPort=int:'80' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/httpsPort=int:'443' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossAjpPort=int:'8702' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDebugAddress=str:'127.0.0.1:8787' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHttpPort=int:'8080' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHttpsPort=int:'8443' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.provisioning.postgres.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresConf=str:'/var/lib/pgsql/data/postgresql.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresLCMessages=str:''en_US.UTF-8'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresListenAddress=str:''*'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresMaxConn=int:'150' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresPgHba=str:'/var/lib/pgsql/data/pg_hba.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresPgVersion=str:'/var/lib/pgsql/data/PG_VERSION' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresService=str:'postgresql' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/httpdService=str:'httpd' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/needRestart=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.environment.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupKvm=str:'kvm' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userApache=str:'apache' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userPostgres=str:'postgres' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userRoot=str:'root' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userVdsm=str:'vdsm' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_common.websocket_proxy.core.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyStopNeeded=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.base.core.misc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/action=str:'setup' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.base.dialog.preview.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.base.system.environment.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupEngine=str:'ovirt' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userEngine=str:'ovirt' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/enable=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.cpu.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/supported=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.storage.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainDefaultDir=str:'/var/lib/images' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localCluster=str:'local_cluster' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localDataCenter=str:'local_datacenter' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localHost=str:'local_host' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.engine.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileOvirtEngine=str:'/etc/httpd/conf.d/z-ovirt-engine-proxy.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileOvirtRoot=str:'/etc/httpd/conf.d/ovirt-engine-root-redirect.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUser=str:'admin@internal' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserAuthzName=str:'internal-authz' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserNamespace=str:'*' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/aaaJdbcPackage=str:'ovirt-engine-extension-aaa-jdbc' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.domain_type.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageIsLocal=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.iso_domain.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainDefaultMountPoint=str:'/var/lib/exports/iso' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainExists=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.java.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.public_glance_repository.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/addOvirtGlanceRepository=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.storage.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.advertise_dwh.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/docsAreLocal=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/dwhDocUrl=str:'/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/reportsDocUrl=str:'/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.misc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.distro-rpm.packages.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/additionalPackages=str:'ovirt-host-deploy,ovirt-engine-cli,ovirt-image-uploader,ovirt-iso-uploader' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/country=str:'US' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/storePassword=str:'**FILTERED**' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoPathsToUpload=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckMinimumMB=int:'4096' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckRecommendedMB=int:'16384' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckThreshold=int:'90' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsConfigEnabled_legacyInPostInstall=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ASYNC/clearTasks=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ASYNC/clearTasksWait=int:'20' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dbvalidations.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dwh.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.hosted_engine.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.core.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/enable=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.misc.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configured=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileSsl=str:'/etc/httpd/conf.d/ssl.conf' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.jboss.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossNeeded=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/jbossPackages=str:'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockApply=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockFilter=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesSetup=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesUpgradeList=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/shmmax=int:'68719476736' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.additional_packages.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/additionalPackages=str:'ovirt-host-deploy,redhat-support-plugin-rhev,rhevm-branding-rhev,rhevm-cli,rhevm-doc,rhevm-image-uploader,rhevm-iso-uploader,rhevm-log-collector' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.image_upload.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.public_glance_repository.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/addOvirtGlanceRepository=bool:'False' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.showupgradekb.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RHEVM_DIALOG/confirmUpgrade=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyPort=int:'2222' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupVmConsole=str:'ovirt-vmconsole' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userVmConsole=str:'ovirt-vmconsole' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyHost=str:'localhost' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyPort=int:'6100' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.packages.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage init METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._init 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/keySize=int:'2048' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 INFO otopi.context context.runSequence:427 Stage: Environment setup 2016-07-12 18:21:35 DEBUG otopi.context context.runSequence:431 STAGE setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._setup_existence 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._setup_existence 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.core.config.Plugin._post_init 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging-wsp.conf', '/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/root/ovirt-engine-answers', '/root/heanswers.conf'] 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.core.log.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.core.misc.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Version: otopi-1.4.1 (otopi-1.4.1-1.el6ev) 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine_root_ssh.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyles=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.cpu.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.network.firewalld.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.network.hostname.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.services.openrc.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.services.rhel.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.services.systemd.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.system.clock.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.otopi.system.reboot.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_firewalld.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_human.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[, ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.network.firewall_manager_iptables.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[, , ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.network.hostname.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/remoteEngine=RemoteEngine:'' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine_manual_files.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyles=list:'[, ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.system.mem.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.system.mem mem._setup:57 Checking total memory 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/totalMemoryMB=int:'7870' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.misc.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.connection.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.core.misc.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, , ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.core.protocols.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/publicHttpPort=int:'80' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/publicHttpsPort=int:'443' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.rhevm-setup-plugins.core.Plugin.setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, , , ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.vmconsole_proxy_helper.core.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, , , , ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_common.websocket_proxy.core.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, , , , , ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._keep_only_valid_firewall_managers 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[, ]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.jboss.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaNeeded=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossNeeded=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.misc.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fenceKdumpListenerStopNeeded=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoPathsToUpload=list:'['/usr/share/virtio-win/virtio-win_x86.vfd', '/usr/share/virtio-win/virtio-win_amd64.vfd', '/usr/share/virtio-win/virtio-win.iso', '/usr/share/ovirt-guest-tools-iso/ovirt-tools-setup.iso', '/usr/share/rhev-guest-tools-iso/rhev-tools-setup.iso']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._setup_prevent_dwh_32 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._setup_prevent_reports_32 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.setup_reinstallable.Plugin.setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage setup METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.redhatsupportplugin.versionlock.Plugin._setup 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockApply=list:'['redhat-support-plugin-rhev']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockFilter=list:'['redhat-support-plugin-rhev']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 INFO otopi.context context.runSequence:427 Stage: Environment packages setup 2016-07-12 18:21:35 DEBUG otopi.context context.runSequence:431 STAGE internal_packages 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage internal_packages METHOD otopi.plugins.otopi.core.transaction.Plugin._pre_prepare 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage internal_packages METHOD otopi.plugins.otopi.network.hostname.Plugin._internal_packages 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage internal_packages METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._internal_packages_end 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage internal_packages METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._internal_packages_end 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage internal_packages METHOD otopi.plugins.otopi.core.transaction.Plugin._pre_end 2016-07-12 18:21:35 INFO otopi.context context.runSequence:427 Stage: Programs detection 2016-07-12 18:21:35 DEBUG otopi.context context.runSequence:431 STAGE programs 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage programs METHOD otopi.plugins.otopi.system.command.Plugin._programs 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/chkconfig=str:'/sbin/chkconfig' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/date=str:'/bin/date' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/dig=str:'/usr/bin/dig' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/exportfs=str:'/usr/sbin/exportfs' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/hwclock=str:'/sbin/hwclock' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/initctl=str:'/sbin/initctl' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/ip=str:'/sbin/ip' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/openssl=str:'/usr/bin/openssl' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/pg_dump=str:'/usr/bin/pg_dump' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/pg_restore=str:'/usr/bin/pg_restore' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/psql=str:'/usr/bin/psql' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/reboot=str:'/sbin/reboot' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/restorecon=str:'/sbin/restorecon' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rpm=str:'/bin/rpm' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/selinuxenabled=str:'/usr/sbin/selinuxenabled' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/semanage=str:'/usr/sbin/semanage' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/service=str:'/sbin/service' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/sshd=str:'/usr/sbin/sshd' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/sysctl=str:'/sbin/sysctl' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage programs METHOD otopi.plugins.otopi.services.systemd.Plugin._programs 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage programs METHOD otopi.plugins.otopi.services.rhel.Plugin._programs 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel._programs:75 registering rhel provider 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage programs METHOD otopi.plugins.otopi.services.openrc.Plugin._programs 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage programs METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._programs 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage programs METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki.Plugin._setup 2016-07-12 18:21:35 INFO otopi.context context.runSequence:427 Stage: Environment setup 2016-07-12 18:21:35 DEBUG otopi.context context.runSequence:431 STAGE late_setup 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage late_setup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._late_setup 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service nfs-server exists 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'nfs-server'), executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'nfs-server'), rc=1 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'nfs-server') stdout: 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'nfs-server') stderr: initctl: Unknown job: nfs-server 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service nfs-server exists False upstart=False 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service nfs exists 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'nfs'), executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'nfs'), rc=1 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'nfs') stdout: 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'nfs') stderr: initctl: Unknown job: nfs 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service nfs exists True upstart=False 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs plugin.executeRaw:828 execute: ('/usr/sbin/exportfs',), executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs plugin.executeRaw:878 execute-result: ('/usr/sbin/exportfs',), rc=0 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs plugin.execute:936 execute-output: ('/usr/sbin/exportfs',) stdout: 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs plugin.execute:941 execute-output: ('/usr/sbin/exportfs',) stderr: 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsServiceName=str:'nfs' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage late_setup METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._late_setup_service_state 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.status:141 check service ovirt-websocket-proxy status 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), rc=1 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stdout: 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stderr: initctl: Unknown job: ovirt-websocket-proxy 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-websocket-proxy', 'status'), executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-websocket-proxy', 'status'), rc=3 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'status') stdout: ovirt-websocket-proxy is stopped 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'status') stderr: 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.status:150 service ovirt-websocket-proxy status False 2016-07-12 18:21:35 INFO otopi.context context.runSequence:427 Stage: Environment customization 2016-07-12 18:21:35 DEBUG otopi.context context.runSequence:431 STAGE customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.otopi.network.firewalld.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service firewalld exists 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'firewalld'), executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'firewalld'), rc=1 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'firewalld') stdout: 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'firewalld') stderr: initctl: Unknown job: firewalld 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service firewalld exists False upstart=False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.showupgradekb.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.otopi.core.config.Plugin._customize1 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.otopi.dialog.cli.Plugin._customize 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_common.base.core.reconfigure.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_s_product_options 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== PRODUCT OPTIONS ==-- 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.misc.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/enable=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserAuthzType=str:'ovirt-engine-extension-aaa-jdbc' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyStopNeeded=bool:'True' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_e_product_options 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._continueSetupWithoutAIO 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._version_lock_customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockApply=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockFilter=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesUpgradeList=list:'[{'packages': ['ovirt-engine-extension-aaa-jdbc']}]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.java.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineHeapMax=str:'1967M' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineHeapMin=str:'1967M' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.distro-rpm.packages.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockApply=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc', 'rhevm', 'rhevm-backend', 'rhevm-dbscripts', 'rhevm-restapi', 'rhevm-tools', 'rhevm-tools-backup', 'rhevm-userportal', 'rhevm-webadmin-portal']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockFilter=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc', 'rhevm']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesSetup=list:'['rhevm-setup']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesUpgradeList=list:'[{'packages': ['ovirt-engine-extension-aaa-jdbc']}, {'packages': ['rhevm', 'ovirt-host-deploy', 'redhat-support-plugin-rhev', 'rhevm-branding-rhev', 'rhevm-cli', 'rhevm-doc', 'rhevm-image-uploader', 'rhevm-iso-uploader', 'rhevm-log-collector'], 'group': 'rhevm36'}]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.jboss.Plugin._version_lock_customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.packages.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesSetup=list:'['rhevm-setup', 'rhevm-setup-plugin-websocket-proxy']' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesUpgradeList=list:'[{'packages': ['ovirt-engine-extension-aaa-jdbc']}, {'packages': ['rhevm', 'ovirt-host-deploy', 'redhat-support-plugin-rhev', 'rhevm-branding-rhev', 'rhevm-cli', 'rhevm-doc', 'rhevm-image-uploader', 'rhevm-iso-uploader', 'rhevm-log-collector'], 'group': 'rhevm36'}, {'packages': ['rhevm-websocket-proxy']}]' 2016-07-12 18:21:35 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_packages 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== PACKAGES ==-- 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.setup_reinstallable.Plugin._validation 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_packages 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_allinone 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== ALL IN ONE CONFIGURATION ==-- 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._constomization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.storage.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_allinone 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_network 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== NETWORK CONFIGURATION ==-- 2016-07-12 18:21:35 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:35 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_common.base.network.hostname.Plugin._customization 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.network.hostname hostname._validateFQDNresolvability:195 rhev.lab.localdomain resolves to: set(['10.1.0.113']) 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.network.hostname plugin.executeRaw:828 execute: ['/usr/bin/dig', 'rhev.lab.localdomain'], executable='None', cwd='None', env=None 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.network.hostname plugin.executeRaw:878 execute-result: ['/usr/bin/dig', 'rhev.lab.localdomain'], rc=0 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.network.hostname plugin.execute:936 execute-output: ['/usr/bin/dig', 'rhev.lab.localdomain'] stdout: ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> rhev.lab.localdomain ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 686 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;rhev.lab.localdomain. IN A ;; ANSWER SECTION: rhev.lab.localdomain. 38400 IN A 10.1.0.113 ;; AUTHORITY SECTION: lab.localdomain. 38400 IN NS pandora.lab.localdomain. ;; ADDITIONAL SECTION: pandora.lab.localdomain. 38400 IN A 10.1.0.55 ;; Query time: 2 msec ;; SERVER: 10.1.0.55#53(10.1.0.55) ;; WHEN: Tue Jul 12 18:21:35 2016 ;; MSG SIZE rcvd: 92 2016-07-12 18:21:35 DEBUG otopi.plugins.ovirt_engine_common.base.network.hostname plugin.execute:941 execute-output: ['/usr/bin/dig', 'rhev.lab.localdomain'] stderr: 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.protocols.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ENGINE_CONFIG/fqdn=str:'rhev.lab.localdomain' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._customization_is_requested 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service iptables exists 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'iptables'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'iptables'), rc=1 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'iptables') stdout: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'iptables') stderr: initctl: Unknown job: iptables 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service iptables exists True upstart=False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.status:141 check service iptables status 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'iptables'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'iptables'), rc=1 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'iptables') stdout: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'iptables') stderr: initctl: Unknown job: iptables 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'iptables', 'status'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'iptables', 'status'), rc=3 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'iptables', 'status') stdout: iptables: Firewall is not running. 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'iptables', 'status') stderr: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.status:150 service iptables status False 2016-07-12 18:21:36 INFO otopi.plugins.ovirt_engine_setup.base.network.firewall_manager firewall_manager._customization:219 iptables will be configured as firewall manager. 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.firewall.Plugin._configuration 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.firewall.Plugin._configuration 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{'@JBOSS_HTTP_PORT@': None, '@JBOSS_HTTPS_PORT@': None}' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.firewall.Plugin._configuration 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{'@HTTPS_PORT@': 443, '@JBOSS_HTTP_PORT@': None, '@HTTP_PORT@': 80, '@JBOSS_HTTPS_PORT@': None}' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._network_owners_config_customized 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._customizationNetwork 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config hostname._validateFQDNresolvability:195 rhev.lab.localdomain resolves to: set(['10.1.0.113']) 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config plugin.executeRaw:828 execute: ['/usr/bin/dig', 'rhev.lab.localdomain'], executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config plugin.executeRaw:878 execute-result: ['/usr/bin/dig', 'rhev.lab.localdomain'], rc=0 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config plugin.execute:936 execute-output: ['/usr/bin/dig', 'rhev.lab.localdomain'] stdout: ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> rhev.lab.localdomain ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14385 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;rhev.lab.localdomain. IN A ;; ANSWER SECTION: rhev.lab.localdomain. 38400 IN A 10.1.0.113 ;; AUTHORITY SECTION: lab.localdomain. 38400 IN NS pandora.lab.localdomain. ;; ADDITIONAL SECTION: pandora.lab.localdomain. 38400 IN A 10.1.0.55 ;; Query time: 0 msec ;; SERVER: 10.1.0.55#53(10.1.0.55) ;; WHEN: Tue Jul 12 18:21:36 2016 ;; MSG SIZE rcvd: 92 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config plugin.execute:941 execute-output: ['/usr/bin/dig', 'rhev.lab.localdomain'] stderr: 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}, {'directory': 'vmconsole-proxy', 'name': 'ovirt-vmconsole-proxy'}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{'@HTTPS_PORT@': 443, '@JBOSS_HTTP_PORT@': None, '@HTTP_PORT@': 80, '@VMCONSOLE_PROXY_PORT@': 2222, '@JBOSS_HTTPS_PORT@': None}' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._customization_network 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.websocket_proxy.config hostname._validateFQDNresolvability:195 rhev.lab.localdomain resolves to: set(['10.1.0.113']) 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.websocket_proxy.config plugin.executeRaw:828 execute: ['/usr/bin/dig', 'rhev.lab.localdomain'], executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.websocket_proxy.config plugin.executeRaw:878 execute-result: ['/usr/bin/dig', 'rhev.lab.localdomain'], rc=0 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.websocket_proxy.config plugin.execute:936 execute-output: ['/usr/bin/dig', 'rhev.lab.localdomain'] stdout: ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6 <<>> rhev.lab.localdomain ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49291 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;rhev.lab.localdomain. IN A ;; ANSWER SECTION: rhev.lab.localdomain. 38400 IN A 10.1.0.113 ;; AUTHORITY SECTION: lab.localdomain. 38400 IN NS pandora.lab.localdomain. ;; ADDITIONAL SECTION: pandora.lab.localdomain. 38400 IN A 10.1.0.55 ;; Query time: 0 msec ;; SERVER: 10.1.0.55#53(10.1.0.55) ;; WHEN: Tue Jul 12 18:21:36 2016 ;; MSG SIZE rcvd: 92 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.websocket_proxy.config plugin.execute:941 execute-output: ['/usr/bin/dig', 'rhev.lab.localdomain'] stderr: 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_network 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_database 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== DATABASE CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._customization_enable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/password=str:'**FILTERED**' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._customization_enable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from pg_catalog.pg_tables where schemaname = 'public'; ', args: {} 2016-07-12 18:21:36 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:21:36 DEBUG otopi.ovirt_engine_setup.engine_common.database database.getCredentials:1168 database connection failed Traceback (most recent call last): File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/database.py", line 1166, in getCredentials ] = self.isNewDatabase() File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/database.py", line 364, in isNewDatabase transaction=False, File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/database.py", line 185, in execute database=database, File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/database.py", line 119, in connect sslmode=sslmode, OperationalError: could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._db_owners_connections_customized 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_database 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_engine 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== OVIRT ENGINE CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._customization_enable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.domain_type.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageType=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_engine 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_storage 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== STORAGE CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.storage.Plugin._configureSANWipeAfterDelete 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_storage 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_pki 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== PKI CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._customization_upgrade 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_pki 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_apache 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== APACHE CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_apache 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_system 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== SYSTEM CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._customization_firewall 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}, {'directory': 'vmconsole-proxy', 'name': 'ovirt-vmconsole-proxy'}, {'directory': 'websocket-proxy', 'name': 'ovirt-websocket-proxy'}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{'@WEBSOCKET_PROXY_PORT@': 6100, '@HTTPS_PORT@': 443, '@VMCONSOLE_PROXY_PORT@': 2222, '@HTTP_PORT@': 80, '@JBOSS_HTTPS_PORT@': None, '@JBOSS_HTTP_PORT@': None}' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._customization_enable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.iso_domain.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._customization_disable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._customization_firewall 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}, {'directory': 'vmconsole-proxy', 'name': 'ovirt-vmconsole-proxy'}, {'directory': 'websocket-proxy', 'name': 'ovirt-websocket-proxy'}, {'directory': 'ovirt-engine', 'name': 'ovirt-fence-kdump-listener'}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_system 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_s_misc 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== MISC CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.dialog.titles.Plugin._title_e_misc 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== END OF CONFIGURATION ==-- 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._firewall 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._customization 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.executeRaw:828 execute: ('/bin/rpm', '-q', 'rhevm-dwh'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.executeRaw:878 execute-result: ('/bin/rpm', '-q', 'rhevm-dwh'), rc=1 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.execute:936 execute-output: ('/bin/rpm', '-q', 'rhevm-dwh') stdout: package rhevm-dwh is not installed 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.execute:941 execute-output: ('/bin/rpm', '-q', 'rhevm-dwh') stderr: 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.executeRaw:828 execute: ('/bin/rpm', '-q', 'rhevm-reports'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.executeRaw:878 execute-result: ('/bin/rpm', '-q', 'rhevm-reports'), rc=1 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.execute:936 execute-output: ('/bin/rpm', '-q', 'rhevm-reports') stdout: package rhevm-reports is not installed 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports plugin.execute:941 execute-output: ('/bin/rpm', '-q', 'rhevm-reports') stderr: 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.otopi.core.config.Plugin._customize2 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage customization METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._customization_firewall 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}, {'directory': 'vmconsole-proxy', 'name': 'ovirt-vmconsole-proxy'}, {'directory': 'websocket-proxy', 'name': 'ovirt-websocket-proxy'}, {'directory': 'ovirt-engine', 'name': 'ovirt-fence-kdump-listener'}, {'directory': 'ovirt-common', 'name': 'ovirt-postgres'}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 INFO otopi.context context.runSequence:427 Stage: Setup validation 2016-07-12 18:21:36 DEBUG otopi.context context.runSequence:431 STAGE validation 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.otopi.core.misc.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/aborted=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/debug=int:'0' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/error=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/exceptionInfo=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/executionDirectory=str:'/' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/exitCode=list:'[{'priority': 90001, 'code': 0}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/log=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/pluginGroups=str:'otopi:ovirt-engine-common:ovirt-engine-setup' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/pluginPath=str:'/usr/share/otopi/plugins:/usr/share/ovirt-engine/setup/bin/../plugins' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/suppressEnvironmentKeys=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/chkconfig=str:'/sbin/chkconfig' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/chronyc=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/date=str:'/bin/date' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/dig=str:'/usr/bin/dig' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/exportfs=str:'/usr/sbin/exportfs' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/firewall-cmd=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/hwclock=str:'/sbin/hwclock' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/initctl=str:'/sbin/initctl' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/ip=str:'/sbin/ip' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/ntpq=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/openssl=str:'/usr/bin/openssl' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/pg_dump=str:'/usr/bin/pg_dump' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/pg_restore=str:'/usr/bin/pg_restore' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/postgresql-setup=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/psql=str:'/usr/bin/psql' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rc=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rc-update=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/reboot=str:'/sbin/reboot' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/restorecon=str:'/sbin/restorecon' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rpm=str:'/bin/rpm' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/selinuxenabled=str:'/usr/sbin/selinuxenabled' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/semanage=str:'/usr/sbin/semanage' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/service=str:'/sbin/service' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/sshd=str:'/usr/sbin/sshd' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/sysctl=str:'/sbin/sysctl' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/systemctl=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/configFileAppend=str:':/root/ovirt-engine-answers:/root/heanswers.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/configFileName=str:'/etc/ovirt-engine-setup.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/failOnPrioOverride=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/internalPackageTransaction=Transaction:'transaction' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logDir=str:'/var/log/ovirt-engine/setup' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileHandle=file:'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileName=str:'/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileNamePrefix=str:'ovirt-engine-setup' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilter=_MyLoggerFilter:'filter' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password', 'OVESETUP_CONFIG/adminPassword', 'OVESETUP_PKI/storePassword', 'OVESETUP_CONFIG/remoteEngineHostRootPassword']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logRemoveAtExit=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/mainTransaction=Transaction:'transaction' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/modifiedFiles=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/randomizeEvents=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/boundary=str:'--=451b80dc-996f-432e-9e4f-2b29ef6d1141=--' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/cliVersion=int:'1' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/customization=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/dialect=str:'human' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_NAME=str:'otopi' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_VERSION=str:'1.4.1' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldAvailable=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldDisableServices=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldEnable=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesEnable=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesRules=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshEnable=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshKey=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshUser=str:'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/enableUpgrade=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/requireRollback=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockApply=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc', 'rhevm', 'rhevm-backend', 'rhevm-dbscripts', 'rhevm-restapi', 'rhevm-tools', 'rhevm-tools-backup', 'rhevm-userportal', 'rhevm-webadmin-portal']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockFilter=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc', 'rhevm']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/configure=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/continueWithoutAIO=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/enable=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localCluster=str:'local_cluster' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localDataCenter=str:'local_datacenter' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localHost=str:'local_host' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/sshdPort=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainDefaultDir=str:'/var/lib/images' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainDir=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainName=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/supported=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/vdsmCpu=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileOvirtEngine=str:'/etc/httpd/conf.d/z-ovirt-engine-proxy.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileOvirtRoot=str:'/etc/httpd/conf.d/ovirt-engine-root-redirect.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileSsl=str:'/etc/httpd/conf.d/ssl.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureRootRedirection=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureRootRedirectionDefault=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureSsl=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configured=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/enable=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/httpdService=str:'httpd' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/needRestart=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ASYNC/clearTasks=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ASYNC/clearTasksWait=int:'20' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/addOvirtGlanceRepository=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminPassword=str:'**FILTERED**' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUser=str:'admin@internal' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserAuthzName=str:'internal-authz' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserAuthzType=str:'ovirt-engine-extension-aaa-jdbc' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserId=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserNamespace=str:'*' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/applicationMode=str:'virt' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineDbBackupDir=str:'/var/lib/ovirt-engine/backups' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineHeapMax=str:'1967M' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineHeapMin=str:'1967M' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineServiceStopNeeded=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fenceKdumpListenerStopNeeded=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallChangesReview=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManager=str:'iptables' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[, ]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdn=str:'rhev.lab.localdomain' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdnNonLoopback=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdnReverseValidation=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/httpPort=int:'80' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/httpsPort=int:'443' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainACL=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainDefaultMountPoint=str:'/var/lib/exports/iso' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainExists=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainMountPoint=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainName=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainSdUuid=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainStorageDir=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoPathsToUpload=list:'['/usr/share/virtio-win/virtio-win_x86.vfd', '/usr/share/virtio-win/virtio-win_amd64.vfd', '/usr/share/virtio-win/virtio-win.iso', '/usr/share/ovirt-guest-tools-iso/ovirt-tools-setup.iso', '/usr/share/rhev-guest-tools-iso/rhev-tools-setup.iso']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaHome=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaNeeded=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossAjpPort=int:'8702' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDebugAddress=str:'127.0.0.1:8787' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDirectHttpPort=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDirectHttpsPort=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHome=str:'/usr/share/jbossas' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHttpPort=int:'8080' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHttpsPort=int:'8443' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossNeeded=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/keySize=int:'2048' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/pkiRenewalDocUrl=str:'https://access.redhat.com/solutions/1572983' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/pkiWSPCSRFilename=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/publicHttpPort=int:'80' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/publicHttpsPort=int:'443' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostClientKey=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostKnownHosts=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostRootPassword=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostSshPort=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyle=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyles=list:'[, ]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/sanWipeAfterDelete=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageIsLocal=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageType=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/totalMemoryMB=int:'7870' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/updateFirewall=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/validFirewallManagers=str:'iptables' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyConfig=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyHost=str:'localhost' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyPort=int:'6100' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyStopNeeded=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/action=str:'setup' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/answerFile=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/developerMode=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/engineStop=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/generatePostInstall=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/generatedByVersion=str:'3.6.6.2' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/offlinePackager=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/originalGeneratedByVersion=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/reconfigureOptionalComponents=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/registerUninstallGroups=RegisterGroups:'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/remoteEngine=RemoteEngine:'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, , , , , ]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/upgradeSupportedVersions=str:'3.0,3.1,3.2,3.3,3.4,3.5,3.6' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/connection=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/database=str:'engine' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/dumper=str:'pg_custom' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/filter=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/fixDbViolations=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/host=str:'localhost' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/newDatabase=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/password=str:'**FILTERED**' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/pgPassFile=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/port=int:'5432' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/restoreJobs=int:'2' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/secured=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/securedHostValidation=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/statement=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/upgradeWithHeEl6Hosts=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/user=str:'engine' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DIALOG/confirmSettings=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/docsAreLocal=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/dwhDocUrl=str:'/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/reportsDocUrl=str:'/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ENGINE_CONFIG/fqdn=str:'rhev.lab.localdomain' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ENGINE_CORE/enable=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}, {'directory': 'vmconsole-proxy', 'name': 'ovirt-vmconsole-proxy'}, {'directory': 'websocket-proxy', 'name': 'ovirt-websocket-proxy'}, {'directory': 'ovirt-engine', 'name': 'ovirt-fence-kdump-listener'}, {'directory': 'ovirt-common', 'name': 'ovirt-postgres'}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{'@WEBSOCKET_PROXY_PORT@': 6100, '@HTTPS_PORT@': 443, '@VMCONSOLE_PROXY_PORT@': 2222, '@HTTP_PORT@': 80, '@JBOSS_HTTPS_PORT@': None, '@JBOSS_HTTP_PORT@': None}' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/country=str:'US' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/organization=str:'lab.localdomain' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/renew=NoneType:'None' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/storePassword=str:'**FILTERED**' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresConf=str:'/var/lib/pgsql/data/postgresql.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresLCMessages=str:''en_US.UTF-8'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresListenAddress=str:''*'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresMaxConn=int:'150' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresPgHba=str:'/var/lib/pgsql/data/pg_hba.conf' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresPgVersion=str:'/var/lib/pgsql/data/PG_VERSION' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresService=str:'postgresql' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RHEVM_DIALOG/confirmUpgrade=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RHEVM_SUPPORT/redhatSupportProxyEnabled=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/aaaJdbcPackage=str:'ovirt-engine-extension-aaa-jdbc' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/additionalPackages=str:'ovirt-host-deploy,redhat-support-plugin-rhev,rhevm-branding-rhev,rhevm-cli,rhevm-doc,rhevm-image-uploader,rhevm-iso-uploader,rhevm-log-collector' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/enginePackages=str:'rhevm' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/engineSetupPackages=str:'rhevm-setup' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/jbossPackages=str:'' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesSetup=list:'['rhevm-setup', 'rhevm-setup-plugin-websocket-proxy']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesUpgradeList=list:'[{'packages': ['ovirt-engine-extension-aaa-jdbc']}, {'packages': ['rhevm', 'ovirt-host-deploy', 'redhat-support-plugin-rhev', 'rhevm-branding-rhev', 'rhevm-cli', 'rhevm-doc', 'rhevm-image-uploader', 'rhevm-iso-uploader', 'rhevm-log-collector'], 'group': 'rhevm36'}, {'packages': ['rhevm-websocket-proxy']}]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/upgradeYumGroup=str:'rhevm36' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupEngine=str:'ovirt' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupKvm=str:'kvm' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupVmConsole=str:'ovirt-vmconsole' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/hostileServices=str:'ovirt-engine-dwhd,ovirt-engine-notifier' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckEnabled=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckMinimumMB=int:'4096' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckRecommendedMB=int:'16384' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckThreshold=int:'90' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsConfigEnabled=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsConfigEnabled_legacyInPostInstall=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsServiceName=str:'nfs' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxBooleans=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxContexts=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxRestorePaths=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/shmmax=int:'68719476736' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userApache=str:'apache' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userEngine=str:'ovirt' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userPostgres=str:'postgres' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userRoot=str:'root' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userVdsm=str:'vdsm' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userVmConsole=str:'ovirt-vmconsole' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyConfig=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyPort=int:'2222' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_WSP_RPMDISRO_PACKAGES=str:'rhevm-websocket-proxy' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_WSP_RPMDISRO_PACKAGES_SETUP=str:'rhevm-setup-plugin-websocket-proxy' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfDisabledPlugins=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfExpireCache=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfRollback=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfpackagerEnabled=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/keepAliveInterval=int:'30' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumDisabledPlugins=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumEnabledPlugins=list:'[]' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumExpireCache=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumRollback=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumpackagerEnabled=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/clockMaxGap=int:'5' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/clockSet=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/commandPath=str:'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/reboot=bool:'False' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/rebootAllow=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/rebootDeferTime=int:'10' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._validation_enable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._validateEnv 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._validate_enable 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesEnable=bool:'True' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesRules=str:'# Generated by ovirt-engine installer #filtering rules *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT -A INPUT -p udp -m state --state NEW -m udp --dport 7410 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 6100 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 2222 -j ACCEPT #drop all rule -A INPUT -j REJECT --reject-with icmp-host-prohibited COMMIT ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-fence-kdump-listener=str:' ovirt-fence-kdump-listener oVirt configured fence_kdump listener service ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-http=str:' ovirt-http oVirt configured http service ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-https=str:' ovirt-https oVirt configured https service ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-postgres=str:' ovirt-postgres oVirt configured postgres service ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-vmconsole-proxy=str:' ovirt-vmconsole-proxy oVirt configured VM Console Proxy service ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-websocket-proxy=str:' ovirt-websocket-proxy oVirt configured WebSocket Proxy service ' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports', '/etc/sysconfig/iptables']' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.otopi.network.firewalld.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.otopi.network.hostname.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname hostname._validation:76 my name: rhev.lab.localdomain 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname plugin.executeRaw:828 execute: ('/sbin/ip', 'addr', 'show'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname plugin.executeRaw:878 execute-result: ('/sbin/ip', 'addr', 'show'), rc=0 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname plugin.execute:936 execute-output: ('/sbin/ip', 'addr', 'show') stdout: 1: lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:16:3e:26:19:6c brd ff:ff:ff:ff:ff:ff inet 10.1.0.113/24 brd 10.1.0.255 scope global eth0 inet6 fe80::216:3eff:fe26:196c/64 scope link valid_lft forever preferred_lft forever 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname plugin.execute:941 execute-output: ('/sbin/ip', 'addr', 'show') stderr: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname hostname._validation:113 my addresses: ['10.1.0.113', '10.1.0.113', '10.1.0.113'] 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.network.hostname hostname._validation:114 local addresses: [u'10.1.0.113', u'fe80::216:3eff:fe26:196c'] 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.otopi.network.iptables.Plugin._validate 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.otopi.network.ssh.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.executeRaw:828 execute: ('/usr/sbin/selinuxenabled',), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.executeRaw:878 execute-result: ('/usr/sbin/selinuxenabled',), rc=0 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.execute:936 execute-output: ('/usr/sbin/selinuxenabled',) stdout: 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.execute:941 execute-output: ('/usr/sbin/selinuxenabled',) stderr: 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service ovirt-engine exists 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine'), rc=1 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stdout: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stderr: initctl: Unknown job: ovirt-engine 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service ovirt-engine exists True upstart=False 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.status:141 check service ovirt-engine status 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine'), rc=1 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stdout: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stderr: initctl: Unknown job: ovirt-engine 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-engine', 'status'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-engine', 'status'), rc=3 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-engine', 'status') stdout: ovirt-engine is stopped 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-engine', 'status') stderr: 2016-07-12 18:21:36 DEBUG otopi.plugins.otopi.services.rhel rhel.status:150 service ovirt-engine status False 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.config.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass.Plugin._validation 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass plugin.executeRaw:828 execute: ('/usr/bin/psql', '-V'), executable='None', cwd='None', env=None 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass plugin.executeRaw:878 execute-result: ('/usr/bin/psql', '-V'), rc=0 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass plugin.execute:936 execute-output: ('/usr/bin/psql', '-V') stdout: psql (PostgreSQL) 8.4.20 contains support for command-line editing 2016-07-12 18:21:36 DEBUG otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass plugin.execute:941 execute-output: ('/usr/bin/psql', '-V') stderr: 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/pgPassFile=str:'/tmp/tmpfPEXjH' 2016-07-12 18:21:36 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:36 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.config.java.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:21:37 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaHome=unicode:'/usr/lib/jvm/jre' 2016-07-12 18:21:37 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._review_config 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.cpu.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service postgresql exists 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'postgresql'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'postgresql'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'postgresql') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'postgresql') stderr: initctl: Unknown job: postgresql 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service postgresql exists True upstart=False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs exportfs._validation:166 move=False, generate=False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._validateMemory 2016-07-12 18:21:37 WARNING otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck memcheck._check_requirements:83 Less than 16384MB of memory is available 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._validateContinueLowMemory 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._validateZombies 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.hosted_engine.Plugin._validate_hosted_engine 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._validate_ssl 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.executeRaw:828 execute: ('/sbin/sysctl', '-n', 'kernel.shmmax'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.executeRaw:878 execute-result: ('/sbin/sysctl', '-n', 'kernel.shmmax'), rc=0 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.execute:936 execute-output: ('/sbin/sysctl', '-n', 'kernel.shmmax') stdout: 68719476736 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.execute:941 execute-output: ('/sbin/sysctl', '-n', 'kernel.shmmax') stderr: 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.image_upload.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.pki30.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.pki30 pki30._validation:68 Checking legacy PKI upgrade failure 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.base.dialog.preview.Plugin._customization 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== CONFIGURATION PREVIEW ==-- 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Application mode : virt 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Default SAN wipe after delete : False 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Firewall manager : iptables 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Update Firewall : True 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Host FQDN : rhev.lab.localdomain 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine database secured connection : False 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine database host : localhost 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine database user name : engine 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine database name : engine 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine database port : 5432 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine database host name validation : False 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine installation : True 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND PKI organization : lab.localdomain 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Configure local Engine database : True 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Set application as default page : True 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Configure Apache SSL : True 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Configure VMConsole Proxy : True 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Engine Host FQDN : rhev.lab.localdomain 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Configure WebSocket Proxy : True 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._validation_late 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaakerbldap.Plugin._validation_late 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.asynctasks.Plugin._validateAsyncTasks 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dbvalidations.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage validation METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaainternal.Plugin._validation 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 INFO otopi.context context.runSequence:427 Stage: Transaction setup 2016-07-12 18:21:37 DEBUG otopi.context context.runSequence:431 STAGE transaction-prepare 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage transaction-prepare METHOD otopi.plugins.otopi.core.transaction.Plugin._main_prepare 2016-07-12 18:21:37 DEBUG otopi.transaction transaction._prepare:76 preparing 'Database Transaction' 2016-07-12 18:21:37 DEBUG otopi.transaction transaction._prepare:76 preparing 'Version Lock Transaction' 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage transaction-prepare METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._transaction_begin 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service ovirt-engine-dwhd exists 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine-dwhd'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine-dwhd'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine-dwhd') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine-dwhd') stderr: initctl: Unknown job: ovirt-engine-dwhd 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service ovirt-engine-dwhd exists False upstart=False 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service ovirt-engine-notifier exists 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine-notifier'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine-notifier'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine-notifier') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine-notifier') stderr: initctl: Unknown job: ovirt-engine-notifier 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service ovirt-engine-notifier exists True upstart=False 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.status:141 check service ovirt-engine-notifier status 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine-notifier'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine-notifier'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine-notifier') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine-notifier') stderr: initctl: Unknown job: ovirt-engine-notifier 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-engine-notifier', 'status'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-engine-notifier', 'status'), rc=3 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-engine-notifier', 'status') stdout: ovirt-engine-notifier is stopped 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-engine-notifier', 'status') stderr: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.status:150 service ovirt-engine-notifier status False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage transaction-prepare METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine.Plugin._transactionBegin 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service ovirt-engine exists 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stderr: initctl: Unknown job: ovirt-engine 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service ovirt-engine exists True upstart=False 2016-07-12 18:21:37 INFO otopi.plugins.ovirt_engine_common.ovirt_engine.core.engine engine._transactionBegin:105 Stopping engine service 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service ovirt-engine 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stderr: initctl: Unknown job: ovirt-engine 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-engine', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-engine', 'stop'), rc=0 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-engine', 'stop') stdout: Stopping oVirt Engine: [FAILED] 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-engine', 'stop') stderr: 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage transaction-prepare METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.core.fence_kdump_listener.Plugin._transactionBegin 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service ovirt-fence-kdump-listener exists 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stderr: initctl: Unknown job: ovirt-fence-kdump-listener 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service ovirt-fence-kdump-listener exists True upstart=False 2016-07-12 18:21:37 INFO otopi.plugins.ovirt_engine_common.ovirt_engine.core.fence_kdump_listener fence_kdump_listener._transactionBegin:63 Stopping ovirt-fence-kdump-listener service 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service ovirt-fence-kdump-listener 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stderr: initctl: Unknown job: ovirt-fence-kdump-listener 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop'), rc=0 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop') stdout: Stopping oVirt fence_kdump listener: [FAILED] 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop') stderr: 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage transaction-prepare METHOD otopi.plugins.ovirt_engine_common.websocket_proxy.core.Plugin._transactionBegin 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service ovirt-websocket-proxy exists 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stderr: initctl: Unknown job: ovirt-websocket-proxy 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service ovirt-websocket-proxy exists True upstart=False 2016-07-12 18:21:37 INFO otopi.plugins.ovirt_engine_common.websocket_proxy.core core._transactionBegin:70 Stopping websocket-proxy service 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service ovirt-websocket-proxy 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), rc=1 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stdout: 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stderr: initctl: Unknown job: ovirt-websocket-proxy 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-websocket-proxy', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-websocket-proxy', 'stop'), rc=0 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'stop') stdout: Stopping oVirt Engine websockets proxy: [FAILED] 2016-07-12 18:21:37 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'stop') stderr: 2016-07-12 18:21:37 INFO otopi.context context.runSequence:427 Stage: Misc configuration 2016-07-12 18:21:37 DEBUG otopi.context context.runSequence:431 STAGE early_misc 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage early_misc METHOD otopi.plugins.otopi.network.firewalld.Plugin._early_misc 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage early_misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dbvalidations.Plugin._misc 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 INFO otopi.context context.runSequence:427 Stage: Package installation 2016-07-12 18:21:37 DEBUG otopi.context context.runSequence:431 STAGE packages 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage packages METHOD otopi.plugins.otopi.network.iptables.Plugin._packages 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage packages METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages.Plugin.packages 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage packages METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._packages 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage packages METHOD otopi.plugins.otopi.packagers.dnfpackager.Plugin._packages 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage packages METHOD otopi.plugins.otopi.packagers.yumpackager.Plugin._packages 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 INFO otopi.context context.runSequence:427 Stage: Misc configuration 2016-07-12 18:21:37 DEBUG otopi.context context.runSequence:431 STAGE misc 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.config.jboss.Plugin._jboss 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.otopi.system.command.Plugin._misc 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl.Plugin._misc 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.executeRaw:828 execute: ('/sbin/sysctl', '-n', 'kernel.shmmax'), executable='None', cwd='None', env=None 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.executeRaw:878 execute-result: ('/sbin/sysctl', '-n', 'kernel.shmmax'), rc=0 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.execute:936 execute-output: ('/sbin/sysctl', '-n', 'kernel.shmmax') stdout: 68719476736 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.system.sysctl plugin.execute:941 execute-output: ('/sbin/sysctl', '-n', 'kernel.shmmax') stderr: 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.otopi.network.firewalld.Plugin._misc 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.otopi.network.iptables.Plugin._store_iptables 2016-07-12 18:21:37 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/sysconfig/iptables'' 2016-07-12 18:21:37 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/sysconfig/iptables' missing 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.otopi.network.ssh.Plugin._append_key 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.otopi.system.clock.Plugin._set_clock 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:21:37 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._misc 2016-07-12 18:21:37 INFO otopi.ovirt_engine_setup.engine_common.postgres postgres._initDbIfRequired:211 Initializing PostgreSQL 2016-07-12 18:21:37 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres plugin.executeRaw:828 execute: ('/etc/init.d/postgresql', 'initdb'), executable='None', cwd='None', env=None 2016-07-12 18:21:46 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres plugin.executeRaw:878 execute-result: ('/etc/init.d/postgresql', 'initdb'), rc=0 2016-07-12 18:21:46 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres plugin.execute:936 execute-output: ('/etc/init.d/postgresql', 'initdb') stdout: Initializing database: [ OK ] 2016-07-12 18:21:46 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres plugin.execute:941 execute-output: ('/etc/init.d/postgresql', 'initdb') stderr: 2016-07-12 18:21:46 INFO otopi.ovirt_engine_setup.engine_common.postgres postgres.provision:457 Creating PostgreSQL 'engine' database 2016-07-12 18:21:46 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/var/lib/pgsql/data/pg_hba.conf'' 2016-07-12 18:21:46 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/var/lib/pgsql/data/pg_hba.conf' exists 2016-07-12 18:21:46 DEBUG otopi.filetransaction filetransaction.prepare:204 file '/var/lib/pgsql/data/pg_hba.conf' already has content 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service postgresql 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'postgresql'), executable='None', cwd='None', env=None 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'postgresql'), rc=1 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'postgresql') stdout: 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'postgresql') stderr: initctl: Unknown job: postgresql 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'postgresql', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'postgresql', 'stop'), rc=0 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'postgresql', 'stop') stdout: Stopping postgresql service: [ OK ] 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'postgresql', 'stop') stderr: 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service postgresql 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'postgresql'), executable='None', cwd='None', env=None 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'postgresql'), rc=1 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'postgresql') stdout: 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'postgresql') stderr: initctl: Unknown job: postgresql 2016-07-12 18:21:46 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'postgresql', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:21:48 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'postgresql', 'start'), rc=0 2016-07-12 18:21:48 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'postgresql', 'start') stdout: Starting postgresql service: [ OK ] 2016-07-12 18:21:48 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'postgresql', 'start') stderr: 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.postgres postgres._waitForDatabase:380 Attempting to connect database 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select 1 ', args: {} 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'?column?': 1}] 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.tryDatabaseConnect:328 Connection succeeded 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from pg_database where datname = %(database)s ', args: {'database': 'engine'} 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 0L}] 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from pg_user where usename = %(user)s ', args: {'user': 'engine'} 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 0L}] 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' create role engine with login encrypted password %(password)s ', args: {'password': '**FILTERED**'} 2016-07-12 18:21:48 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:21:49 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:21:49 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' create database engine owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8' ', args: {'password': '**FILTERED**'} 2016-07-12 18:21:49 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:22:08 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:22:08 DEBUG otopi.transaction transaction.abort:134 aborting 'File transaction for '/var/lib/pgsql/data/pg_hba.conf'' 2016-07-12 18:22:08 INFO otopi.ovirt_engine_setup.engine_common.postgres postgres.provision:501 Configuring PostgreSQL 2016-07-12 18:22:08 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/var/lib/pgsql/data/postgresql.conf'' 2016-07-12 18:22:08 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/var/lib/pgsql/data/postgresql.conf' exists 2016-07-12 18:22:08 DEBUG otopi.filetransaction filetransaction.prepare:234 backup '/var/lib/pgsql/data/postgresql.conf'->'/var/lib/pgsql/data/postgresql.conf.20160712182208' 2016-07-12 18:22:08 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/var/lib/pgsql/data/pg_hba.conf'' 2016-07-12 18:22:08 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/var/lib/pgsql/data/pg_hba.conf' exists 2016-07-12 18:22:08 DEBUG otopi.filetransaction filetransaction.prepare:234 backup '/var/lib/pgsql/data/pg_hba.conf'->'/var/lib/pgsql/data/pg_hba.conf.20160712182208' 2016-07-12 18:22:09 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/var/lib/pgsql/data/pg_hba.conf'' 2016-07-12 18:22:09 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /var/lib/pgsql/data/pg_hba.conf 2016-07-12 18:22:09 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:22:09 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/var/lib/pgsql/data/postgresql.conf'' 2016-07-12 18:22:09 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /var/lib/pgsql/data/postgresql.conf 2016-07-12 18:22:09 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service postgresql startup to True 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'postgresql'), executable='None', cwd='None', env=None 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'postgresql'), rc=1 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'postgresql') stdout: 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'postgresql') stderr: initctl: Unknown job: postgresql 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'postgresql', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'postgresql', 'on'), rc=0 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'postgresql', 'on') stdout: 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'postgresql', 'on') stderr: 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service postgresql 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'postgresql'), executable='None', cwd='None', env=None 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'postgresql'), rc=1 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'postgresql') stdout: 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'postgresql') stderr: initctl: Unknown job: postgresql 2016-07-12 18:22:09 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'postgresql', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'postgresql', 'stop'), rc=0 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'postgresql', 'stop') stdout: Stopping postgresql service: [ OK ] 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'postgresql', 'stop') stderr: 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service postgresql 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'postgresql'), executable='None', cwd='None', env=None 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'postgresql'), rc=1 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'postgresql') stdout: 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'postgresql') stderr: initctl: Unknown job: postgresql 2016-07-12 18:22:10 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'postgresql', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:22:12 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'postgresql', 'start'), rc=0 2016-07-12 18:22:12 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'postgresql', 'start') stdout: Starting postgresql service: [ OK ] 2016-07-12 18:22:12 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'postgresql', 'start') stderr: 2016-07-12 18:22:12 DEBUG otopi.ovirt_engine_setup.engine_common.postgres postgres._waitForDatabase:380 Attempting to connect database 2016-07-12 18:22:12 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select 1 ', args: {} 2016-07-12 18:22:12 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:176 Creating own connection 2016-07-12 18:22:12 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'?column?': 1}] 2016-07-12 18:22:12 DEBUG otopi.ovirt_engine_setup.engine_common.database database.tryDatabaseConnect:328 Connection succeeded 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/modifiedFiles=list:'['/var/lib/pgsql/data/pg_hba.conf', '/var/lib/pgsql/data/postgresql.conf']' 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports', '/etc/sysconfig/iptables', '/var/lib/pgsql/data/postgresql.conf', '/var/lib/pgsql/data/pg_hba.conf']' 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:22:12 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_common.ovirt_engine.db.pgpass.Plugin._misc 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/pgPassFile=str:'/tmp/tmpmJJtRQ' 2016-07-12 18:22:12 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:22:12 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._prepare_examples 2016-07-12 18:22:12 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/iptables.example'' 2016-07-12 18:22:12 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/iptables.example' missing 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.core.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.storage.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.engine.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/httpd/conf.d/z-ovirt-engine-proxy.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/httpd/conf.d/z-ovirt-engine-proxy.conf' missing 2016-07-12 18:22:13 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:22:13 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/needRestart=bool:'True' 2016-07-12 18:22:13 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.apache.root.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/httpd/conf.d/ovirt-engine-root-redirect.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/httpd/conf.d/ovirt-engine-root-redirect.conf' missing 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaainternal.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.database.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf' missing 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.java.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-java.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/engine.conf.d/10-setup-java.conf' missing 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.jboss.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-jboss.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/engine.conf.d/10-setup-jboss.conf' missing 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/notifier/notifier.conf.d/10-setup-jboss.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/notifier/notifier.conf.d/10-setup-jboss.conf' missing 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.protocols.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-protocols.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/engine.conf.d/10-setup-protocols.conf' missing 2016-07-12 18:22:13 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.tools.Plugin._misc 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/isouploader.conf.d/10-engine-setup.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/isouploader.conf.d/10-engine-setup.conf' missing 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/imageuploader.conf.d/10-engine-setup.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/imageuploader.conf.d/10-engine-setup.conf' missing 2016-07-12 18:22:13 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/logcollector.conf.d/10-engine-setup.conf'' 2016-07-12 18:22:13 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/logcollector.conf.d/10-engine-setup.conf' missing 2016-07-12 18:22:14 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.advertise_dwh.Plugin._get_dwh_host 2016-07-12 18:22:14 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:22:14 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dwh.Plugin._misc_stop_remote_dwh 2016-07-12 18:22:14 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:22:14 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema.Plugin._misc 2016-07-12 18:22:14 DEBUG otopi.transaction transaction._prepare:76 preparing 'Engine schema Transaction' 2016-07-12 18:22:14 INFO otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema schema._misc:252 Creating/refreshing Engine database schema 2016-07-12 18:22:14 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.executeRaw:828 execute: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'], executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'DBFUNC_DB_PGPASSFILE': '/tmp/tmpmJJtRQ', 'previous': 'N'} ********* QUERY ********** select 1; ************************** 1 ********* QUERY ********** copy ( select count(*) as count from pg_catalog.pg_tables where tablename = 'schema_version' and schemaname = 'public' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select count(*) from pg_language where lanname='plpgsql' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** create language 'plpgsql'; ************************** CREATE LANGUAGE ********* QUERY ********** ALTER DATABASE "engine" SET client_min_messages=ERROR; ************************** ALTER DATABASE ********* QUERY ********** CREATE TYPE all_storage_usage_rs AS ( quota_storage_id uuid, quota_id uuid, storage_id uuid, storage_name character varying(250), storage_size_gb bigint, storage_size_gb_usage double precision ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE all_vds_group_usage_rs AS ( quota_vds_group_id uuid, quota_id uuid, vds_group_id uuid, vds_group_name character varying(40), virtual_cpu integer, virtual_cpu_usage integer, mem_size_mb bigint, mem_size_mb_usage bigint ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE authzentryinfotype AS ( name text, namespace character varying(2048), authz character varying(255) ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE booleanresulttype AS ( result boolean ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE idtexttype AS ( id text ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE iduuidtype AS ( id uuid ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE user_permissions AS ( permission_id uuid, role_id uuid, user_id uuid ); ************************** CREATE TYPE ********* QUERY ********** CREATE TYPE vds_group_usage_rs AS ( virtual_cpu_usage integer, mem_size_mb_usage bigint ); ************************** CREATE TYPE ********* QUERY ********** CREATE TABLE action_version_map ( action_type integer NOT NULL, cluster_minimal_version character varying(40) NOT NULL, storage_pool_minimal_version character varying(40) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE ad_groups ( id uuid NOT NULL, name character varying(256) NOT NULL, status integer NOT NULL, domain character varying(100), distinguishedname character varying(4000) DEFAULT NULL::character varying ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE async_tasks ( task_id uuid NOT NULL, action_type integer NOT NULL, status integer NOT NULL, result integer NOT NULL, action_parameters text, action_params_class character varying(256), step_id uuid, command_id uuid NOT NULL, started_at timestamp with time zone, storage_pool_id uuid, task_type integer DEFAULT 0 NOT NULL, task_parameters text, task_params_class character varying(256), vdsm_task_id uuid, root_command_id uuid ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE async_tasks_entities ( async_task_id uuid NOT NULL, entity_id uuid NOT NULL, entity_type character varying(128) ); ************************** CREATE TABLE ********* QUERY ********** CREATE SEQUENCE audit_log_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE audit_log ( audit_log_id bigint DEFAULT nextval('audit_log_seq'::regclass) NOT NULL, user_id uuid, user_name character varying(255), vm_id uuid, vm_name character varying(255), vm_template_id uuid, vm_template_name character varying(40), vds_id uuid, vds_name character varying(255), log_time timestamp with time zone NOT NULL, log_type_name character varying(100) DEFAULT ''::character varying, log_type integer NOT NULL, severity integer NOT NULL, message text NOT NULL, processed boolean DEFAULT false NOT NULL, storage_pool_id uuid, storage_pool_name character varying(40), storage_domain_id uuid, storage_domain_name character varying(250), vds_group_id uuid, vds_group_name character varying(255), correlation_id character varying(50), job_id uuid, quota_id uuid, quota_name character varying(60), gluster_volume_id uuid, gluster_volume_name character varying(1000), origin character varying(255) DEFAULT 'oVirt'::character varying, custom_event_id integer DEFAULT (-1), event_flood_in_sec integer DEFAULT 30, custom_data text DEFAULT ''::text, deleted boolean DEFAULT false, call_stack text DEFAULT ''::text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE base_disks ( disk_id uuid NOT NULL, disk_interface character varying(32) NOT NULL, wipe_after_delete boolean DEFAULT false NOT NULL, propagate_errors character varying(32) DEFAULT 'Off'::character varying NOT NULL, disk_alias character varying(255), disk_description character varying(500), shareable boolean DEFAULT false, boot boolean DEFAULT false NOT NULL, sgio smallint, alignment smallint DEFAULT 0 NOT NULL, last_alignment_scan timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE bookmarks ( bookmark_id uuid NOT NULL, bookmark_name character varying(40), bookmark_value character varying(300) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE business_entity_snapshot ( id uuid NOT NULL, command_id uuid NOT NULL, command_type character varying(256) NOT NULL, entity_id character varying(128), entity_type character varying(128), entity_snapshot text, snapshot_class character varying(128), snapshot_type integer, insertion_order integer, started_at timestamp with time zone DEFAULT now() ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE cluster_policies ( id uuid NOT NULL, name character varying(128) NOT NULL, description character varying(4000), is_locked boolean NOT NULL, is_default boolean NOT NULL, custom_properties text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE cluster_policy_units ( cluster_policy_id uuid, policy_unit_id uuid, filter_sequence integer DEFAULT 0, factor integer DEFAULT 1 ); ************************** CREATE TABLE ********* QUERY ********** CREATE SEQUENCE custom_actions_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE custom_actions ( action_id integer DEFAULT nextval('custom_actions_seq'::regclass) NOT NULL, action_name character varying(50) NOT NULL, path character varying(300) NOT NULL, tab integer NOT NULL, description character varying(4000) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE disk_image_dynamic ( image_id uuid NOT NULL, read_rate integer, write_rate integer, actual_size bigint NOT NULL, read_latency_seconds numeric(18,9), write_latency_seconds numeric(18,9), flush_latency_seconds numeric(18,9), _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE disk_lun_map ( disk_id uuid NOT NULL, lun_id character varying NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE dwh_history_timekeeping ( var_name character varying(50) NOT NULL, var_value character varying(255), var_datetime timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = true; ************************** SET ********* QUERY ********** CREATE TABLE dwh_osinfo ( os_id integer NOT NULL, os_name character varying(255) ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = false; ************************** SET ********* QUERY ********** CREATE TABLE event_map ( event_up_name character varying(100) NOT NULL, event_down_name character varying(100) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE event_notification_hist ( subscriber_id uuid NOT NULL, event_name character varying(100) NOT NULL, audit_log_id bigint NOT NULL, method_type character(10) NOT NULL, sent_at timestamp with time zone NOT NULL, status boolean NOT NULL, reason character(255) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE event_notification_methods ( method_id integer NOT NULL, method_type character(10) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE event_subscriber ( subscriber_id uuid NOT NULL, event_up_name character varying(100) NOT NULL, method_id integer NOT NULL, method_address character varying(255), tag_name character varying(50) DEFAULT ''::character varying NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = true; ************************** SET ********* QUERY ********** CREATE TABLE gluster_cluster_services ( cluster_id uuid NOT NULL, service_type character varying(100) NOT NULL, status character varying(32) NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = false; ************************** SET ********* QUERY ********** CREATE TABLE gluster_hooks ( id uuid NOT NULL, cluster_id uuid NOT NULL, gluster_command character varying(128) NOT NULL, stage character varying(50) NOT NULL, name character varying(256) NOT NULL, hook_status character varying(50), content_type character varying(50), checksum character varying(256), content text, conflict_status integer DEFAULT 0 NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = true; ************************** SET ********* QUERY ********** CREATE TABLE gluster_server ( server_id uuid NOT NULL, gluster_server_uuid uuid NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = false; ************************** SET ********* QUERY ********** CREATE TABLE gluster_server_hooks ( hook_id uuid NOT NULL, server_id uuid NOT NULL, hook_status character varying(50), content_type character varying(50), checksum character varying(256), _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = true; ************************** SET ********* QUERY ********** CREATE TABLE gluster_server_services ( id uuid NOT NULL, server_id uuid NOT NULL, service_id uuid NOT NULL, pid integer, status character varying(32) NOT NULL, message character varying(1000), _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_service_types ( service_type character varying(100) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_services ( id uuid NOT NULL, service_type character varying(100) NOT NULL, service_name character varying(100) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = false; ************************** SET ********* QUERY ********** CREATE TABLE gluster_volume_access_protocols ( volume_id uuid NOT NULL, access_protocol character varying(32) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_volume_bricks ( volume_id uuid NOT NULL, server_id uuid NOT NULL, brick_dir character varying(4096) NOT NULL, status character varying(32) NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, _update_date timestamp with time zone, id uuid NOT NULL, brick_order integer DEFAULT 0, task_id uuid ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_volume_options ( volume_id uuid NOT NULL, option_key character varying(8192) NOT NULL, option_val character varying(8192) NOT NULL, id uuid NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_volume_transport_types ( volume_id uuid NOT NULL, transport_type character varying(32) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_volumes ( id uuid NOT NULL, cluster_id uuid NOT NULL, vol_name character varying(1000) NOT NULL, vol_type character varying(32) NOT NULL, status character varying(32) NOT NULL, replica_count integer DEFAULT 0 NOT NULL, stripe_count integer DEFAULT 0 NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, _update_date timestamp with time zone, task_id uuid ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE image_storage_domain_map ( image_id uuid NOT NULL, storage_domain_id uuid NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE images ( image_guid uuid NOT NULL, creation_date timestamp with time zone NOT NULL, size bigint NOT NULL, it_guid uuid NOT NULL, parentid uuid, imagestatus integer DEFAULT 0, lastmodified timestamp with time zone, vm_snapshot_id uuid, volume_type integer DEFAULT 2 NOT NULL, volume_format integer DEFAULT 4 NOT NULL, image_group_id uuid, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, quota_id uuid, active boolean DEFAULT false NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE job ( job_id uuid NOT NULL, action_type character varying(50) NOT NULL, description text NOT NULL, status character varying(32) NOT NULL, owner_id uuid, visible boolean DEFAULT true NOT NULL, start_time timestamp with time zone NOT NULL, end_time timestamp with time zone, last_update_time timestamp with time zone, correlation_id character varying(50) NOT NULL, is_external boolean DEFAULT false, is_auto_cleared boolean DEFAULT true ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE job_subject_entity ( job_id uuid NOT NULL, entity_id uuid NOT NULL, entity_type character varying(32) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE lun_storage_server_connection_map ( lun_id character varying(255) NOT NULL, storage_server_connection character varying(50) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE luns ( physical_volume_id character varying(50), lun_id character varying(255) NOT NULL, volume_group_id character varying(50) NOT NULL, serial character varying(4000), lun_mapping integer, vendor_id character varying(50), product_id character varying(50), device_size integer DEFAULT 0 ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE materialized_views ( mv_name name NOT NULL, v_name name NOT NULL, refresh_rate_in_sec integer, last_refresh timestamp with time zone, avg_cost_ms integer DEFAULT 0 NOT NULL, min_refresh_rate_in_sec integer DEFAULT 0, custom boolean DEFAULT false, active boolean DEFAULT true ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE network ( id uuid NOT NULL, name character varying(50) NOT NULL, description character varying(4000), type integer, addr character varying(50), subnet character varying(20), gateway character varying(20), vlan_id integer, stp boolean DEFAULT false NOT NULL, storage_pool_id uuid, mtu integer, vm_network boolean DEFAULT true NOT NULL, provider_network_provider_id uuid, provider_network_external_id text, free_text_comment text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE network_cluster ( network_id uuid NOT NULL, cluster_id uuid NOT NULL, status integer DEFAULT 0 NOT NULL, is_display boolean DEFAULT false NOT NULL, required boolean DEFAULT true NOT NULL, migration boolean DEFAULT false NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = true; ************************** SET ********* QUERY ********** CREATE TABLE network_qos ( id uuid NOT NULL, name character varying(50) NOT NULL, storage_pool_id uuid NOT NULL, inbound_average integer, inbound_peak integer, inbound_burst integer, outbound_average integer, outbound_peak integer, outbound_burst integer, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = false; ************************** SET ********* QUERY ********** CREATE TABLE permissions ( id uuid NOT NULL, role_id uuid NOT NULL, ad_element_id uuid NOT NULL, object_id uuid NOT NULL, object_type_id integer NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE policy_units ( id uuid NOT NULL, name character varying(128) NOT NULL, is_internal boolean NOT NULL, custom_properties_regex text, type smallint DEFAULT 0, enabled boolean DEFAULT true NOT NULL, description text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE providers ( id uuid NOT NULL, name character varying(128) NOT NULL, description character varying(4000), url character varying(512) NOT NULL, provider_type character varying(32) NOT NULL, auth_required boolean NOT NULL, auth_username character varying(64), auth_password text, _create_date timestamp with time zone DEFAULT now(), _update_date timestamp with time zone, custom_properties text, tenant_name character varying(128), plugin_type character varying(64), agent_configuration text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE quota ( id uuid NOT NULL, storage_pool_id uuid NOT NULL, quota_name character varying(65) NOT NULL, description character varying(250), _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, threshold_vds_group_percentage integer DEFAULT 80, threshold_storage_percentage integer DEFAULT 80, grace_vds_group_percentage integer DEFAULT 20, grace_storage_percentage integer DEFAULT 20 ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE quota_limitation ( id uuid NOT NULL, quota_id uuid NOT NULL, storage_id uuid, vds_group_id uuid, virtual_cpu integer, mem_size_mb bigint, storage_size_gb bigint ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE repo_file_meta_data ( repo_domain_id uuid NOT NULL, repo_image_id character varying(256) NOT NULL, size bigint DEFAULT 0, date_created timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, last_refreshed bigint DEFAULT 0, file_type integer DEFAULT 0, repo_image_name character varying(256) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE roles ( id uuid NOT NULL, name character varying(126) NOT NULL, description character varying(4000), is_readonly boolean NOT NULL, role_type integer NOT NULL, allows_viewing_children boolean DEFAULT false NOT NULL, app_mode integer NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE roles_groups ( role_id uuid NOT NULL, action_group_id integer NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE SEQUENCE schema_version_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE schema_version ( id integer DEFAULT nextval('schema_version_seq'::regclass) NOT NULL, version character varying(10) NOT NULL, script character varying(255) NOT NULL, checksum character varying(128), installed_by character varying(63) NOT NULL, started_at timestamp without time zone DEFAULT now(), ended_at timestamp without time zone, state character varying(15) NOT NULL, current boolean NOT NULL, comment text DEFAULT ''::text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE snapshots ( snapshot_id uuid NOT NULL, vm_id uuid NOT NULL, snapshot_type character varying(32) NOT NULL, status character varying(32) NOT NULL, description character varying(4000), creation_date timestamp with time zone NOT NULL, app_list text, vm_configuration text, _create_date timestamp with time zone DEFAULT now(), _update_date timestamp with time zone, memory_volume character varying(255) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE step ( step_id uuid NOT NULL, parent_step_id uuid, job_id uuid NOT NULL, step_type character varying(32) NOT NULL, description text NOT NULL, step_number integer NOT NULL, status character varying(32) NOT NULL, start_time timestamp with time zone NOT NULL, end_time timestamp with time zone, correlation_id character varying(50) NOT NULL, external_id uuid, external_system_type character varying(32), is_external boolean DEFAULT false ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE storage_domain_dynamic ( id uuid NOT NULL, available_disk_size integer, used_disk_size integer, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE storage_domain_static ( id uuid NOT NULL, storage character varying(250) NOT NULL, storage_name character varying(250) NOT NULL, storage_domain_type integer NOT NULL, storage_type integer NOT NULL, storage_domain_format_type character varying(50) DEFAULT '0'::character varying NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, recoverable boolean DEFAULT true NOT NULL, last_time_used_as_master bigint, storage_description character varying(4000), storage_comment text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE storage_pool ( id uuid NOT NULL, name character varying(40) NOT NULL, description character varying(4000) NOT NULL, storage_pool_type integer NOT NULL, storage_pool_format_type character varying(50), status integer NOT NULL, master_domain_version integer NOT NULL, spm_vds_id uuid, compatibility_version character varying(40) DEFAULT '2.2'::character varying NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, quota_enforcement_type integer, free_text_comment text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE storage_pool_iso_map ( storage_id uuid NOT NULL, storage_pool_id uuid NOT NULL, status integer ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE storage_server_connections ( id character varying(50) NOT NULL, connection character varying(250) NOT NULL, user_name character varying(50), password character varying(50), iqn character varying(128), port character varying(50), portal character varying(50), storage_type integer NOT NULL, mount_options character varying(500), vfs_type character varying(128), nfs_version character varying(4), nfs_timeo smallint, nfs_retrans smallint ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE tags ( tag_id uuid NOT NULL, tag_name character varying(50) DEFAULT ''::character varying NOT NULL, description character varying(4000), parent_id uuid, readonly boolean, type integer DEFAULT 0 NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE tags_user_group_map ( tag_id uuid NOT NULL, group_id uuid NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE tags_user_map ( tag_id uuid NOT NULL, user_id uuid NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE tags_vds_map ( tag_id uuid NOT NULL, vds_id uuid NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE tags_vm_map ( tag_id uuid NOT NULL, vm_id uuid NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, defaultdisplaytype integer DEFAULT 0 ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE tags_vm_pool_map ( tag_id uuid NOT NULL, vm_pool_id uuid NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE users ( user_id uuid NOT NULL, name character varying(255), surname character varying(255), domain character varying(255) NOT NULL, username character varying(255) NOT NULL, groups character varying NOT NULL, department character varying(255), role character varying(255), email character varying(255), note character varying(255), status integer NOT NULL, last_admin_check_status boolean DEFAULT false NOT NULL, group_ids text, external_id bytea DEFAULT '\x'::bytea NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE SEQUENCE uuid_sequence START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE SEQUENCE vdc_db_log_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE vdc_db_log ( error_id bigint DEFAULT nextval('vdc_db_log_seq'::regclass) NOT NULL, occured_at timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone NOT NULL, error_code character varying(16) NOT NULL, error_message character varying(2048), error_proc character varying(126), error_line integer ); ************************** CREATE TABLE ********* QUERY ********** CREATE SEQUENCE vdc_options_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE vdc_options ( option_id integer DEFAULT nextval('vdc_options_seq'::regclass) NOT NULL, option_name character varying(100) NOT NULL, option_value character varying(4000) NOT NULL, version character varying(40) DEFAULT 'general'::character varying NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_dynamic ( vds_id uuid NOT NULL, status integer NOT NULL, cpu_cores integer, cpu_model character varying(255), cpu_speed_mh numeric(18,0), if_total_speed character varying(40), kvm_enabled boolean, physical_mem_mb integer, mem_commited integer DEFAULT 0, vm_active integer DEFAULT 0, vm_count integer DEFAULT 0 NOT NULL, vm_migrating integer DEFAULT 0, reserved_mem integer, guest_overhead integer, software_version character varying(40), version_name character varying(40), build_name character varying(40), previous_status integer, cpu_flags character varying(4000), cpu_over_commit_time_stamp timestamp with time zone, vms_cores_count integer, pending_vcpus_count integer, cpu_sockets integer, net_config_dirty boolean, supported_cluster_levels character varying(40), host_os character varying(4000), kvm_version character varying(4000), spice_version character varying(4000), kernel_version character varying(4000), iscsi_initiator_name character varying(4000), transparent_hugepages_state integer DEFAULT 0 NOT NULL, anonymous_hugepages integer DEFAULT 0 NOT NULL, hooks character varying(4000) DEFAULT ''::character varying, _update_date timestamp with time zone, non_operational_reason integer DEFAULT 0 NOT NULL, pending_vmem_size integer DEFAULT 0 NOT NULL, rpm_version character varying(256) DEFAULT NULL::character varying, supported_engines character varying(40), libvirt_version character varying(256) DEFAULT NULL::character varying, cpu_threads integer, hw_manufacturer character varying(255), hw_product_name character varying(255), hw_version character varying(255), hw_serial_number character varying(255), hw_uuid character varying(255), hw_family character varying(255), hbas text, supported_emulated_machines character varying(255) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_groups ( vds_group_id uuid NOT NULL, name character varying(40) NOT NULL, description character varying(4000), cpu_name character varying(255), _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, storage_pool_id uuid, max_vds_memory_over_commit integer DEFAULT 100 NOT NULL, compatibility_version character varying(40) DEFAULT '2.2'::character varying NOT NULL, transparent_hugepages boolean DEFAULT false NOT NULL, migrate_on_error integer DEFAULT 1 NOT NULL, virt_service boolean DEFAULT true NOT NULL, gluster_service boolean DEFAULT false NOT NULL, count_threads_as_cores boolean DEFAULT false NOT NULL, emulated_machine character varying(40), trusted_service boolean DEFAULT false NOT NULL, tunnel_migration boolean DEFAULT false NOT NULL, cluster_policy_id uuid, cluster_policy_custom_properties text, enable_balloon boolean DEFAULT false NOT NULL, free_text_comment text, detect_emulated_machine boolean DEFAULT false ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_interface ( id uuid NOT NULL, name character varying(50) NOT NULL, network_name character varying(50), vds_id uuid, mac_addr character varying(59), is_bond boolean DEFAULT false, bond_name character varying(50), bond_type integer, bond_opts character varying(4000), vlan_id integer, speed integer, addr character varying(20), subnet character varying(20), gateway character varying(20), boot_protocol integer, type integer DEFAULT 0, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, mtu integer, bridged boolean DEFAULT true NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_interface_statistics ( id uuid NOT NULL, vds_id uuid, rx_rate numeric(18,0), tx_rate numeric(18,0), rx_drop numeric(18,0), tx_drop numeric(18,0), iface_status integer, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_spm_id_map ( storage_pool_id uuid NOT NULL, vds_spm_id integer NOT NULL, vds_id uuid NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_static ( vds_id uuid NOT NULL, vds_name character varying(255) NOT NULL, ip character varying(255), vds_unique_id character varying(128), host_name character varying(255) NOT NULL, port integer NOT NULL, vds_group_id uuid NOT NULL, server_ssl_enabled boolean, vds_type integer DEFAULT 0 NOT NULL, vds_strength integer DEFAULT 100 NOT NULL, pm_type character varying(20), pm_user character varying(50), pm_password text, pm_port integer, pm_options character varying(4000) DEFAULT ''::character varying NOT NULL, pm_enabled boolean DEFAULT false NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, otp_validity bigint, vds_spm_priority smallint DEFAULT 5, recoverable boolean DEFAULT true NOT NULL, sshkeyfingerprint character varying(128), pm_proxy_preferences character varying(255) DEFAULT ''::character varying, pm_secondary_ip character varying(255), pm_secondary_type character varying(20), pm_secondary_user character varying(50), pm_secondary_password text, pm_secondary_port integer, pm_secondary_options character varying(4000), pm_secondary_concurrent boolean DEFAULT false, console_address character varying(255) DEFAULT NULL::character varying, ssh_username character varying(255), ssh_port integer, free_text_comment text, CONSTRAINT vds_static_vds_spm_priority_check CHECK (((vds_spm_priority >= (-1)) AND (vds_spm_priority <= 10))) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vds_statistics ( vds_id uuid NOT NULL, cpu_idle numeric(18,0) DEFAULT 0, cpu_load numeric(18,0) DEFAULT 0, cpu_sys numeric(18,0) DEFAULT 0, cpu_user numeric(18,0) DEFAULT 0, usage_mem_percent integer DEFAULT 0, usage_cpu_percent integer DEFAULT 0, usage_network_percent integer, mem_available bigint, mem_shared bigint, swap_free bigint, swap_total bigint, ksm_cpu_percent integer DEFAULT 0, ksm_pages bigint, ksm_state boolean, _update_date timestamp with time zone, mem_free bigint ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_device ( device_id uuid NOT NULL, vm_id uuid NOT NULL, type character varying(30) NOT NULL, device character varying(30) NOT NULL, address character varying(255) NOT NULL, boot_order integer DEFAULT 0, spec_params text, is_managed boolean DEFAULT false NOT NULL, is_plugged boolean, is_readonly boolean DEFAULT false NOT NULL, _create_date timestamp with time zone DEFAULT now(), _update_date timestamp with time zone, alias character varying(255) DEFAULT ''::character varying, custom_properties text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_dynamic ( vm_guid uuid NOT NULL, status integer NOT NULL, vm_ip text, vm_host character varying(255), vm_pid integer, last_start_time timestamp with time zone, guest_cur_user_name character varying(255), guest_last_login_time timestamp with time zone, guest_last_logout_time timestamp with time zone, guest_os character varying(255), run_on_vds uuid, migrating_to_vds uuid, app_list text, display integer, acpi_enable boolean, session integer, display_ip character varying(255), display_type integer, kvm_enable boolean, display_secure_port integer, utc_diff integer, last_vds_run_on uuid, client_ip character varying(255), guest_requested_memory integer, hibernation_vol_handle character varying(255), boot_sequence integer, exit_status integer DEFAULT 0 NOT NULL, pause_status integer DEFAULT 0 NOT NULL, exit_message character varying(4000), hash character varying(30), console_user_id uuid, guest_agent_nics_hash integer, console_cur_user_name character varying(255), last_watchdog_event bigint, last_watchdog_action character varying(8), is_run_once boolean DEFAULT false NOT NULL, vm_fqdn text DEFAULT ''::text, cpu_name character varying(255) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_guest_agent_interfaces ( vm_id uuid NOT NULL, interface_name text, mac_address character varying(59), ipv4_addresses text, ipv6_addresses text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_interface ( id uuid NOT NULL, vm_guid uuid, vmt_guid uuid, mac_addr character varying(20), name character varying(50) NOT NULL, speed integer, type integer DEFAULT 0, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, linked boolean DEFAULT true NOT NULL, vnic_profile_id uuid ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_interface_statistics ( id uuid NOT NULL, vm_id uuid, rx_rate numeric(18,0), tx_rate numeric(18,0), rx_drop numeric(18,0), tx_drop numeric(18,0), iface_status integer, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_ovf_generations ( vm_guid uuid NOT NULL, storage_pool_id uuid, ovf_generation bigint DEFAULT 0 ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_pool_map ( vm_pool_id uuid, vm_guid uuid NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_pools ( vm_pool_id uuid NOT NULL, vm_pool_name character varying(255) NOT NULL, vm_pool_description character varying(4000) NOT NULL, vm_pool_type integer, parameters character varying(200), vds_group_id uuid, prestarted_vms smallint DEFAULT 0, max_assigned_vms_per_user smallint DEFAULT 1, vm_pool_comment text ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_static ( vm_guid uuid NOT NULL, vm_name character varying(255) NOT NULL, mem_size_mb integer NOT NULL, vmt_guid uuid NOT NULL, os integer DEFAULT 0 NOT NULL, description character varying(4000), vds_group_id uuid NOT NULL, domain character varying(40), creation_date timestamp with time zone, num_of_monitors integer NOT NULL, is_initialized boolean, is_auto_suspend boolean DEFAULT false, num_of_sockets integer DEFAULT 1 NOT NULL, cpu_per_socket integer DEFAULT 1 NOT NULL, usb_policy integer, time_zone character varying(40), is_stateless boolean, fail_back boolean DEFAULT false NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, dedicated_vm_for_vds uuid, auto_startup boolean, vm_type integer DEFAULT 0 NOT NULL, nice_level integer DEFAULT 0 NOT NULL, default_boot_sequence integer DEFAULT 0 NOT NULL, default_display_type integer DEFAULT 0 NOT NULL, priority integer DEFAULT 0 NOT NULL, iso_path character varying(4000) DEFAULT ''::character varying, origin integer DEFAULT 0, initrd_url character varying(4000), kernel_url character varying(4000), kernel_params character varying(4000), migration_support integer DEFAULT 0 NOT NULL, userdefined_properties character varying(4000), predefined_properties character varying(4000), min_allocated_mem integer DEFAULT 0 NOT NULL, entity_type character varying(32) NOT NULL, child_count integer DEFAULT 0, template_status integer, quota_id uuid, allow_console_reconnect boolean DEFAULT false NOT NULL, cpu_pinning character varying(4000) DEFAULT NULL::character varying, is_smartcard_enabled boolean DEFAULT false, host_cpu_flags boolean DEFAULT false, db_generation bigint DEFAULT 1, is_delete_protected boolean DEFAULT false, is_disabled boolean DEFAULT false, is_run_and_pause boolean DEFAULT false NOT NULL, created_by_user_id uuid, tunnel_migration boolean, free_text_comment text, single_qxl_pci boolean DEFAULT false NOT NULL, cpu_shares integer DEFAULT 0 NOT NULL, vnc_keyboard_layout character varying(16) DEFAULT NULL::character varying ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE vm_statistics ( vm_guid uuid NOT NULL, cpu_user numeric(18,0) DEFAULT 0, cpu_sys numeric(18,0) DEFAULT 0, elapsed_time numeric(18,0) DEFAULT 0, usage_network_percent integer DEFAULT 0, usage_mem_percent integer DEFAULT 0, usage_cpu_percent integer DEFAULT 0, disks_usage text, _update_date timestamp with time zone ); ************************** CREATE TABLE ********* QUERY ********** SET default_with_oids = true; ************************** SET ********* QUERY ********** CREATE TABLE vnic_profiles ( id uuid NOT NULL, name character varying(50) NOT NULL, network_id uuid NOT NULL, port_mirroring boolean NOT NULL, custom_properties text, description text, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, network_qos_id uuid ); ************************** CREATE TABLE ********* QUERY ********** ALTER TABLE ONLY cluster_policies ADD CONSTRAINT cluster_policy_pk PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY disk_lun_map ADD CONSTRAINT disk_lun_map_pk PRIMARY KEY (disk_id, lun_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volumes ADD CONSTRAINT gluster_volumes_name_unique UNIQUE (cluster_id, vol_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_bricks ADD CONSTRAINT idx_gluster_volume_bricks_volume_server_brickdir UNIQUE (volume_id, server_id, brick_dir); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_options ADD CONSTRAINT idx_gluster_volume_options_volume_id_option_key UNIQUE (volume_id, option_key); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY materialized_views ADD CONSTRAINT materialized_views_pkey PRIMARY KEY (mv_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY action_version_map ADD CONSTRAINT pk_action_version_map PRIMARY KEY (action_type); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY ad_groups ADD CONSTRAINT pk_ad_group_id PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY async_tasks ADD CONSTRAINT pk_async_tasks PRIMARY KEY (task_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY audit_log ADD CONSTRAINT pk_audit_log PRIMARY KEY (audit_log_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY bookmarks ADD CONSTRAINT pk_bookmarks PRIMARY KEY (bookmark_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY custom_actions ADD CONSTRAINT pk_custom_actions PRIMARY KEY (action_name, tab); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY disk_image_dynamic ADD CONSTRAINT pk_disk_image_dynamic PRIMARY KEY (image_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY base_disks ADD CONSTRAINT pk_disks PRIMARY KEY (disk_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_map ADD CONSTRAINT pk_event_map PRIMARY KEY (event_up_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_notification_methods ADD CONSTRAINT pk_event_notification_methods PRIMARY KEY (method_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_subscriber ADD CONSTRAINT pk_event_subscriber PRIMARY KEY (subscriber_id, event_up_name, method_id, tag_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_cluster_services ADD CONSTRAINT pk_gluster_cluster_services PRIMARY KEY (cluster_id, service_type); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_hooks ADD CONSTRAINT pk_gluster_hooks PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server ADD CONSTRAINT pk_gluster_server PRIMARY KEY (server_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server_services ADD CONSTRAINT pk_gluster_server_services PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_service_types ADD CONSTRAINT pk_gluster_service_types PRIMARY KEY (service_type); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_services ADD CONSTRAINT pk_gluster_services PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_access_protocols ADD CONSTRAINT pk_gluster_volume_access_protocols PRIMARY KEY (volume_id, access_protocol); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_bricks ADD CONSTRAINT pk_gluster_volume_bricks PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_options ADD CONSTRAINT pk_gluster_volume_options PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_transport_types ADD CONSTRAINT pk_gluster_volume_transport_types PRIMARY KEY (volume_id, transport_type); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volumes ADD CONSTRAINT pk_gluster_volumes PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY business_entity_snapshot ADD CONSTRAINT pk_id PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY image_storage_domain_map ADD CONSTRAINT pk_image_storage_domain_map PRIMARY KEY (image_id, storage_domain_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY images ADD CONSTRAINT pk_images PRIMARY KEY (image_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY job ADD CONSTRAINT pk_jobs PRIMARY KEY (job_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY job_subject_entity ADD CONSTRAINT pk_jobs_subject_entity PRIMARY KEY (job_id, entity_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY lun_storage_server_connection_map ADD CONSTRAINT pk_lun_storage_server_connection_map PRIMARY KEY (lun_id, storage_server_connection); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY luns ADD CONSTRAINT pk_luns PRIMARY KEY (lun_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network ADD CONSTRAINT pk_network PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network_cluster ADD CONSTRAINT pk_network_cluster PRIMARY KEY (network_id, cluster_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network_qos ADD CONSTRAINT pk_network_qos_id PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY dwh_osinfo ADD CONSTRAINT pk_os_id PRIMARY KEY (os_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY permissions ADD CONSTRAINT pk_permissions_id PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota ADD CONSTRAINT pk_quota PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota_limitation ADD CONSTRAINT pk_quota_limitation PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY repo_file_meta_data ADD CONSTRAINT pk_repo_file_meta_data PRIMARY KEY (repo_domain_id, repo_image_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY roles_groups ADD CONSTRAINT pk_roles_groups PRIMARY KEY (role_id, action_group_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY roles ADD CONSTRAINT pk_roles_id PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY snapshots ADD CONSTRAINT pk_snapshots PRIMARY KEY (snapshot_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY step ADD CONSTRAINT pk_steps PRIMARY KEY (step_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_domain_static ADD CONSTRAINT pk_storage PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_domain_dynamic ADD CONSTRAINT pk_storage_domain_dynamic PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_pool_iso_map ADD CONSTRAINT pk_storage_domain_pool_map PRIMARY KEY (storage_id, storage_pool_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_pool ADD CONSTRAINT pk_storage_pool PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_server_connections ADD CONSTRAINT pk_storage_server PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags ADD CONSTRAINT pk_tags_id PRIMARY KEY (tag_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_user_group_map ADD CONSTRAINT pk_tags_user_group_map PRIMARY KEY (tag_id, group_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_user_map ADD CONSTRAINT pk_tags_user_map PRIMARY KEY (tag_id, user_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vds_map ADD CONSTRAINT pk_tags_vds_map PRIMARY KEY (tag_id, vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vm_map ADD CONSTRAINT pk_tags_vm_map PRIMARY KEY (tag_id, vm_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vm_pool_map ADD CONSTRAINT pk_tags_vm_pool_map PRIMARY KEY (tag_id, vm_pool_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY users ADD CONSTRAINT pk_users PRIMARY KEY (user_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vdc_db_log ADD CONSTRAINT pk_vdc_db_log PRIMARY KEY (error_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vdc_options ADD CONSTRAINT pk_vdc_options PRIMARY KEY (option_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_dynamic ADD CONSTRAINT pk_vds_dynamic PRIMARY KEY (vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_groups ADD CONSTRAINT pk_vds_groups PRIMARY KEY (vds_group_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_interface ADD CONSTRAINT pk_vds_interface PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_interface_statistics ADD CONSTRAINT pk_vds_interface_statistics PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_spm_id_map ADD CONSTRAINT pk_vds_spm_id_map PRIMARY KEY (storage_pool_id, vds_spm_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_static ADD CONSTRAINT pk_vds_static PRIMARY KEY (vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_statistics ADD CONSTRAINT pk_vds_statistics PRIMARY KEY (vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_device ADD CONSTRAINT pk_vm_device PRIMARY KEY (device_id, vm_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_dynamic ADD CONSTRAINT pk_vm_dynamic PRIMARY KEY (vm_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_interface ADD CONSTRAINT pk_vm_interface PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_interface_statistics ADD CONSTRAINT pk_vm_interface_statistics PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_pool_map ADD CONSTRAINT pk_vm_pool_map PRIMARY KEY (vm_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_pools ADD CONSTRAINT pk_vm_pools PRIMARY KEY (vm_pool_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_static ADD CONSTRAINT pk_vm_static PRIMARY KEY (vm_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_statistics ADD CONSTRAINT pk_vm_statistics PRIMARY KEY (vm_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vnic_profiles ADD CONSTRAINT pk_vnic_profiles_id PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY policy_units ADD CONSTRAINT policy_unit_pk PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY providers ADD CONSTRAINT providers_pk PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota ADD CONSTRAINT quota_quota_name_unique UNIQUE (quota_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY schema_version ADD CONSTRAINT schema_version_primary_key PRIMARY KEY (id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server_services ADD CONSTRAINT unique_gluster_server_services_server_service UNIQUE (server_id, service_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_services ADD CONSTRAINT unique_gluster_services_type_name UNIQUE (service_type, service_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY business_entity_snapshot ADD CONSTRAINT uq_command_id_entity_id UNIQUE (command_id, entity_id, entity_type, snapshot_type); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY users ADD CONSTRAINT users_domain_external_id_unique UNIQUE (domain, external_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_static ADD CONSTRAINT vds_static_host_name_unique UNIQUE (host_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_static ADD CONSTRAINT vds_static_vds_name_unique UNIQUE (vds_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_ovf_generations ADD CONSTRAINT vm_ovf_generations_pkey PRIMARY KEY (vm_guid); ************************** ALTER TABLE ********* QUERY ********** CREATE UNIQUE INDEX audit_log_origin_custom_event_id_idx ON audit_log USING btree (origin, custom_event_id) WHERE ((origin)::text !~~* 'ovirt'::text); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_correlation_id ON audit_log USING btree (correlation_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_job_id ON audit_log USING btree (job_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_log_time ON audit_log USING btree (log_time); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_storage_domain_name ON audit_log USING btree (storage_domain_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_storage_pool_name ON audit_log USING btree (storage_pool_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_user_name ON audit_log USING btree (user_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_vds_name ON audit_log USING btree (vds_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_vm_name ON audit_log USING btree (vm_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_audit_log_vm_template_name ON audit_log USING btree (vm_template_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_business_entity_snapshot_command_id ON business_entity_snapshot USING btree (command_id); ************************** CREATE INDEX ********* QUERY ********** CREATE UNIQUE INDEX idx_combined_ad_role_object ON permissions USING btree (ad_element_id, role_id, object_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_cluster_services_cluster_id ON gluster_cluster_services USING btree (cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_hooks_cluster_id ON gluster_hooks USING btree (cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE UNIQUE INDEX idx_gluster_hooks_unique ON gluster_hooks USING btree (cluster_id, gluster_command, stage, name); ************************** CREATE INDEX ********* QUERY ********** CREATE UNIQUE INDEX idx_gluster_server_hooks_unique ON gluster_server_hooks USING btree (hook_id, server_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_server_services_server_id ON gluster_server_services USING btree (server_id); ************************** CREATE INDEX ********* QUERY ********** CREATE UNIQUE INDEX idx_gluster_server_unique ON gluster_server USING btree (server_id, gluster_server_uuid); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_access_protocols_volume_id ON gluster_volume_access_protocols USING btree (volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_bricks_volume_id ON gluster_volume_bricks USING btree (volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_options_volume_id ON gluster_volume_options USING btree (volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_transport_types_volume_id ON gluster_volume_transport_types USING btree (volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volumes_cluster_id ON gluster_volumes USING btree (cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_job_start_time ON job USING btree (start_time); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_job_subject_entity_entity_id ON job_subject_entity USING btree (entity_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_qos_storage_pool_id ON network_qos USING btree (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_storage_pool_id ON network USING btree (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_permissions_ad_element_id ON permissions USING btree (ad_element_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_permissions_object_id ON permissions USING btree (object_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_permissions_role_id ON permissions USING btree (role_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_quota_limitation_quota_id ON quota_limitation USING btree (quota_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_quota_limitation_storage_id ON quota_limitation USING btree (storage_id) WHERE (storage_id IS NOT NULL); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_quota_limitation_vds_group_id ON quota_limitation USING btree (vds_group_id) WHERE (vds_group_id IS NOT NULL); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_repo_file_file_type ON repo_file_meta_data USING btree (file_type); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_roles__app_mode ON roles USING btree (app_mode); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_roles_groups_action_group_id ON roles_groups USING btree (action_group_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_step_external_id ON step USING btree (external_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_step_job_id ON step USING btree (job_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_step_parent_step_id ON step USING btree (parent_step_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_storage_pool_id ON quota USING btree (storage_pool_id) WHERE (storage_pool_id IS NOT NULL); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_interface_vds_id ON vds_interface USING btree (vds_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vdsm_task_id ON async_tasks USING btree (vdsm_task_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_dynamic_run_on_vds ON vm_dynamic USING btree (run_on_vds); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_guest_agent_interfaces_vm_id ON vm_guest_agent_interfaces USING btree (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_interface_vm_vmt_guid ON vm_interface USING btree (vm_guid, vmt_guid); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_interface_vnic_profile_id ON vm_interface USING btree (vnic_profile_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_ovf_generations_storage_pool_id ON vm_ovf_generations USING btree (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_ovf_generations_vm_guid ON vm_ovf_generations USING btree (vm_guid); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_vm_name ON vm_static USING btree (vm_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vnic_profiles_network_id ON vnic_profiles USING btree (network_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vnic_profiles_network_qos_id ON vnic_profiles USING btree (network_qos_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX ix_vdc_options ON vdc_options USING btree (option_name); ************************** CREATE INDEX ********* QUERY ********** ALTER TABLE ONLY disk_lun_map ADD CONSTRAINT disk_lun_to_disk_fk FOREIGN KEY (disk_id) REFERENCES base_disks(disk_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY disk_lun_map ADD CONSTRAINT disk_lun_to_lun_fk FOREIGN KEY (lun_id) REFERENCES luns(lun_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY async_tasks_entities ADD CONSTRAINT fk_async_task_entity FOREIGN KEY (async_task_id) REFERENCES async_tasks(task_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY cluster_policy_units ADD CONSTRAINT fk_cluster_policy_id FOREIGN KEY (cluster_policy_id) REFERENCES cluster_policies(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY disk_image_dynamic ADD CONSTRAINT fk_disk_image_dynamic_images FOREIGN KEY (image_id) REFERENCES images(image_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_notification_hist ADD CONSTRAINT fk_event_notification_hist_audit_log FOREIGN KEY (audit_log_id) REFERENCES audit_log(audit_log_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_notification_hist ADD CONSTRAINT fk_event_notification_users FOREIGN KEY (subscriber_id) REFERENCES users(user_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_subscriber ADD CONSTRAINT fk_event_subscriber_event_map FOREIGN KEY (event_up_name) REFERENCES event_map(event_up_name) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_subscriber ADD CONSTRAINT fk_event_subscriber_event_notification_methods FOREIGN KEY (method_id) REFERENCES event_notification_methods(method_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY event_subscriber ADD CONSTRAINT fk_event_subscriber_users FOREIGN KEY (subscriber_id) REFERENCES users(user_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY image_storage_domain_map ADD CONSTRAINT fk_image_storage_domain_map_images FOREIGN KEY (image_id) REFERENCES images(image_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY image_storage_domain_map ADD CONSTRAINT fk_image_storage_domain_map_storage_domain_static FOREIGN KEY (storage_domain_id) REFERENCES storage_domain_static(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY images ADD CONSTRAINT fk_images_quota FOREIGN KEY (quota_id) REFERENCES quota(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY job_subject_entity ADD CONSTRAINT fk_job_subject_entity_job FOREIGN KEY (job_id) REFERENCES job(job_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY lun_storage_server_connection_map ADD CONSTRAINT fk_lun_storage_server_connection_map_luns FOREIGN KEY (lun_id) REFERENCES luns(lun_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY lun_storage_server_connection_map ADD CONSTRAINT fk_lun_storage_server_connection_map_storage_server_connections FOREIGN KEY (storage_server_connection) REFERENCES storage_server_connections(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network_cluster ADD CONSTRAINT fk_network_cluster_network FOREIGN KEY (network_id) REFERENCES network(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network_cluster ADD CONSTRAINT fk_network_cluster_vds_groups FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network ADD CONSTRAINT fk_network_provided_by FOREIGN KEY (provider_network_provider_id) REFERENCES providers(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network ADD CONSTRAINT fk_network_storage_pool FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY permissions ADD CONSTRAINT fk_permissions_roles FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY cluster_policy_units ADD CONSTRAINT fk_policy_unit_id FOREIGN KEY (policy_unit_id) REFERENCES policy_units(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY repo_file_meta_data ADD CONSTRAINT fk_repo_file_meta_data_storage_domain_static FOREIGN KEY (repo_domain_id) REFERENCES storage_domain_static(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY roles_groups ADD CONSTRAINT fk_roles_groups_action_id FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY snapshots ADD CONSTRAINT fk_snapshot_vm FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY step ADD CONSTRAINT fk_step_job FOREIGN KEY (job_id) REFERENCES job(job_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_domain_dynamic ADD CONSTRAINT fk_storage_domain_dynamic_storage_domain_static FOREIGN KEY (id) REFERENCES storage_domain_static(id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_pool_iso_map ADD CONSTRAINT fk_storage_domain_pool_map_storage_domain_static FOREIGN KEY (storage_id) REFERENCES storage_domain_static(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY storage_pool_iso_map ADD CONSTRAINT fk_storage_domain_pool_map_storage_pool FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vm_pool_map ADD CONSTRAINT fk_tags_vm_pool_map_tag FOREIGN KEY (tag_id) REFERENCES tags(tag_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vm_pool_map ADD CONSTRAINT fk_tags_vm_pool_map_vm_pool FOREIGN KEY (vm_pool_id) REFERENCES vm_pools(vm_pool_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_groups ADD CONSTRAINT fk_vds_groups_storage_pool_id FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_pools ADD CONSTRAINT fk_vds_groups_vm_pools FOREIGN KEY (vds_group_id) REFERENCES vds_groups(vds_group_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_interface_statistics ADD CONSTRAINT fk_vds_interface_statistics_vds_static FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_interface ADD CONSTRAINT fk_vds_interface_vds_interface FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_spm_id_map ADD CONSTRAINT fk_vds_spm_id_map_storage_pool FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_spm_id_map ADD CONSTRAINT fk_vds_spm_id_map_vds_id FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_static ADD CONSTRAINT fk_vds_static_vm_static FOREIGN KEY (dedicated_vm_for_vds) REFERENCES vds_static(vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_device ADD CONSTRAINT fk_vm_device_vm_static FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_guest_agent_interfaces ADD CONSTRAINT fk_vm_guest_agent_interfaces FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_interface_statistics ADD CONSTRAINT fk_vm_interface_statistics_vm_static FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_interface ADD CONSTRAINT fk_vm_interface_vm_static FOREIGN KEY (vm_guid) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_interface ADD CONSTRAINT fk_vm_interface_vm_static_template FOREIGN KEY (vmt_guid) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_interface ADD CONSTRAINT fk_vm_interface_vnic_profile_id FOREIGN KEY (vnic_profile_id) REFERENCES vnic_profiles(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_static ADD CONSTRAINT fk_vm_static_quota FOREIGN KEY (quota_id) REFERENCES quota(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vnic_profiles ADD CONSTRAINT fk_vnic_profiles_network_qos_id FOREIGN KEY (network_qos_id) REFERENCES network_qos(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_cluster_services ADD CONSTRAINT gluster_cluster_services_cluster_id_fkey FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_cluster_services ADD CONSTRAINT gluster_cluster_services_service_type_fkey FOREIGN KEY (service_type) REFERENCES gluster_service_types(service_type) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_hooks ADD CONSTRAINT gluster_hooks_cluster_id_fkey FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server_hooks ADD CONSTRAINT gluster_server_hooks_hook_id_fkey FOREIGN KEY (hook_id) REFERENCES gluster_hooks(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server_hooks ADD CONSTRAINT gluster_server_hooks_server_id_fkey FOREIGN KEY (server_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server ADD CONSTRAINT gluster_server_server_id_fkey FOREIGN KEY (server_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server_services ADD CONSTRAINT gluster_server_services_server_id_fkey FOREIGN KEY (server_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_server_services ADD CONSTRAINT gluster_server_services_service_id_fkey FOREIGN KEY (service_id) REFERENCES gluster_services(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_services ADD CONSTRAINT gluster_services_service_type_fkey FOREIGN KEY (service_type) REFERENCES gluster_service_types(service_type) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_access_protocols ADD CONSTRAINT gluster_volume_access_protocols_volume_id_fkey FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_bricks ADD CONSTRAINT gluster_volume_bricks_server_id_fkey FOREIGN KEY (server_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_bricks ADD CONSTRAINT gluster_volume_bricks_volume_id_fkey FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_options ADD CONSTRAINT gluster_volume_options_volume_id_fkey FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volume_transport_types ADD CONSTRAINT gluster_volume_transport_types_volume_id_fkey FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_volumes ADD CONSTRAINT gluster_volumes_cluster_id_fkey FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY images ADD CONSTRAINT image_templates_images FOREIGN KEY (it_guid) REFERENCES images(image_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY network_qos ADD CONSTRAINT network_qos_storage_pool_fk FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota_limitation ADD CONSTRAINT quota_limitation_quota_id_fkey FOREIGN KEY (quota_id) REFERENCES quota(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota_limitation ADD CONSTRAINT quota_limitation_storage_id_fkey FOREIGN KEY (storage_id) REFERENCES storage_domain_static(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota_limitation ADD CONSTRAINT quota_limitation_vds_group_id_fkey FOREIGN KEY (vds_group_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY quota ADD CONSTRAINT quota_storage_pool_id_fkey FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_user_group_map ADD CONSTRAINT tags_user_group_map_tag FOREIGN KEY (tag_id) REFERENCES tags(tag_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_user_map ADD CONSTRAINT tags_user_map_tag FOREIGN KEY (tag_id) REFERENCES tags(tag_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_user_map ADD CONSTRAINT tags_user_map_user FOREIGN KEY (user_id) REFERENCES users(user_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_user_group_map ADD CONSTRAINT tags_user_map_user_group FOREIGN KEY (group_id) REFERENCES ad_groups(id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vds_map ADD CONSTRAINT tags_vds_map_tag FOREIGN KEY (tag_id) REFERENCES tags(tag_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vds_map ADD CONSTRAINT tags_vds_map_vds FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vm_map ADD CONSTRAINT tags_vm_map_tag FOREIGN KEY (tag_id) REFERENCES tags(tag_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY tags_vm_map ADD CONSTRAINT tags_vm_map_vm FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_groups ADD CONSTRAINT vds_groups_cluster_policy FOREIGN KEY (cluster_policy_id) REFERENCES cluster_policies(id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_static ADD CONSTRAINT vds_groups_vds_static FOREIGN KEY (vds_group_id) REFERENCES vds_groups(vds_group_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_static ADD CONSTRAINT vds_groups_vm_static FOREIGN KEY (vds_group_id) REFERENCES vds_groups(vds_group_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_dynamic ADD CONSTRAINT vds_static_vds_dynamic FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vds_statistics ADD CONSTRAINT vds_static_vds_statistics FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_dynamic ADD CONSTRAINT vds_static_vm_dynamic_m FOREIGN KEY (migrating_to_vds) REFERENCES vds_static(vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_dynamic ADD CONSTRAINT vds_static_vm_dynamic_r FOREIGN KEY (run_on_vds) REFERENCES vds_static(vds_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_pool_map ADD CONSTRAINT vm_guid_pools FOREIGN KEY (vm_guid) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_ovf_generations ADD CONSTRAINT vm_ovf_generations_storage_pool_id_fkey FOREIGN KEY (storage_pool_id) REFERENCES storage_pool(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_pool_map ADD CONSTRAINT vm_pools_vm FOREIGN KEY (vm_pool_id) REFERENCES vm_pools(vm_pool_id); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_dynamic ADD CONSTRAINT vm_static_vm_dynamic FOREIGN KEY (vm_guid) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_statistics ADD CONSTRAINT vm_static_vm_statistics FOREIGN KEY (vm_guid) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vm_static ADD CONSTRAINT vm_templates_vm_static FOREIGN KEY (vmt_guid) REFERENCES vm_static(vm_guid); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY vnic_profiles ADD CONSTRAINT vnic_profiles_network_id_fkey FOREIGN KEY (network_id) REFERENCES network(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** REVOKE ALL ON SCHEMA public FROM PUBLIC; ************************** REVOKE ********* QUERY ********** REVOKE ALL ON SCHEMA public FROM postgres; ************************** REVOKE ********* QUERY ********** GRANT ALL ON SCHEMA public TO postgres; ************************** GRANT ********* QUERY ********** GRANT ALL ON SCHEMA public TO PUBLIC; ************************** GRANT ********* QUERY ********** DROP TYPE IF EXISTS idTextType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE idtexttype AS ( id text ); ************************** CREATE TYPE ********* QUERY ********** DROP TYPE IF EXISTS idUuidType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE iduuidtype AS ( id uuid ); ************************** CREATE TYPE ********* QUERY ********** DROP TYPE IF EXISTS booleanResultType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE booleanresulttype AS ( result boolean ); ************************** CREATE TYPE ********* QUERY ********** DROP TYPE IF EXISTS authzEntryInfoType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE authzentryinfotype AS ( name text, namespace character varying(2048), authz character varying(255) ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION getGlobalIds(v_name VARCHAR(4000)) RETURNS UUID IMMUTABLE STRICT AS $function$ DECLARE v_id UUID; BEGIN if (v_name = 'system') then v_id := 'AAA00000-0000-0000-0000-123456789AAA'; elsif (v_name = 'everyone') then v_id := 'EEE00000-0000-0000-0000-123456789EEE'; -- bottom is an object which all the objects in the system are its parents -- useful to denote we want all objects when checking for permissions elsif (v_name = 'bottom') then v_id := 'BBB00000-0000-0000-0000-123456789BBB'; end if; return v_id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fnSplitter(ids TEXT) RETURNS SETOF idTextType IMMUTABLE AS $function$ BEGIN RETURN QUERY SELECT regexp_split_to_table(ids, ',') AS id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fnSplitterInteger(ids TEXT) RETURNS SETOF INTEGER IMMUTABLE AS $function$ BEGIN RETURN QUERY SELECT CAST(regexp_split_to_table(ids, ',') AS INTEGER); END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fnSplitterUuid(ids TEXT) RETURNS SETOF UUID IMMUTABLE AS $function$ BEGIN IF ids != '' THEN RETURN QUERY SELECT CAST(regexp_split_to_table(ids, ',') AS UUID); END IF; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fnSplitterWithSeperator(ids TEXT, separator VARCHAR(10)) RETURNS SETOF idTextType IMMUTABLE AS $function$ BEGIN RETURN QUERY SELECT regexp_split_to_table(ids, separator) AS id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS user_permissions CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE user_permissions AS ( permission_id uuid, role_id uuid, user_id uuid ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_user_permissions(v_userId IN uuid) RETURNS SETOF user_permissions STABLE AS $function$ DECLARE BEGIN RETURN QUERY SELECT permissions.id AS permission_id, permissions.role_id, permissions.ad_element_id AS user_id FROM permissions INNER JOIN users ON permissions.ad_element_id = users.user_id WHERE users.user_id = v_userId UNION SELECT permissions.id AS permission_id, permissions.role_id, temp.user_id AS user_id FROM permissions INNER JOIN ( -- get all groups of admin users SELECT ad_groups.id group_id, users.user_id FROM ad_groups, engine_sessions WHERE ad_groups.id IN (SELECT * FROM fnsplitteruuid(engine_sessions.group_ids)) AND users.user_id = v_userId ) temp ON permissions.ad_element_id = temp.group_id; END; $function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_entity_parents(v_entity_id IN uuid, v_object_type IN int4) RETURNS SETOF idUuidType STABLE AS $function$ /* Gets a list of all parent GUID to the system root (including) Object Types (compatible with VdcObjectType, XXX entries are unused currently) Unknown XXX, System XXX, Bottom = 0, VM = 2, VDS = 3, VmTemplate = 4, VmPool = 5, AdElements XXX, Tags XXX, Bookmarks XXX, VdsGroups = 9, MultiLevelAdministration XXX, Storage = 11, EventNotification XXX, ImportExport XXX, StoragePool = 14, User = 15, Role = 16, Quota = 17, GlusterVolume = 18, Disk = 19, Network = 20, VNICProfile = 27, MacPool = 28 DiskProfile = 29 CpuProfile = 30 */ DECLARE v_entity_type int4 := v_object_type; system_root_id uuid; cluster_id uuid; ds_id uuid; v_image_id uuid; v_storage_id uuid; v_vm_id uuid; v_storage_pool_id uuid; v_profile_network_id uuid; v_disk_profile_storage_id uuid; v_cpu_profile_cluster_id uuid; BEGIN system_root_id := ( SELECT getGlobalIds('system') ); -- hardcoded also in MLA Handler CASE WHEN v_entity_type = 0 THEN -- Bottom RETURN QUERY SELECT object_id FROM permissions; WHEN v_entity_type = 2 THEN -- VM -- get cluster id cluster_id := ( SELECT vds_group_id FROM vm_static WHERE vm_guid = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 3 THEN -- VDS -- get cluster id cluster_id := ( SELECT vds_group_id FROM vds_static WHERE vds_id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 4 THEN -- Template -- get image id first v_image_id := ( SELECT image_guid FROM images i JOIN vm_device vd ON i.image_group_id = vd.device_id WHERE vm_id = v_entity_id limit 1); -- get the storage id from images v_storage_id := ( SELECT storage_domain_id FROM image_storage_domain_map WHERE image_id = v_image_id limit 1); -- finally get data center id ds_id := ( SELECT storage_pool_id FROM storage_pool_iso_map WHERE storage_id = v_storage_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 5 THEN -- VM Pool -- get cluster id cluster_id := ( SELECT vds_group_id FROM vm_pools WHERE vm_pool_id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 9 THEN -- Cluster -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = v_entity_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 11 THEN -- Storage Domain RETURN QUERY SELECT system_root_id AS id UNION ALL SELECT storage_pool_id as id FROM storage_pool_iso_map WHERE storage_id = v_entity_id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 17 THEN -- Quota -- get data center id ds_id := ( SELECT storage_pool_id FROM quota WHERE id = v_entity_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 18 THEN -- GlusterVolume -- get cluster id cluster_id := ( SELECT v.cluster_id FROM gluster_volumes v WHERE id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 19 THEN -- Disk -- get data center, storage domain and vm SELECT INTO ds_id, v_storage_id, v_vm_id storage_pool_id, storage_id, vm_id FROM images_storage_domain_view LEFT OUTER JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id WHERE image_group_id = v_entity_id; -- get cluster cluster_id := ( SELECT vds_group_id FROM vm_static WHERE vm_guid = v_vm_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_storage_id AS id UNION SELECT v_vm_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 20 THEN -- Network SELECT INTO v_storage_pool_id network.storage_pool_id FROM network WHERE network.id = v_entity_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 27 THEN -- VNICProfile SELECT INTO v_profile_network_id vnic_profiles.network_id FROM vnic_profiles WHERE vnic_profiles.id = v_entity_id; SELECT INTO v_storage_pool_id network.storage_pool_id FROM network WHERE network.id = v_profile_network_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_profile_network_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 29 THEN -- DiskProfile SELECT INTO v_disk_profile_storage_id disk_profiles.storage_domain_id FROM disk_profiles WHERE disk_profiles.id = v_entity_id; SELECT INTO v_storage_pool_id storage_pool_iso_map.storage_pool_id FROM storage_pool_iso_map WHERE storage_pool_iso_map.storage_id = v_disk_profile_storage_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_disk_profile_storage_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 30 THEN -- CpuProfile SELECT INTO v_cpu_profile_cluster_id cpu_profiles.cluster_id FROM cpu_profiles WHERE cpu_profiles.id = v_entity_id; SELECT INTO v_storage_pool_id vds_groups.storage_pool_id FROM vds_groups WHERE vds_groups.vds_group_id = v_cpu_profile_cluster_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_cpu_profile_cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 23 THEN -- Gluster Hook -- get cluster id cluster_id := ( SELECT cluster_id FROM gluster_hooks WHERE id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 25 THEN -- Gluster Service -- get cluster id cluster_id := ( SELECT vds_group_id FROM vds_static WHERE vds_id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; ELSE IF v_entity_type IN ( 1,14,15,16,28 ) THEN -- Data Center, users, roles and mac pools are under system RETURN QUERY SELECT system_root_id AS id UNION SELECT v_entity_id AS id; END IF; END CASE; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_disk_commited_value_by_storage(v_storage_domain_id IN uuid) RETURNS integer STABLE AS $function$ DECLARE result integer; mult bigint; BEGIN mult := ( SELECT COALESCE(SUM( CASE WHEN (images_storage_domain_view.active = true AND (images_storage_domain_view.entity_type IS NULL OR -- Floating disk images_storage_domain_view.entity_type <> 'TEMPLATE')) -- or a VM THEN images_storage_domain_view.size ELSE images_storage_domain_view.actual_size END),0) FROM images_storage_domain_view WHERE images_storage_domain_view.storage_id = v_storage_domain_id ); -- convert to GB from bytes mult := CAST((mult * 0.000000000931322574615478515625) AS bigint); result := CAST(mult as integer); RETURN result; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_actual_images_size_by_storage(v_storage_domain_id IN uuid) RETURNS integer STABLE AS $function$ DECLARE result integer; mult bigint; BEGIN mult := ( SELECT COALESCE(SUM(images_storage_domain_view.actual_size),0) FROM images_storage_domain_view WHERE images_storage_domain_view.storage_id = v_storage_domain_id ); -- convert to GB from bytes mult := CAST((mult * 0.000000000931322574615478515625) AS bigint); result := CAST(mult as integer); RETURN result; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_get_storage_domain_shared_status_by_domain_id(v_storage_domain_id UUID, v_storage_status INTEGER, v_storage_domain_type INTEGER) RETURNS INTEGER AS $function$ DECLARE v_result INTEGER; v_rowsCount INTEGER; v_status INTEGER; BEGIN if (v_storage_domain_type != 2) then if (v_storage_status is null) then v_result := 0; else -- if 1 row and status active (3) then domain is active (1) if v_storage_status = 3 then v_result := 1; -- if 1 row and status not active then domain is inactive (2) else v_result := 2; end if; end if; else BEGIN CREATE TEMPORARY TABLE tt_TEMP22 ( status INTEGER, count INTEGER ) WITH OIDS; exception when others then truncate table tt_TEMP22; END; delete from tt_TEMP22; Insert INTO tt_TEMP22 select status, count(storage_id) from storage_pool_iso_map where storage_id = v_storage_domain_id group by status; select count(*) INTO v_rowsCount from tt_TEMP22; -- if return 0 rows then the domain is unattached if (v_rowsCount = 0) then v_result := 0; else if (v_rowsCount = 1) then -- if 1 row and status active (3) then domain is active (1) if v_storage_status = 3 then v_result := 1; -- if 1 row and status not active then domain is inactive (2) else v_result := 2; end if; -- else (if return more than 1 row) else select count(*) INTO v_rowsCount from tt_TEMP22 where status = 3; if (v_rowsCount > 0) then v_result := 3; -- non of the statuses is active else v_result := 2; end if; end if; end if; end if; return v_result; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_authz_entry_info(v_ad_element_id IN uuid) RETURNS AuthzEntryInfoType STABLE AS $function$ DECLARE result authzEntryInfoType; BEGIN if (v_ad_element_id = getGlobalIds('everyone')) then select 'Everyone','*','' into result; else select(COALESCE(name,'') || ' ' || COALESCE(surname,'') || ' (' || COALESCE(username,'') || '@' || COALESCE(domain,'') || ')'), namespace, domain INTO result from users where user_id = v_ad_element_id; if (result is null) then select name, namespace, domain INTO result from ad_groups where ID = v_ad_element_id; end if; end if; return result; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_ad_element_name(v_ad_element_id IN uuid) RETURNS text STABLE AS $function$ DECLARE result text; BEGIN if (v_ad_element_id = getGlobalIds('everyone')) then result := 'Everyone'; else select(COALESCE(name,'') || ' ' || COALESCE(surname,'') || ' (' || COALESCE(username,'') || '@' || COALESCE(domain,'') || ')') INTO result from users where user_id = v_ad_element_id; if (result is null) then select name INTO result from ad_groups where ID = v_ad_element_id; end if; end if; return result; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_entity_name(v_entity_id IN uuid, v_object_type IN int4) RETURNS text STABLE AS $function$ /* Gets object name by its id and type Object Types (compatible with VdcObjectType, XXX entries are unused currently) Unknown XXX, System XXX, VM = 2, VDS = 3, VmTemplate = 4, VmPool = 5, AdElements XXX, Tags XXX, Bookmarks XXX, VdsGroups = 9, MultiLevelAdministration XXX, Storage = 11, EventNotification XXX, ImportExport XXX, StoragePool = 14, User = 15, Role = 16, Quota = 17, GlusterVolume = 18, Disk = 19, Network = 20, VNICProfile = 27, MacPool = 28, DiskProfile = 29 CpuProfile = 30 */ DECLARE v_entity_type int4 := v_object_type; result text; BEGIN CASE WHEN v_entity_type = 1 THEN result := 'System'; WHEN v_entity_type = 2 OR v_entity_type = 4 THEN result := ( SELECT vm_name FROM vm_static WHERE vm_guid = v_entity_id ); WHEN v_entity_type = 3 THEN result := ( SELECT vds_name FROM vds_static WHERE vds_id = v_entity_id ); WHEN v_entity_type = 5 THEN result := ( SELECT vm_pool_name FROM vm_pools WHERE vm_pool_id = v_entity_id ); WHEN v_entity_type = 7 THEN result := ( SELECT tag_name FROM tags WHERE tag_id = v_entity_id ); WHEN v_entity_type = 8 THEN result := ( SELECT bookmark_name FROM bookmarks WHERE bookmark_id = v_entity_id ); WHEN v_entity_type = 9 THEN result := ( SELECT name FROM vds_groups WHERE vds_group_id = v_entity_id ); WHEN v_entity_type = 11 THEN result := ( SELECT storage_name FROM storage_domain_static WHERE id = v_entity_id ); WHEN v_entity_type = 14 THEN result := ( SELECT name FROM storage_pool WHERE id = v_entity_id ); WHEN v_entity_type = 15 THEN result := ( SELECT username FROM users WHERE user_id = v_entity_id ); WHEN v_entity_type = 16 THEN result := ( SELECT name FROM roles WHERE id = v_entity_id ); WHEN v_entity_type = 17 THEN result := ( SELECT quota_name FROM quota WHERE id = v_entity_id ); WHEN v_entity_type = 18 THEN result := ( SELECT vol_name FROM gluster_volumes WHERE id = v_entity_id ); WHEN v_entity_type = 19 THEN result := ( SELECT disk_alias FROM base_disks WHERE disk_id = v_entity_id ); WHEN v_entity_type = 20 THEN result := ( SELECT name FROM network WHERE id = v_entity_id ); WHEN v_entity_type = 23 THEN result := ( SELECT concat(gluster_command,'-',stage,'-',name) FROM gluster_hooks where id = v_entity_id ); WHEN v_entity_type = 25 THEN result := ( SELECT service_name FROM gluster_services where id = v_entity_id ); WHEN v_entity_type = 27 THEN result := ( SELECT name FROM vnic_profiles where id = v_entity_id ); WHEN v_entity_type = 28 THEN result := ( SELECT name FROM mac_pools where id = v_entity_id ); WHEN v_entity_type = 29 THEN result := ( SELECT name FROM disk_profiles where id = v_entity_id ); WHEN v_entity_type = 30 THEN result := ( SELECT name FROM cpu_profiles where id = v_entity_id ); ELSE result := 'Unknown type ' || v_entity_type; END CASE; -- -- This should be written to an error var or include object_id that is missing -- IF result IS NULL THEN -- result := v_entity_id || '' NOT FOUND''; -- END IF; RETURN result; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getUserAndGroupsById(v_id UUID) RETURNS SETOF idUuidType STABLE AS $function$ BEGIN RETURN QUERY select ad_groups.ID from ad_groups,engine_sessions where engine_sessions.user_id = v_id and ad_groups.id in(select * from fnsplitteruuid(engine_sessions.group_ids)) UNION select v_id UNION -- user is also member of 'Everyone' select 'EEE00000-0000-0000-0000-123456789EEE'; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getElementIdsByIdAndGroups(v_id UUID,v_group_ids text) RETURNS SETOF idUuidType STABLE AS $function$ BEGIN RETURN QUERY select * from fnsplitteruuid(v_group_ids) UNION select v_id UNION -- user is also member of 'Everyone' select 'EEE00000-0000-0000-0000-123456789EEE'; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS vds_group_usage_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE vds_group_usage_rs AS ( virtual_cpu_usage integer, mem_size_mb_usage bigint ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION getNonCountableQutoaVmStatuses() RETURNS SETOF INTEGER IMMUTABLE AS $BODY$ BEGIN RETURN query select 0 union select 13 union select 14 union select 15; --(Down(0), Suspended(13), ImageIllegal(14), ImageLocked(15)) END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CalculateVdsGroupUsage(v_quota_id UUID, v_vds_group_id UUID) RETURNS SETOF vds_group_usage_rs STABLE AS $function$ BEGIN RETURN QUERY SELECT cast(COALESCE(sum(num_of_sockets * cpu_per_socket), 0) as INTEGER) as virtual_cpu_usage, COALESCE(sum(mem_size_mb), 0) as mem_size_mb_usage FROM vm_static,vm_dynamic WHERE quota_id = v_quota_id AND vm_dynamic.vm_guid = vm_static.vm_guid AND vm_dynamic.status not in (SELECT getNonCountableQutoaVmStatuses()) AND (v_vds_group_id = vm_static.vds_group_id or v_vds_group_id IS NULL); END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS all_vds_group_usage_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE all_vds_group_usage_rs AS ( quota_vds_group_id uuid, quota_id uuid, vds_group_id uuid, vds_group_name character varying(40), virtual_cpu integer, virtual_cpu_usage integer, mem_size_mb bigint, mem_size_mb_usage bigint ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION calculateAllVdsGroupUsage() RETURNS SETOF all_vds_group_usage_rs STABLE AS $function$ BEGIN RETURN QUERY SELECT quota_limitation.id AS quota_vds_group_id, quota_limitation.quota_id as quota_id, quota_limitation.vds_group_id as vds_group_id, vds_groups.name AS vds_group_name, quota_limitation.virtual_cpu, cast(COALESCE(sum(num_of_sockets * cpu_per_socket * cast(vm_dynamic.status not in (SELECT getNonCountableQutoaVmStatuses()) as INTEGER)), 0) as INTEGER) as virtual_cpu_usage, quota_limitation.mem_size_mb, COALESCE(sum(vm_static.mem_size_mb), 0) as mem_size_mb_usage FROM quota_limitation LEFT JOIN vm_static ON vm_static.quota_id = quota_limitation.quota_id LEFT JOIN vm_dynamic ON vm_dynamic.vm_guid = vm_static.vm_guid LEFT JOIN vds_groups ON vds_groups.vds_group_id = vm_static.vds_group_id WHERE quota_limitation.virtual_cpu IS NOT NULL AND quota_limitation.mem_size_mb IS NOT NULL GROUP BY quota_limitation.quota_id, quota_limitation.vds_group_id, vds_group_name, quota_limitation.virtual_cpu, quota_limitation.mem_size_mb, vm_static.quota_id, vds_groups.vds_group_id, vm_static.vds_group_id, quota_limitation.id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS all_storage_usage_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE all_storage_usage_rs AS ( quota_storage_id uuid, quota_id uuid, storage_id uuid, storage_name character varying(250), storage_size_gb bigint, storage_size_gb_usage double precision ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION calculateAllStorageUsage() RETURNS SETOF all_storage_usage_rs STABLE AS $function$ BEGIN -- Summarize size of all disks that are active. RETURN QUERY SELECT quota_limitation.id AS quota_storage_id, quota_limitation.quota_id as quota_id, quota_limitation.storage_id as storage_id, storage_domain_static.storage_name, quota_limitation.storage_size_gb, cast(COALESCE(sum(size * cast(active as integer) + disk_image_dynamic.actual_size * cast((not active) as integer)) / 1073741824 ,0) as double precision) as storage_usage -- 1073741824 is 1024^3 (for GB) FROM quota_limitation LEFT JOIN image_storage_domain_map ON quota_limitation.quota_id = image_storage_domain_map.quota_id LEFT JOIN images ON images.image_guid = image_storage_domain_map.image_id LEFT JOIN disk_image_dynamic ON images.image_guid = disk_image_dynamic.image_id LEFT JOIN storage_domain_static ON image_storage_domain_map.storage_domain_id = storage_domain_static.id WHERE quota_limitation.storage_size_gb IS NOT NULL GROUP BY quota_limitation.quota_id, storage_id,quota_limitation.id,storage_domain_static.storage_name,quota_limitation.storage_size_gb; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CalculateStorageUsage(v_quota_id UUID, v_storage_id UUID) RETURNS double precision STABLE AS $function$ DECLARE v_virtual_size double precision; v_actual_size double precision; BEGIN -- Summarize size of all disks that are active. SELECT COALESCE(sum(size) / (1024 * 1024 * 1024),0) INTO v_virtual_size FROM disk_image_dynamic, images_storage_domain_view WHERE image_guid = disk_image_dynamic.image_id AND image_guid in (SELECT image_guid FROM images WHERE active = TRUE) AND quota_id = v_quota_id AND (v_storage_id = images_storage_domain_view.storage_id or v_storage_id IS NULL); -- Summarize the actual size of all the rest disks that are read only disks such as snapshots, not active, template disks. SELECT COALESCE(sum(disk_image_dynamic.actual_size) / (1024 * 1024 * 1024),0) INTO v_actual_size FROM disk_image_dynamic, images_storage_domain_view WHERE image_guid = disk_image_dynamic.image_id AND image_guid not in (SELECT image_guid FROM images i WHERE active = TRUE) AND quota_id = v_quota_id AND (v_storage_id = images_storage_domain_view.storage_id or v_storage_id IS NULL); RETURN v_actual_size + v_virtual_size; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function create_uuid_sequence() returns void as $procedure$ begin if not exists (select 1 from information_schema.sequences where sequence_schema = 'public' and sequence_name = 'uuid_sequence') then create sequence uuid_sequence increment by 1 start with 1; end if; end; $procedure$ language plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select create_uuid_sequence(); ************************** ********* QUERY ********** drop function create_uuid_sequence(); ************************** DROP FUNCTION ********* QUERY ********** create or replace function uuid_generate_v1() returns uuid STABLE as $procedure$ declare v_val bigint; v_4_part char(4); v_8_part char(8); v_12_part char(12); v_4_part_max int; begin -- The only part we should use modulo is the 4 digit part, all the -- rest are really big numbers (i.e 16^8 - 1 and 16^12 - 1) -- The use of round(random() * 1000 is for getting a different id -- for DC/Cluster in different installations v_4_part_max = 65535; -- this is 16^4 -1 v_val := nextval('uuid_sequence'); v_4_part := lpad(to_hex(v_val % v_4_part_max), 4, '0'); v_8_part := lpad(to_hex(v_val), 8, '0'); v_12_part := lpad(to_hex((v_val + (round(random() * 1000))::bigint)), 12, '0'); return v_8_part || v_4_part || v_4_part || v_4_part || v_12_part; end; $procedure$ language plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_get_comparable_ip_list(text) RETURNS inet[] IMMUTABLE STRICT AS $procedure$ BEGIN CASE WHEN ($1 IS NULL) OR ($1 ~ E'^\\s*$') THEN RETURN NULL; ELSE RETURN regexp_split_to_array(trim(both from $1), E'\\s+')::inet[]; END CASE; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_dedicated_hosts_ids_by_vm_id(v_vm_id UUID) RETURNS text STABLE AS $function$ BEGIN RETURN array_to_string(array_agg(vds_id), ',') FROM vm_host_pinning_map WHERE vm_id = v_vm_id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (not exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin insert into vdc_options (option_name, option_value, version) values (v_option_name, v_option_value, v_version); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value_all_versions(v_option_name varchar(100)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name)) then begin delete from vdc_options where option_name ilike v_option_name; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value(v_option_name varchar(100), v_version text) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)))) then begin delete from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_for_version(v_version text) returns void AS $procedure$ BEGIN delete from vdc_options where version in (select ID from fnSplitter(v_version)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin update vdc_options set option_value = v_option_value where option_name ilike v_option_name and version = v_version; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_default_config_value(v_option_name varchar(100),v_default_option_value varchar(4000),v_option_value varchar(4000),v_version varchar(40),v_ignore_default_value_case boolean) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin if (v_ignore_default_value_case) then update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value ilike v_default_option_value and version = v_version; else update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value = v_default_option_value and version = v_version; end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_rename_config_key(v_old_option_name varchar(100),v_new_option_name varchar(100),v_version varchar(40)) returns void AS $procedure$ DECLARE v_current_option_value varchar(4000); begin if (exists (select 1 from vdc_options where option_name ilike v_old_option_name and version = v_version)) then v_current_option_value:=option_value from vdc_options where option_name ilike v_old_option_name and version = v_version; update vdc_options set option_name = v_new_option_name, option_value = v_current_option_value where option_name ilike v_old_option_name and version = v_version; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'public' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'public' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'public' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'public' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and table_schema = 'public' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION attach_user_to_role ( v_user_name VARCHAR(255), v_domain VARCHAR(255), v_namespace VARCHAR(255), v_domain_entry_id text, v_role_name VARCHAR(255) ) RETURNS void AS $BODY$ DECLARE selected_user_id uuid; input_role_id uuid; BEGIN select roles.id into input_role_id from roles where roles.name = v_role_name; -- The external identifier is the user identifier converted to an array of -- bytes: insert into users(user_id,external_id, namespace,name,domain,username,last_admin_check_status) select uuid_generate_v1(), v_domain_entry_id, v_namespace, v_user_name, v_domain, v_user_name,true where not exists (select 1 from users where domain = v_domain and external_id = v_domain_entry_id); select user_id from users where domain = v_domain and external_id = v_domain_entry_id into selected_user_id; insert into permissions(id,role_id,ad_element_id,object_id,object_type_id) select uuid_generate_v1(), input_role_id, selected_user_id, getGlobalIds('system'), 1 where not exists(select role_id,ad_element_id,object_id,object_type_id from permissions where role_id = input_role_id and ad_element_id = selected_user_id and object_id= getGlobalIds('system') and object_type_id = 1); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(role_id,action_group_id) SELECT v_role_id, v_action_group_id WHERE NOT EXISTS (SELECT 1 FROM roles_groups WHERE role_id = v_role_id AND action_group_id = v_action_group_id); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) RETURNS void AS $BODY$ declare v_old_value varchar(4000); v_cur cursor for select distinct version from vdc_options where version <> 'general' order by version; v_version varchar(40); v_index integer; v_count integer; v_total_count integer; v_version_count integer; begin v_total_count := count(version) from vdc_options where option_name = v_option_name; v_old_value := option_value from vdc_options where option_name = v_option_name and version = 'general'; v_version_count := count(distinct version) from vdc_options where version <> 'general'; if (v_total_count <= v_version_count) then begin if (v_old_value IS NULL) then v_old_value := v_old_option_value; end if; v_count := count(distinct version) from vdc_options where version <> 'general'; v_index := 1; open v_cur; loop fetch v_cur into v_version; exit when not found; -- We shouldn't update if already exists if (not exists (select 1 from vdc_options where option_name = v_option_name and version = v_version)) then -- Might not work well for versions such as 3.10, but we currently don't have any if (v_version >= v_update_from_version) then insert into vdc_options (option_name, option_value, version) values (v_option_name, v_new_option_value, v_version); else insert into vdc_options (option_name, option_value, version) values (v_option_name, v_old_value, v_version); end if; end if; v_index := v_index +1; end loop; close v_cur; delete from vdc_options where option_name = v_option_name and version = 'general'; end; end if; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_grant_action_group_to_all_roles_filter(v_action_group_id integer, uuid[]) RETURNS void AS $BODY$ declare v_role_id_to_filter alias for $2; begin insert into roles_groups (role_id, action_group_id) select distinct role_id, v_action_group_id from roles_groups rg where not ARRAY [role_id] <@ v_role_id_to_filter and not exists (select 1 from roles_groups where role_id = rg.role_id and action_group_id = v_action_group_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_column_to_object_white_list(v_object_name varchar(128), v_column_name varchar(128)) returns void AS $procedure$ begin if (not exists (select 1 from object_column_white_list where object_name = v_object_name and column_name = v_column_name)) then begin -- verify that there is such object in db if exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = v_object_name and column_name = v_column_name) then insert into object_column_white_list (object_name, column_name) values (v_object_name, v_column_name); end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_disk(v_id UUID) returns void AS $procedure$ declare OK integer; LOCKED integer; begin OK:=1; LOCKED:=2; update images set imagestatus = OK where imagestatus = LOCKED and image_group_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_snapshot(v_id UUID) returns void AS $procedure$ declare OK varchar; LOCKED varchar; begin OK:='OK'; LOCKED:='LOCKED'; update snapshots set status = OK where status = LOCKED and snapshot_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_entity(v_object_type varchar(10), v_name varchar(255), v_recursive boolean) returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; v_id UUID; begin DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; --unlock images and snapshots if recursive flag is set if (v_recursive) then update images set imagestatus = OK where imagestatus = LOCKED and image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED and vm_id = v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_all() returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; BEGIN DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED; update vm_dynamic set status = DOWN where status = IMAGE_LOCKED; update images set imagestatus = OK where imagestatus = LOCKED; update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Displays DC id , DC name, SPM Host id , SPM Host name and number of async tasks awaiting. 1) create a record type with DC name, DC id, SPM host id, SPM host name, count 2) get all distinct DC ids from async_tasks table 3) Run a cursor for each result in 2) a) get DC name b) get SPM Host id & name if available c) get count of tasks return current record 4) return set of generated records */ DROP TYPE IF EXISTS async_tasks_info_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** create or replace FUNCTION fn_db_get_async_tasks() returns SETOF async_tasks_info_rs STABLE AS $procedure$ DECLARE v_record async_tasks_info_rs; -- selects storage_pool_id uuid found in async_tasks v_tasks_cursor cursor for select distinct storage_pool_id from async_tasks; begin OPEN v_tasks_cursor; FETCH v_tasks_cursor into v_record.dc_id; WHILE FOUND LOOP -- get dc_name and SPM Host id v_record.dc_name := name from storage_pool where id = v_record.dc_id; v_record.spm_host_id := spm_vds_id from storage_pool where id = v_record.dc_id; -- get Host name if we have non NULL SPM Host if (v_record.spm_host_id IS NOT NULL) then v_record.spm_host_name := vds_name from vds_static where vds_id = v_record.spm_host_id; else v_record.spm_host_name:=''; end if; -- get tasks count for this DC v_record.task_count := count(*) from async_tasks where position (cast(v_record.dc_id as varchar) in action_parameters) > 0; -- return the record RETURN NEXT v_record; FETCH v_tasks_cursor into v_record.dc_id; END LOOP; CLOSE v_tasks_cursor; -- return full set of generated records RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ DECLARE v varchar[]; e varchar; v_result varchar; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; FOR e in select unnest(v) LOOP IF (e != v_value) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_uuid_from_csv(v_csv_text text, v_uuid uuid) returns text STABLE AS $procedure$ DECLARE v uuid[]; e uuid; v_result text; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(v_csv_text, ','); FOR e in select unnest(v) LOOP IF (e != v_uuid) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; IF (v_result = '') THEN v_result := null; END IF; return v_result; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select uuid_generate_v1(); ************************** 00000001-0001-0001-0001-000000000113 ********* QUERY ********** select uuid_generate_v1(); ************************** 00000002-0002-0002-0002-0000000003df ********* QUERY ********** INSERT INTO schema_version(version,script,checksum,installed_by,ended_at,state,current) values ('03040000','upgrade/03_04_0000_set_version.sql','0','engine',now(),'INSTALLED',true); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO ad_groups (id, name, status, domain, distinguishedname) VALUES ('eee00000-0000-0000-0000-123456789eee', 'Everyone', 1, '', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO storage_pool (id, name, description, storage_pool_type, storage_pool_format_type, status, master_domain_version, spm_vds_id, compatibility_version, _create_date, _update_date, quota_enforcement_type, free_text_comment) VALUES ('00000001-0001-0001-0001-000000000113', 'Default', 'The default Data Center', 1, NULL, 0, 0, NULL, '3.6', '2015-01-21 15:14:26.872109+02', NULL, NULL, NULL); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('12262ab6-9690-4bc3-a2b3-35573b172d54', 'PinToHost', true, NULL, 0, true, 'Filters out all hosts that VM is not pinned to'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('6d636bf6-a35c-4f9d-b68d-0731f720cddc', 'CPU', true, NULL, 0, true, 'Filters out hosts with less CPUs than VM''s CPUs'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('c9ddbb34-0e1d-4061-a8d7-b0893fa80932', 'Memory', true, NULL, 0, true, 'Filters out hosts that have insufficient memory to run the VM'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('72163d1c-9468-4480-99d9-0888664eb143', 'Network', true, NULL, 0, true, 'Filters out hosts that are missing networks required by VM NICs, or missing cluster''s display network'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('38440000-8cf0-14bd-c43e-10b96e4ef00a', 'None', true, NULL, 2, true, 'No load balancing operation'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('38440000-8cf0-14bd-c43e-10b96e4ef00b', 'None', true, NULL, 1, true, 'Follows Even Distribution weight module'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('438b052c-90ab-40e8-9be0-a22560202ea6', 'CPU-Level', true, NULL, 0, true, 'Runs VMs only on hosts with a proper CPU level'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('736999d0-1023-46a4-9a75-1316ed50e151', 'OptimalForPowerSaving', true, '{ "CpuOverCommitDurationMinutes" : "^([1-9])$", "HighUtilization" : "^([5-9][0-9])$", "LowUtilization" : "^([1-4][0-9])$" }', 2, true, 'Load balancing VMs in cluster according to hosts CPU load, striving cluster''s hosts CPU load to be over ''LowUtilization'' and under ''HighUtilization'''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('736999d0-1023-46a4-9a75-1316ed50e15b', 'OptimalForPowerSaving', true, NULL, 1, true, 'Gives hosts with higher CPU usage, higher weight (means that hosts with lower CPU usage are more likely to be selected)'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('7db4ab05-81ab-42e8-868a-aee2df483ed2', 'OptimalForEvenDistribution', true, '{ "CpuOverCommitDurationMinutes" : "^([1-9])$", "HighUtilization" : "^([5-9][0-9])$" }', 2, true, 'Load balancing VMs in cluster according to hosts CPU load, striving cluster''s hosts CPU load to be under ''HighUtilization'''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('7db4ab05-81ab-42e8-868a-aee2df483edb', 'OptimalForEvenDistribution', true, NULL, 1, true, 'Gives hosts with lower CPU usage, higher weight (means that hosts with higher CPU usage are more likely to be selected)'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policies (id, name, description, is_locked, is_default, custom_properties) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 'Evenly_Distributed', '', true, false, '{ "CpuOverCommitDurationMinutes" : "2", "HighUtilization" : "80" }'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policies (id, name, description, is_locked, is_default, custom_properties) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 'Power_Saving', '', true, false, '{ "CpuOverCommitDurationMinutes" : "2", "HighUtilization" : "80", "LowUtilization" : "20" }'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policies (id, name, description, is_locked, is_default, custom_properties) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 'None', '', true, true, NULL); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 'c9ddbb34-0e1d-4061-a8d7-b0893fa80932', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '6d636bf6-a35c-4f9d-b68d-0731f720cddc', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '12262ab6-9690-4bc3-a2b3-35573b172d54', -1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '7db4ab05-81ab-42e8-868a-aee2df483ed2', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '72163d1c-9468-4480-99d9-0888664eb143', 1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 'c9ddbb34-0e1d-4061-a8d7-b0893fa80932', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '736999d0-1023-46a4-9a75-1316ed50e151', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '6d636bf6-a35c-4f9d-b68d-0731f720cddc', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '72163d1c-9468-4480-99d9-0888664eb143', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '38440000-8cf0-14bd-c43e-10b96e4ef00a', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 'c9ddbb34-0e1d-4061-a8d7-b0893fa80932', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '6d636bf6-a35c-4f9d-b68d-0731f720cddc', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '12262ab6-9690-4bc3-a2b3-35573b172d54', -1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '72163d1c-9468-4480-99d9-0888664eb143', 1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '38440000-8cf0-14bd-c43e-10b96e4ef00b', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '736999d0-1023-46a4-9a75-1316ed50e15b', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '7db4ab05-81ab-42e8-868a-aee2df483edb', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '438b052c-90ab-40e8-9be0-a22560202ea6', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '438b052c-90ab-40e8-9be0-a22560202ea6', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '438b052c-90ab-40e8-9be0-a22560202ea6', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '12262ab6-9690-4bc3-a2b3-35573b172d54', -1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO vds_groups (vds_group_id, name, description, cpu_name, _create_date, _update_date, storage_pool_id, max_vds_memory_over_commit, compatibility_version, transparent_hugepages, migrate_on_error, virt_service, gluster_service, count_threads_as_cores, emulated_machine, trusted_service, tunnel_migration, cluster_policy_id, cluster_policy_custom_properties, enable_balloon, free_text_comment, detect_emulated_machine) VALUES ('00000002-0002-0002-0002-0000000003df', 'Default', 'The default server cluster', NULL, '2015-01-21 15:14:26.872109+02', NULL, '00000001-0001-0001-0001-000000000113', 100, '3.6', true, 1, true, false, false, NULL, false, false, 'b4ed2332-a7ac-4d5f-9596-99a439cb2812', NULL, false, NULL, true); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('00000000-0000-0000-0000-000000000001', 'SuperUser', 'Roles management administrator', true, 1, true, 255); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('00000000-0000-0000-0001-000000000001', 'UserRole', 'Standard User Role', true, 2, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('00000000-0000-0000-0001-000000000002', 'PowerUserRole', 'User Role, allowed to create VMs, Templates and Disks', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00001-0000-0000-0000-def000000001', 'ClusterAdmin', 'Administrator Role, permission for all the objects underneath a specific Cluster', true, 1, true, 255); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00002-0000-0000-0000-def000000002', 'DataCenterAdmin', 'Administrator Role, permission for all the objects underneath a specific Data Center, except Storage', true, 1, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00003-0000-0000-0000-def000000003', 'StorageAdmin', 'Administrator Role, permission for all operations on a specific Storage Domain', true, 1, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00004-0000-0000-0000-def000000004', 'HostAdmin', 'Administrator Role, permission for all operations on a specific Host', true, 1, true, 255); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00005-0000-0000-0000-def000000005', 'NetworkAdmin', 'Administrator Role, permission for all operations on a specific Logical Network', true, 1, true, 255); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00006-0000-0000-0000-def000000006', 'UserVmManager', 'User Role, with permission for any operation on Vms', true, 2, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00007-0000-0000-0000-def000000007', 'VmPoolAdmin', 'Administrator Role, permission for all operations on a specific VM Pool', true, 1, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00008-0000-0000-0000-def000000008', 'TemplateAdmin', 'Administrator Role, permission for all operations on a specific Template', true, 1, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def00000000a', 'QuotaConsumer', 'User Role, permissions to consume the Quota resources', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def00000000b', 'DiskOperator', 'User Role, permissions for all operations on a specific disk', true, 2, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def00000000c', 'DiskCreator', 'User Role, permission to create Disks', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000b-0000-0000-0000-def00000000b', 'GlusterAdmin', 'Administrator Role, permissions for operations on Gluster objects', true, 1, true, 2); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def00000000d', 'VmCreator', 'User Role, permission to create VMs', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def00000000e', 'TemplateCreator', 'User Role, permission to create Templates', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def00000000f', 'TemplateOwner', 'User Role, permissions for all operations on Templates', true, 2, true, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000c-0000-0000-0000-def000000000', 'ExternalEventsCreator', 'External Events Creator', true, 2, false, 255); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000d-0000-0000-0000-def000000000', 'ExternalTasksCreator', 'External Tasks Creator', true, 2, false, 255); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def0000a-0000-0000-0000-def000000010', 'VnicProfileUser', 'VM Network Interface Profile User', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES ('def00009-0000-0000-0000-def000000009', 'UserTemplateBasedVm', 'Template User', true, 2, false, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO permissions (id, role_id, ad_element_id, object_id, object_type_id) VALUES ('00000004-0004-0004-0004-000000000355', 'def00009-0000-0000-0000-def000000009', 'eee00000-0000-0000-0000-123456789eee', '00000000-0000-0000-0000-000000000000', 4); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO permissions (id, role_id, ad_element_id, object_id, object_type_id) VALUES ('0000000b-000b-000b-000b-0000000001d5', 'def0000a-0000-0000-0000-def000000010', 'eee00000-0000-0000-0000-123456789eee', '0000000a-000a-000a-000a-000000000398', 27); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 2); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 3); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 4); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 5); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 6); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 7); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 8); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 9); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 10); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 11); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 12); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 200); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 201); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 202); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 301); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 302); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 303); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 400); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 401); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 402); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 403); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 500); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 501); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 600); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 601); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 602); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 603); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 700); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 701); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 702); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 703); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 704); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 705); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 800); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000001', 4); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000001', 5); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000001', 7); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000001', 303); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000002', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000002', 200); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 2); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 3); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 4); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 5); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 6); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 7); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 8); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 9); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 10); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 11); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 12); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 301); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 302); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 303); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 400); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 401); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 402); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 403); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 2); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 3); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 4); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 5); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 6); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 7); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 8); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 9); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 10); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 11); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 12); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 200); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 201); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 202); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 301); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 302); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 303); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 400); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 401); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 402); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 403); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 700); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 701); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 702); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 703); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 704); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 705); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 600); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 601); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 602); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 603); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 600); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 601); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 602); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 603); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 403); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 2); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 3); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 4); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 5); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 7); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 9); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 10); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 12); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00007-0000-0000-0000-def000000007', 300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00007-0000-0000-0000-def000000007', 301); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00007-0000-0000-0000-def000000007', 302); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00007-0000-0000-0000-def000000007', 303); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 200); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 201); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 202); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00009-0000-0000-0000-def000000009', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 900); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 900); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 901); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 901); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 13); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000002', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1103); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 1101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 1102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 1104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000b', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000b', 1101); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000b', 1102); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000b', 1104); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000c', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1000); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1001); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1002); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000b-0000-0000-0000-def00000000b', 1000); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000b-0000-0000-0000-def00000000b', 1001); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000b-0000-0000-0000-def00000000b', 1002); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000d', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000e', 200); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000f', 201); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000f', 202); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000f', 203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000f', 204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000f', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 14); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 14); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 14); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000d', 1100); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000f', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000b', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00007-0000-0000-0000-def000000007', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000002', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000c', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000e', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00006-0000-0000-0000-def000000006', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000d', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000b', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000001', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00004-0000-0000-0000-def000000004', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00007-0000-0000-0000-def000000007', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000b-0000-0000-0000-def00000000b', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 404); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 404); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 404); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 703); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 704); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 705); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 9); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1500); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000c-0000-0000-0000-def000000000', 1500); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def00000000a', 901); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1003); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000b-0000-0000-0000-def00000000b', 1003); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 15); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00001-0000-0000-0000-def000000001', 15); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 15); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 205); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 205); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 205); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1004); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000b-0000-0000-0000-def00000000b', 1004); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1105); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1105); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000d-0000-0000-0000-def000000000', 1500); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 1203); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 1204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00005-0000-0000-0000-def000000005', 1205); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00002-0000-0000-0000-def000000002', 1205); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1205); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def000000010', 9); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def000000010', 204); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def0000a-0000-0000-0000-def000000010', 1300); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000001', 1106); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00008-0000-0000-0000-def000000008', 1106); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0000-000000000001', 1106); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('def00003-0000-0000-0000-def000000003', 1106); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) VALUES ('00000000-0000-0000-0001-000000000002', 1106); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO images (image_guid, creation_date, size, it_guid, parentid, imagestatus, lastmodified, vm_snapshot_id, volume_type, volume_format, image_group_id, _create_date, _update_date, quota_id, active) VALUES ('00000000-0000-0000-0000-000000000000', '2008-04-01 00:00:00+03', 85899345920, '00000000-0000-0000-0000-000000000000', NULL, 0, NULL, NULL, 2, 4, NULL, '2013-12-25 15:31:57.219114+02', NULL, NULL, true); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO network (id, name, description, type, addr, subnet, gateway, vlan_id, stp, storage_pool_id, mtu, vm_network, provider_network_provider_id, provider_network_external_id, free_text_comment) VALUES ('00000000-0000-0000-0000-000000000009', 'ovirtmgmt', 'Management Network', NULL, NULL, NULL, NULL, NULL, false, '00000001-0001-0001-0001-000000000113', NULL, true, NULL, NULL, NULL); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO network_cluster (network_id, cluster_id, status, is_display, required, migration) VALUES ('00000000-0000-0000-0000-000000000009', '00000002-0002-0002-0002-0000000003df', 1, false, true, false); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO vm_static (vm_guid, vm_name, mem_size_mb, vmt_guid, os, description, vds_group_id, domain, creation_date, num_of_monitors, is_initialized, is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, time_zone, is_stateless, fail_back, _create_date, _update_date, dedicated_vm_for_vds, auto_startup, vm_type, nice_level, default_boot_sequence, default_display_type, priority, iso_path, origin, initrd_url, kernel_url, kernel_params, migration_support, userdefined_properties, predefined_properties, min_allocated_mem, entity_type, child_count, template_status, quota_id, allow_console_reconnect, cpu_pinning, is_smartcard_enabled, host_cpu_flags, db_generation, is_delete_protected, is_disabled, is_run_and_pause, created_by_user_id, tunnel_migration, free_text_comment, single_qxl_pci, cpu_shares, vnc_keyboard_layout) VALUES ('00000000-0000-0000-0000-000000000000', 'Blank', 1024, '00000000-0000-0000-0000-000000000000', 0, 'Blank template', '00000002-0002-0002-0002-0000000003df', '', '2008-04-01 00:00:00+03', 1, NULL, false, 1, 1, 1, NULL, NULL, false, '2013-12-25 15:31:54.367179+02', '2013-12-25 15:31:53.239308+02', NULL, NULL, 0, 0, 0, 1, 0, '', 0, NULL, NULL, NULL, 0, NULL, NULL, 0, 'TEMPLATE', 0, 0, NULL, false, NULL, false, false, 1, false, false, false, NULL, NULL, NULL, false, 0, NULL); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO vm_device (device_id, vm_id, type, device, address, boot_order, spec_params, is_managed, is_plugged, is_readonly, _create_date, _update_date, alias, custom_properties) VALUES ('00000006-0006-0006-0006-000000000006', '00000000-0000-0000-0000-000000000000', 'video', 'cirrus', '', NULL, '{ "vram" : "65536" }', true, NULL, false, '2013-12-25 22:54:23.416857+02', NULL, '', NULL); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO vm_ovf_generations (vm_guid, storage_pool_id, ovf_generation) VALUES ('00000000-0000-0000-0000-000000000000', '00000001-0001-0001-0001-000000000113', 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (41, '3.1', '3.1'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (158, '3.1', '3.0'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (52, '3.1', '3.1'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1009, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1400, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1401, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1402, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1403, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1404, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1405, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1406, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1407, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1408, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1409, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1410, '3.2', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1411, '3.2', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1010, '3.2', '3.2'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1011, '3.2', '3.2'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1001, '3.3', '3.3'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1412, '3.1', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (232, '3.3', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1013, '3.3', '3.3'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1014, '3.3', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map (action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES (1015, '3.3', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDC_STOP', 'VDC_START'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IRS_FAILURE', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IRS_DISK_SPACE_LOW', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IRS_DISK_SPACE_LOW_ERROR', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_FAILURE', 'VDS_ACTIVATE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_VDS_MAINTENANCE', 'VDS_ACTIVATE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_VDS_MAINTENANCE_MIGRATION_FAILED', 'USER_VDS_MAINTENANCE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_ACTIVATE_FAILED', 'VDS_ACTIVATE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_RECOVER_FAILED', 'VDS_RECOVER'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_SLOW_STORAGE_RESPONSE_TIME', 'VDS_ACTIVATE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_APPROVE_FAILED', 'VDS_APPROVE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_INSTALL_FAILED', 'VDS_INSTALL'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VM_FAILURE', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VM_MIGRATION_START', 'VM_MIGRATION_DONE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VM_MIGRATION_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VM_MIGRATION_FAILED_FROM_TO', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VM_NOT_RESPONDING', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('DWH_STOPPED', 'DWH_STARTED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('DWH_ERROR', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_TIME_DRIFT_ALERT', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_CREATE', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_CREATE_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_START', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_START_FAILED', 'GLUSTER_VOLUME_START'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_STOP', 'GLUSTER_VOLUME_START'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_STOP_FAILED', 'GLUSTER_VOLUME_STOP'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_SET', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_SET_FAILED', 'GLUSTER_VOLUME_OPTION_SET'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTIONS_RESET', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTIONS_RESET_FAILED', 'GLUSTER_VOLUME_OPTIONS_RESET'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_DELETE', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_DELETE_FAILED', 'GLUSTER_VOLUME_DELETE'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REBALANCE_START', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REBALANCE_START_FAILED', 'GLUSTER_VOLUME_REBALANCE_START'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REMOVE_BRICKS', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REMOVE_BRICKS_FAILED', 'GLUSTER_VOLUME_REMOVE_BRICKS'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REPLACE_BRICK_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REPLACE_BRICK_START', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REPLACE_BRICK_START_FAILED', 'GLUSTER_VOLUME_REPLACE_BRICK_START'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_ADD_BRICK', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_ADD_BRICK_FAILED', 'GLUSTER_VOLUME_ADD_BRICK'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVER_REMOVE_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVER_ADD_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_CREATED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_DELETED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_SET_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_RESET_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_PROPERTIES_CHANGED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_BRICK_ADDED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_BRICK_REMOVED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVER_REMOVED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('HA_VM_RESTART_FAILED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('HA_VM_FAILED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('SYSTEM_DEACTIVATED_STORAGE_DOMAIN', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_SET_NONOPERATIONAL', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_SET_NONOPERATIONAL_IFACE_DOWN', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_SET_NONOPERATIONAL_DOMAIN', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('SYSTEM_CHANGE_STORAGE_POOL_STATUS_NO_HOST_FOR_SPM', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_STARTED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_STOPPED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_HIGH_MEM_USE', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_HIGH_NETWORK_USE', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_HIGH_CPU_USE', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_HIGH_SWAP_USE', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_LOW_SWAP', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_CHANGED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_ENABLE', 'GLUSTER_HOOK_ENABLE_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_ENABLE_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_DISABLE', 'GLUSTER_HOOK_DISABLE_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_DISABLE_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_DETECTED_NEW', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_CONFLICT_DETECTED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_DETECTED_DELETE', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_ADDED', 'GLUSTER_HOOK_ADD_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_ADD_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_REMOVED', 'GLUSTER_HOOK_REMOVE_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_HOOK_REMOVE_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVICE_STARTED', 'GLUSTER_SERVICE_START_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVICE_START_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVICE_STOPPED', 'GLUSTER_SERVICE_STOP_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVICE_STOP_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVICE_RESTARTED', 'GLUSTER_SERVICE_RESTART_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVICE_RESTART_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VDS_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_UPDATE_VM_FROM_TRUSTED_TO_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_UPDATE_VM_FROM_UNTRUSTED_TO_TRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IMPORTEXPORT_IMPORT_VM_FROM_TRUSTED_TO_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IMPORTEXPORT_IMPORT_VM_FROM_UNTRUSTED_TO_TRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_ADD_VM_FROM_TRUSTED_TO_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_ADD_VM_FROM_UNTRUSTED_TO_TRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IMPORTEXPORT_IMPORT_TEMPLATE_FROM_TRUSTED_TO_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('IMPORTEXPORT_IMPORT_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_ADD_VM_TEMPLATE_FROM_TRUSTED_TO_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_ADD_VM_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_UPDATE_VM_TEMPLATE_FROM_TRUSTED_TO_UNTRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('USER_UPDATE_VM_TEMPLATE_FROM_UNTRUSTED_TO_TRUSTED', ''); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('VM_STATUS_RESTORED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_SERVER_REMOVE', 'GLUSTER_SERVER_REMOVE_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_ADDED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTION_MODIFIED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_OPTIONS_RESET_ALL', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_PROFILE_START', 'GLUSTER_VOLUME_PROFILE_START_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_PROFILE_START_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_PROFILE_STOP', 'GLUSTER_VOLUME_PROFILE_STOP_FAILED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_PROFILE_STOP_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REBALANCE_STOP', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('GLUSTER_VOLUME_REBALANCE_STOP_FAILED', 'GLUSTER_VOLUME_REBALANCE_STOP'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('START_REMOVING_GLUSTER_VOLUME_BRICKS', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO event_map (event_up_name, event_down_name) VALUES ('START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED', 'START_REMOVING_GLUSTER_VOLUME_BRICKS'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO dwh_history_timekeeping (var_name, var_value, var_datetime) VALUES ('lastSync', NULL, '2000-01-01 00:00:00+02'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO dwh_history_timekeeping (var_name, var_value, var_datetime) VALUES ('lastFullHostCheck', NULL, '2000-01-01 00:00:00+02'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO dwh_history_timekeeping (var_name, var_value, var_datetime) VALUES ('lastOsinfoUpdate', NULL, '2000-01-01 00:00:00+02'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO dwh_history_timekeeping (var_name, var_value, var_datetime) VALUES ('heartBeat', NULL, '2000-01-01 00:00:00+02'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO gluster_service_types (service_type) VALUES ('GLUSTER'); ************************** INSERT 17747 1 ********* QUERY ********** INSERT INTO gluster_service_types (service_type) VALUES ('GLUSTER_SWIFT'); ************************** INSERT 17748 1 ********* QUERY ********** INSERT INTO gluster_service_types (service_type) VALUES ('SMB'); ************************** INSERT 17749 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000003-0003-0003-0003-00000000004f', 'GLUSTER', 'glusterd'); ************************** INSERT 17750 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000004-0004-0004-0004-00000000013e', 'GLUSTER_SWIFT', 'gluster-swift-proxy'); ************************** INSERT 17751 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000005-0005-0005-0005-000000000180', 'GLUSTER_SWIFT', 'gluster-swift-container'); ************************** INSERT 17752 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000006-0006-0006-0006-00000000017d', 'GLUSTER_SWIFT', 'gluster-swift-object'); ************************** INSERT 17753 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000007-0007-0007-0007-000000000332', 'GLUSTER_SWIFT', 'gluster-swift-account'); ************************** INSERT 17754 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000008-0008-0008-0008-0000000001b6', 'GLUSTER_SWIFT', 'memcached'); ************************** INSERT 17755 1 ********* QUERY ********** INSERT INTO gluster_services (id, service_type, service_name) VALUES ('00000009-0009-0009-0009-0000000002a2', 'SMB', 'smb'); ************************** INSERT 17756 1 ********* QUERY ********** INSERT INTO vnic_profiles (id, name, network_id, port_mirroring, custom_properties, description, _create_date, _update_date, network_qos_id) VALUES ('0000000a-000a-000a-000a-000000000398', 'ovirtmgmt', '00000000-0000-0000-0000-000000000009', false, NULL, NULL, '2015-02-02 13:47:16.002849+02', NULL, NULL); ************************** INSERT 17757 1 ********* QUERY ********** select 3040000; ************************** 3040000 ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (not exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin insert into vdc_options (option_name, option_value, version) values (v_option_name, v_option_value, v_version); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value_all_versions(v_option_name varchar(100)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name)) then begin delete from vdc_options where option_name ilike v_option_name; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value(v_option_name varchar(100), v_version text) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)))) then begin delete from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_for_version(v_version text) returns void AS $procedure$ BEGIN delete from vdc_options where version in (select ID from fnSplitter(v_version)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin update vdc_options set option_value = v_option_value where option_name ilike v_option_name and version = v_version; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_default_config_value(v_option_name varchar(100),v_default_option_value varchar(4000),v_option_value varchar(4000),v_version varchar(40),v_ignore_default_value_case boolean) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin if (v_ignore_default_value_case) then update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value ilike v_default_option_value and version = v_version; else update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value = v_default_option_value and version = v_version; end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_rename_config_key(v_old_option_name varchar(100),v_new_option_name varchar(100),v_version varchar(40)) returns void AS $procedure$ DECLARE v_current_option_value varchar(4000); begin if (exists (select 1 from vdc_options where option_name ilike v_old_option_name and version = v_version)) then v_current_option_value:=option_value from vdc_options where option_name ilike v_old_option_name and version = v_version; update vdc_options set option_name = v_new_option_name, option_value = v_current_option_value where option_name ilike v_old_option_name and version = v_version; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'public' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'public' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'public' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'public' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and table_schema = 'public' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION attach_user_to_role ( v_user_name VARCHAR(255), v_domain VARCHAR(255), v_namespace VARCHAR(255), v_domain_entry_id text, v_role_name VARCHAR(255) ) RETURNS void AS $BODY$ DECLARE selected_user_id uuid; input_role_id uuid; BEGIN select roles.id into input_role_id from roles where roles.name = v_role_name; -- The external identifier is the user identifier converted to an array of -- bytes: insert into users(user_id,external_id, namespace,name,domain,username,last_admin_check_status) select uuid_generate_v1(), v_domain_entry_id, v_namespace, v_user_name, v_domain, v_user_name,true where not exists (select 1 from users where domain = v_domain and external_id = v_domain_entry_id); select user_id from users where domain = v_domain and external_id = v_domain_entry_id into selected_user_id; insert into permissions(id,role_id,ad_element_id,object_id,object_type_id) select uuid_generate_v1(), input_role_id, selected_user_id, getGlobalIds('system'), 1 where not exists(select role_id,ad_element_id,object_id,object_type_id from permissions where role_id = input_role_id and ad_element_id = selected_user_id and object_id= getGlobalIds('system') and object_type_id = 1); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(role_id,action_group_id) SELECT v_role_id, v_action_group_id WHERE NOT EXISTS (SELECT 1 FROM roles_groups WHERE role_id = v_role_id AND action_group_id = v_action_group_id); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) RETURNS void AS $BODY$ declare v_old_value varchar(4000); v_cur cursor for select distinct version from vdc_options where version <> 'general' order by version; v_version varchar(40); v_index integer; v_count integer; v_total_count integer; v_version_count integer; begin v_total_count := count(version) from vdc_options where option_name = v_option_name; v_old_value := option_value from vdc_options where option_name = v_option_name and version = 'general'; v_version_count := count(distinct version) from vdc_options where version <> 'general'; if (v_total_count <= v_version_count) then begin if (v_old_value IS NULL) then v_old_value := v_old_option_value; end if; v_count := count(distinct version) from vdc_options where version <> 'general'; v_index := 1; open v_cur; loop fetch v_cur into v_version; exit when not found; -- We shouldn't update if already exists if (not exists (select 1 from vdc_options where option_name = v_option_name and version = v_version)) then -- Might not work well for versions such as 3.10, but we currently don't have any if (v_version >= v_update_from_version) then insert into vdc_options (option_name, option_value, version) values (v_option_name, v_new_option_value, v_version); else insert into vdc_options (option_name, option_value, version) values (v_option_name, v_old_value, v_version); end if; end if; v_index := v_index +1; end loop; close v_cur; delete from vdc_options where option_name = v_option_name and version = 'general'; end; end if; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_grant_action_group_to_all_roles_filter(v_action_group_id integer, uuid[]) RETURNS void AS $BODY$ declare v_role_id_to_filter alias for $2; begin insert into roles_groups (role_id, action_group_id) select distinct role_id, v_action_group_id from roles_groups rg where not ARRAY [role_id] <@ v_role_id_to_filter and not exists (select 1 from roles_groups where role_id = rg.role_id and action_group_id = v_action_group_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_column_to_object_white_list(v_object_name varchar(128), v_column_name varchar(128)) returns void AS $procedure$ begin if (not exists (select 1 from object_column_white_list where object_name = v_object_name and column_name = v_column_name)) then begin -- verify that there is such object in db if exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = v_object_name and column_name = v_column_name) then insert into object_column_white_list (object_name, column_name) values (v_object_name, v_column_name); end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_disk(v_id UUID) returns void AS $procedure$ declare OK integer; LOCKED integer; begin OK:=1; LOCKED:=2; update images set imagestatus = OK where imagestatus = LOCKED and image_group_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_snapshot(v_id UUID) returns void AS $procedure$ declare OK varchar; LOCKED varchar; begin OK:='OK'; LOCKED:='LOCKED'; update snapshots set status = OK where status = LOCKED and snapshot_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_entity(v_object_type varchar(10), v_name varchar(255), v_recursive boolean) returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; v_id UUID; begin DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; --unlock images and snapshots if recursive flag is set if (v_recursive) then update images set imagestatus = OK where imagestatus = LOCKED and image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED and vm_id = v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_all() returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; BEGIN DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED; update vm_dynamic set status = DOWN where status = IMAGE_LOCKED; update images set imagestatus = OK where imagestatus = LOCKED; update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Displays DC id , DC name, SPM Host id , SPM Host name and number of async tasks awaiting. 1) create a record type with DC name, DC id, SPM host id, SPM host name, count 2) get all distinct DC ids from async_tasks table 3) Run a cursor for each result in 2) a) get DC name b) get SPM Host id & name if available c) get count of tasks return current record 4) return set of generated records */ DROP TYPE IF EXISTS async_tasks_info_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** create or replace FUNCTION fn_db_get_async_tasks() returns SETOF async_tasks_info_rs STABLE AS $procedure$ DECLARE v_record async_tasks_info_rs; -- selects storage_pool_id uuid found in async_tasks v_tasks_cursor cursor for select distinct storage_pool_id from async_tasks; begin OPEN v_tasks_cursor; FETCH v_tasks_cursor into v_record.dc_id; WHILE FOUND LOOP -- get dc_name and SPM Host id v_record.dc_name := name from storage_pool where id = v_record.dc_id; v_record.spm_host_id := spm_vds_id from storage_pool where id = v_record.dc_id; -- get Host name if we have non NULL SPM Host if (v_record.spm_host_id IS NOT NULL) then v_record.spm_host_name := vds_name from vds_static where vds_id = v_record.spm_host_id; else v_record.spm_host_name:=''; end if; -- get tasks count for this DC v_record.task_count := count(*) from async_tasks where position (cast(v_record.dc_id as varchar) in action_parameters) > 0; -- return the record RETURN NEXT v_record; FETCH v_tasks_cursor into v_record.dc_id; END LOOP; CLOSE v_tasks_cursor; -- return full set of generated records RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ DECLARE v varchar[]; e varchar; v_result varchar; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; FOR e in select unnest(v) LOOP IF (e != v_value) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_uuid_from_csv(v_csv_text text, v_uuid uuid) returns text STABLE AS $procedure$ DECLARE v uuid[]; e uuid; v_result text; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(v_csv_text, ','); FOR e in select unnest(v) LOOP IF (e != v_uuid) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; IF (v_result = '') THEN v_result := null; END IF; return v_result; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select * from generate_drop_all_views_syntax(); ************************** ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (not exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin insert into vdc_options (option_name, option_value, version) values (v_option_name, v_option_value, v_version); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value_all_versions(v_option_name varchar(100)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name)) then begin delete from vdc_options where option_name ilike v_option_name; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value(v_option_name varchar(100), v_version text) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)))) then begin delete from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_for_version(v_version text) returns void AS $procedure$ BEGIN delete from vdc_options where version in (select ID from fnSplitter(v_version)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin update vdc_options set option_value = v_option_value where option_name ilike v_option_name and version = v_version; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_default_config_value(v_option_name varchar(100),v_default_option_value varchar(4000),v_option_value varchar(4000),v_version varchar(40),v_ignore_default_value_case boolean) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin if (v_ignore_default_value_case) then update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value ilike v_default_option_value and version = v_version; else update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value = v_default_option_value and version = v_version; end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_rename_config_key(v_old_option_name varchar(100),v_new_option_name varchar(100),v_version varchar(40)) returns void AS $procedure$ DECLARE v_current_option_value varchar(4000); begin if (exists (select 1 from vdc_options where option_name ilike v_old_option_name and version = v_version)) then v_current_option_value:=option_value from vdc_options where option_name ilike v_old_option_name and version = v_version; update vdc_options set option_name = v_new_option_name, option_value = v_current_option_value where option_name ilike v_old_option_name and version = v_version; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'public' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'public' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'public' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'public' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and table_schema = 'public' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION attach_user_to_role ( v_user_name VARCHAR(255), v_domain VARCHAR(255), v_namespace VARCHAR(255), v_domain_entry_id text, v_role_name VARCHAR(255) ) RETURNS void AS $BODY$ DECLARE selected_user_id uuid; input_role_id uuid; BEGIN select roles.id into input_role_id from roles where roles.name = v_role_name; -- The external identifier is the user identifier converted to an array of -- bytes: insert into users(user_id,external_id, namespace,name,domain,username,last_admin_check_status) select uuid_generate_v1(), v_domain_entry_id, v_namespace, v_user_name, v_domain, v_user_name,true where not exists (select 1 from users where domain = v_domain and external_id = v_domain_entry_id); select user_id from users where domain = v_domain and external_id = v_domain_entry_id into selected_user_id; insert into permissions(id,role_id,ad_element_id,object_id,object_type_id) select uuid_generate_v1(), input_role_id, selected_user_id, getGlobalIds('system'), 1 where not exists(select role_id,ad_element_id,object_id,object_type_id from permissions where role_id = input_role_id and ad_element_id = selected_user_id and object_id= getGlobalIds('system') and object_type_id = 1); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(role_id,action_group_id) SELECT v_role_id, v_action_group_id WHERE NOT EXISTS (SELECT 1 FROM roles_groups WHERE role_id = v_role_id AND action_group_id = v_action_group_id); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) RETURNS void AS $BODY$ declare v_old_value varchar(4000); v_cur cursor for select distinct version from vdc_options where version <> 'general' order by version; v_version varchar(40); v_index integer; v_count integer; v_total_count integer; v_version_count integer; begin v_total_count := count(version) from vdc_options where option_name = v_option_name; v_old_value := option_value from vdc_options where option_name = v_option_name and version = 'general'; v_version_count := count(distinct version) from vdc_options where version <> 'general'; if (v_total_count <= v_version_count) then begin if (v_old_value IS NULL) then v_old_value := v_old_option_value; end if; v_count := count(distinct version) from vdc_options where version <> 'general'; v_index := 1; open v_cur; loop fetch v_cur into v_version; exit when not found; -- We shouldn't update if already exists if (not exists (select 1 from vdc_options where option_name = v_option_name and version = v_version)) then -- Might not work well for versions such as 3.10, but we currently don't have any if (v_version >= v_update_from_version) then insert into vdc_options (option_name, option_value, version) values (v_option_name, v_new_option_value, v_version); else insert into vdc_options (option_name, option_value, version) values (v_option_name, v_old_value, v_version); end if; end if; v_index := v_index +1; end loop; close v_cur; delete from vdc_options where option_name = v_option_name and version = 'general'; end; end if; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_grant_action_group_to_all_roles_filter(v_action_group_id integer, uuid[]) RETURNS void AS $BODY$ declare v_role_id_to_filter alias for $2; begin insert into roles_groups (role_id, action_group_id) select distinct role_id, v_action_group_id from roles_groups rg where not ARRAY [role_id] <@ v_role_id_to_filter and not exists (select 1 from roles_groups where role_id = rg.role_id and action_group_id = v_action_group_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_column_to_object_white_list(v_object_name varchar(128), v_column_name varchar(128)) returns void AS $procedure$ begin if (not exists (select 1 from object_column_white_list where object_name = v_object_name and column_name = v_column_name)) then begin -- verify that there is such object in db if exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = v_object_name and column_name = v_column_name) then insert into object_column_white_list (object_name, column_name) values (v_object_name, v_column_name); end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_disk(v_id UUID) returns void AS $procedure$ declare OK integer; LOCKED integer; begin OK:=1; LOCKED:=2; update images set imagestatus = OK where imagestatus = LOCKED and image_group_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_snapshot(v_id UUID) returns void AS $procedure$ declare OK varchar; LOCKED varchar; begin OK:='OK'; LOCKED:='LOCKED'; update snapshots set status = OK where status = LOCKED and snapshot_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_entity(v_object_type varchar(10), v_name varchar(255), v_recursive boolean) returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; v_id UUID; begin DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; --unlock images and snapshots if recursive flag is set if (v_recursive) then update images set imagestatus = OK where imagestatus = LOCKED and image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED and vm_id = v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_all() returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; BEGIN DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED; update vm_dynamic set status = DOWN where status = IMAGE_LOCKED; update images set imagestatus = OK where imagestatus = LOCKED; update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Displays DC id , DC name, SPM Host id , SPM Host name and number of async tasks awaiting. 1) create a record type with DC name, DC id, SPM host id, SPM host name, count 2) get all distinct DC ids from async_tasks table 3) Run a cursor for each result in 2) a) get DC name b) get SPM Host id & name if available c) get count of tasks return current record 4) return set of generated records */ DROP TYPE IF EXISTS async_tasks_info_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** create or replace FUNCTION fn_db_get_async_tasks() returns SETOF async_tasks_info_rs STABLE AS $procedure$ DECLARE v_record async_tasks_info_rs; -- selects storage_pool_id uuid found in async_tasks v_tasks_cursor cursor for select distinct storage_pool_id from async_tasks; begin OPEN v_tasks_cursor; FETCH v_tasks_cursor into v_record.dc_id; WHILE FOUND LOOP -- get dc_name and SPM Host id v_record.dc_name := name from storage_pool where id = v_record.dc_id; v_record.spm_host_id := spm_vds_id from storage_pool where id = v_record.dc_id; -- get Host name if we have non NULL SPM Host if (v_record.spm_host_id IS NOT NULL) then v_record.spm_host_name := vds_name from vds_static where vds_id = v_record.spm_host_id; else v_record.spm_host_name:=''; end if; -- get tasks count for this DC v_record.task_count := count(*) from async_tasks where position (cast(v_record.dc_id as varchar) in action_parameters) > 0; -- return the record RETURN NEXT v_record; FETCH v_tasks_cursor into v_record.dc_id; END LOOP; CLOSE v_tasks_cursor; -- return full set of generated records RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ DECLARE v varchar[]; e varchar; v_result varchar; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; FOR e in select unnest(v) LOOP IF (e != v_value) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_uuid_from_csv(v_csv_text text, v_uuid uuid) returns text STABLE AS $procedure$ DECLARE v uuid[]; e uuid; v_result text; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(v_csv_text, ','); FOR e in select unnest(v) LOOP IF (e != v_uuid) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; IF (v_result = '') THEN v_result := null; END IF; return v_result; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select * from generate_drop_all_functions_syntax(); ************************** drop function if exists public.attach_user_to_role(character varying, character varying, character varying, text, character varying) cascade; drop function if exists public.calculateallstorageusage() cascade; drop function if exists public.calculateallvdsgroupusage() cascade; drop function if exists public.calculatestorageusage(uuid, uuid) cascade; drop function if exists public.calculatevdsgroupusage(uuid, uuid) cascade; drop function if exists public.checkdbconnection() cascade; drop function if exists public.fn_authz_entry_info(uuid) cascade; drop function if exists public.fn_db_add_action_group_to_role(uuid, integer) cascade; drop function if exists public.fn_db_add_column(character varying, character varying, text) cascade; drop function if exists public.fn_db_add_column_to_object_white_list(character varying, character varying) cascade; drop function if exists public.fn_db_add_config_value(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_add_config_value_for_versions_up_to(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_change_column_type(character varying, character varying, character varying, character varying) cascade; drop function if exists public.fn_db_create_constraint(character varying, character varying, text) cascade; drop function if exists public.fn_db_create_index(character varying, character varying, text, text) cascade; drop function if exists public.fn_db_delete_config_for_version(text) cascade; drop function if exists public.fn_db_delete_config_value(character varying, text) cascade; drop function if exists public.fn_db_delete_config_value_all_versions(character varying) cascade; drop function if exists public.fn_db_drop_column(character varying, character varying) cascade; drop function if exists public.fn_db_drop_constraint(character varying, character varying) cascade; drop function if exists public.fn_db_get_async_tasks() cascade; drop function if exists public.fn_db_grant_action_group_to_all_roles_filter(integer, uuid[]) cascade; drop function if exists public.fn_db_is_table_exists(character varying) cascade; drop function if exists public.fn_db_mask_object(regclass) cascade; drop function if exists public.fn_db_remove_csv_config_value(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_remove_uuid_from_csv(text, uuid) cascade; drop function if exists public.fn_db_rename_column(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_rename_config_key(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_split_config_value(character varying, character varying, character varying, character varying) cascade; drop function if exists public.fn_db_unlock_all() cascade; drop function if exists public.fn_db_unlock_disk(uuid) cascade; drop function if exists public.fn_db_unlock_entity(character varying, character varying, boolean) cascade; drop function if exists public.fn_db_unlock_snapshot(uuid) cascade; drop function if exists public.fn_db_update_config_value(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_update_default_config_value(character varying, character varying, character varying, character varying, boolean) cascade; drop function if exists public.fn_get_actual_images_size_by_storage(uuid) cascade; drop function if exists public.fn_get_ad_element_name(uuid) cascade; drop function if exists public.fn_get_column_size(character varying, character varying) cascade; drop function if exists public.fn_get_comparable_ip_list(text) cascade; drop function if exists public.fn_get_dedicated_hosts_ids_by_vm_id(uuid) cascade; drop function if exists public.fn_get_disk_commited_value_by_storage(uuid) cascade; drop function if exists public.fn_get_entity_name(uuid, integer) cascade; drop function if exists public.fn_get_entity_parents(uuid, integer) cascade; drop function if exists public.fn_get_storage_domain_shared_status_by_domain_id(uuid, integer, integer) cascade; drop function if exists public.fn_user_permissions(uuid) cascade; drop function if exists public.fnsplitter(text) cascade; drop function if exists public.fnsplitterinteger(text) cascade; drop function if exists public.fnsplitteruuid(text) cascade; drop function if exists public.fnsplitterwithseperator(text, character varying) cascade; drop function if exists public.generate_drop_all_functions_syntax() cascade; drop function if exists public.generate_drop_all_seq_syntax() cascade; drop function if exists public.generate_drop_all_tables_syntax() cascade; drop function if exists public.generate_drop_all_user_types_syntax() cascade; drop function if exists public.generate_drop_all_views_syntax() cascade; drop function if exists public.getelementidsbyidandgroups(uuid, text) cascade; drop function if exists public.getglobalids(character varying) cascade; drop function if exists public.getnoncountablequtoavmstatuses() cascade; drop function if exists public.getuserandgroupsbyid(uuid) cascade; drop function if exists public.uuid_generate_v1() cascade; ********* QUERY ********** drop function if exists public.attach_user_to_role(character varying, character varying, character varying, text, character varying) cascade; drop function if exists public.calculateallstorageusage() cascade; drop function if exists public.calculateallvdsgroupusage() cascade; drop function if exists public.calculatestorageusage(uuid, uuid) cascade; drop function if exists public.calculatevdsgroupusage(uuid, uuid) cascade; drop function if exists public.checkdbconnection() cascade; drop function if exists public.fn_authz_entry_info(uuid) cascade; drop function if exists public.fn_db_add_action_group_to_role(uuid, integer) cascade; drop function if exists public.fn_db_add_column(character varying, character varying, text) cascade; drop function if exists public.fn_db_add_column_to_object_white_list(character varying, character varying) cascade; drop function if exists public.fn_db_add_config_value(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_add_config_value_for_versions_up_to(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_change_column_type(character varying, character varying, character varying, character varying) cascade; drop function if exists public.fn_db_create_constraint(character varying, character varying, text) cascade; drop function if exists public.fn_db_create_index(character varying, character varying, text, text) cascade; drop function if exists public.fn_db_delete_config_for_version(text) cascade; drop function if exists public.fn_db_delete_config_value(character varying, text) cascade; drop function if exists public.fn_db_delete_config_value_all_versions(character varying) cascade; drop function if exists public.fn_db_drop_column(character varying, character varying) cascade; drop function if exists public.fn_db_drop_constraint(character varying, character varying) cascade; drop function if exists public.fn_db_get_async_tasks() cascade; drop function if exists public.fn_db_grant_action_group_to_all_roles_filter(integer, uuid[]) cascade; drop function if exists public.fn_db_is_table_exists(character varying) cascade; drop function if exists public.fn_db_mask_object(regclass) cascade; drop function if exists public.fn_db_remove_csv_config_value(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_remove_uuid_from_csv(text, uuid) cascade; drop function if exists public.fn_db_rename_column(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_rename_config_key(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_split_config_value(character varying, character varying, character varying, character varying) cascade; drop function if exists public.fn_db_unlock_all() cascade; drop function if exists public.fn_db_unlock_disk(uuid) cascade; drop function if exists public.fn_db_unlock_entity(character varying, character varying, boolean) cascade; drop function if exists public.fn_db_unlock_snapshot(uuid) cascade; drop function if exists public.fn_db_update_config_value(character varying, character varying, character varying) cascade; drop function if exists public.fn_db_update_default_config_value(character varying, character varying, character varying, character varying, boolean) cascade; drop function if exists public.fn_get_actual_images_size_by_storage(uuid) cascade; drop function if exists public.fn_get_ad_element_name(uuid) cascade; drop function if exists public.fn_get_column_size(character varying, character varying) cascade; drop function if exists public.fn_get_comparable_ip_list(text) cascade; drop function if exists public.fn_get_dedicated_hosts_ids_by_vm_id(uuid) cascade; drop function if exists public.fn_get_disk_commited_value_by_storage(uuid) cascade; drop function if exists public.fn_get_entity_name(uuid, integer) cascade; drop function if exists public.fn_get_entity_parents(uuid, integer) cascade; drop function if exists public.fn_get_storage_domain_shared_status_by_domain_id(uuid, integer, integer) cascade; drop function if exists public.fn_user_permissions(uuid) cascade; drop function if exists public.fnsplitter(text) cascade; drop function if exists public.fnsplitterinteger(text) cascade; drop function if exists public.fnsplitteruuid(text) cascade; drop function if exists public.fnsplitterwithseperator(text, character varying) cascade; drop function if exists public.generate_drop_all_functions_syntax() cascade; drop function if exists public.generate_drop_all_seq_syntax() cascade; drop function if exists public.generate_drop_all_tables_syntax() cascade; drop function if exists public.generate_drop_all_user_types_syntax() cascade; drop function if exists public.generate_drop_all_views_syntax() cascade; drop function if exists public.getelementidsbyidandgroups(uuid, text) cascade; drop function if exists public.getglobalids(character varying) cascade; drop function if exists public.getnoncountablequtoavmstatuses() cascade; drop function if exists public.getuserandgroupsbyid(uuid) cascade; drop function if exists public.uuid_generate_v1() cascade; ************************** DROP FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS idTextType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE idtexttype AS ( id text ); ************************** CREATE TYPE ********* QUERY ********** DROP TYPE IF EXISTS idUuidType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE iduuidtype AS ( id uuid ); ************************** CREATE TYPE ********* QUERY ********** DROP TYPE IF EXISTS booleanResultType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE booleanresulttype AS ( result boolean ); ************************** CREATE TYPE ********* QUERY ********** DROP TYPE IF EXISTS authzEntryInfoType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE authzentryinfotype AS ( name text, namespace character varying(2048), authz character varying(255) ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION getGlobalIds(v_name VARCHAR(4000)) RETURNS UUID IMMUTABLE STRICT AS $function$ DECLARE v_id UUID; BEGIN if (v_name = 'system') then v_id := 'AAA00000-0000-0000-0000-123456789AAA'; elsif (v_name = 'everyone') then v_id := 'EEE00000-0000-0000-0000-123456789EEE'; -- bottom is an object which all the objects in the system are its parents -- useful to denote we want all objects when checking for permissions elsif (v_name = 'bottom') then v_id := 'BBB00000-0000-0000-0000-123456789BBB'; end if; return v_id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fnSplitter(ids TEXT) RETURNS SETOF idTextType IMMUTABLE AS $function$ BEGIN RETURN QUERY SELECT regexp_split_to_table(ids, ',') AS id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fnSplitterInteger(ids TEXT) RETURNS SETOF INTEGER IMMUTABLE AS $function$ BEGIN RETURN QUERY SELECT CAST(regexp_split_to_table(ids, ',') AS INTEGER); END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fnSplitterUuid(ids TEXT) RETURNS SETOF UUID IMMUTABLE AS $function$ BEGIN IF ids != '' THEN RETURN QUERY SELECT CAST(regexp_split_to_table(ids, ',') AS UUID); END IF; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fnSplitterWithSeperator(ids TEXT, separator VARCHAR(10)) RETURNS SETOF idTextType IMMUTABLE AS $function$ BEGIN RETURN QUERY SELECT regexp_split_to_table(ids, separator) AS id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS user_permissions CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE user_permissions AS ( permission_id uuid, role_id uuid, user_id uuid ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_user_permissions(v_userId IN uuid) RETURNS SETOF user_permissions STABLE AS $function$ DECLARE BEGIN RETURN QUERY SELECT permissions.id AS permission_id, permissions.role_id, permissions.ad_element_id AS user_id FROM permissions INNER JOIN users ON permissions.ad_element_id = users.user_id WHERE users.user_id = v_userId UNION SELECT permissions.id AS permission_id, permissions.role_id, temp.user_id AS user_id FROM permissions INNER JOIN ( -- get all groups of admin users SELECT ad_groups.id group_id, users.user_id FROM ad_groups, engine_sessions WHERE ad_groups.id IN (SELECT * FROM fnsplitteruuid(engine_sessions.group_ids)) AND users.user_id = v_userId ) temp ON permissions.ad_element_id = temp.group_id; END; $function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_entity_parents(v_entity_id IN uuid, v_object_type IN int4) RETURNS SETOF idUuidType STABLE AS $function$ /* Gets a list of all parent GUID to the system root (including) Object Types (compatible with VdcObjectType, XXX entries are unused currently) Unknown XXX, System XXX, Bottom = 0, VM = 2, VDS = 3, VmTemplate = 4, VmPool = 5, AdElements XXX, Tags XXX, Bookmarks XXX, VdsGroups = 9, MultiLevelAdministration XXX, Storage = 11, EventNotification XXX, ImportExport XXX, StoragePool = 14, User = 15, Role = 16, Quota = 17, GlusterVolume = 18, Disk = 19, Network = 20, VNICProfile = 27, MacPool = 28 DiskProfile = 29 CpuProfile = 30 */ DECLARE v_entity_type int4 := v_object_type; system_root_id uuid; cluster_id uuid; ds_id uuid; v_image_id uuid; v_storage_id uuid; v_vm_id uuid; v_storage_pool_id uuid; v_profile_network_id uuid; v_disk_profile_storage_id uuid; v_cpu_profile_cluster_id uuid; BEGIN system_root_id := ( SELECT getGlobalIds('system') ); -- hardcoded also in MLA Handler CASE WHEN v_entity_type = 0 THEN -- Bottom RETURN QUERY SELECT object_id FROM permissions; WHEN v_entity_type = 2 THEN -- VM -- get cluster id cluster_id := ( SELECT vds_group_id FROM vm_static WHERE vm_guid = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 3 THEN -- VDS -- get cluster id cluster_id := ( SELECT vds_group_id FROM vds_static WHERE vds_id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 4 THEN -- Template -- get image id first v_image_id := ( SELECT image_guid FROM images i JOIN vm_device vd ON i.image_group_id = vd.device_id WHERE vm_id = v_entity_id limit 1); -- get the storage id from images v_storage_id := ( SELECT storage_domain_id FROM image_storage_domain_map WHERE image_id = v_image_id limit 1); -- finally get data center id ds_id := ( SELECT storage_pool_id FROM storage_pool_iso_map WHERE storage_id = v_storage_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 5 THEN -- VM Pool -- get cluster id cluster_id := ( SELECT vds_group_id FROM vm_pools WHERE vm_pool_id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 9 THEN -- Cluster -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = v_entity_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 11 THEN -- Storage Domain RETURN QUERY SELECT system_root_id AS id UNION ALL SELECT storage_pool_id as id FROM storage_pool_iso_map WHERE storage_id = v_entity_id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 17 THEN -- Quota -- get data center id ds_id := ( SELECT storage_pool_id FROM quota WHERE id = v_entity_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 18 THEN -- GlusterVolume -- get cluster id cluster_id := ( SELECT v.cluster_id FROM gluster_volumes v WHERE id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 19 THEN -- Disk -- get data center, storage domain and vm SELECT INTO ds_id, v_storage_id, v_vm_id storage_pool_id, storage_id, vm_id FROM images_storage_domain_view LEFT OUTER JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id WHERE image_group_id = v_entity_id; -- get cluster cluster_id := ( SELECT vds_group_id FROM vm_static WHERE vm_guid = v_vm_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT v_storage_id AS id UNION SELECT v_vm_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 20 THEN -- Network SELECT INTO v_storage_pool_id network.storage_pool_id FROM network WHERE network.id = v_entity_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 27 THEN -- VNICProfile SELECT INTO v_profile_network_id vnic_profiles.network_id FROM vnic_profiles WHERE vnic_profiles.id = v_entity_id; SELECT INTO v_storage_pool_id network.storage_pool_id FROM network WHERE network.id = v_profile_network_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_profile_network_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 29 THEN -- DiskProfile SELECT INTO v_disk_profile_storage_id disk_profiles.storage_domain_id FROM disk_profiles WHERE disk_profiles.id = v_entity_id; SELECT INTO v_storage_pool_id storage_pool_iso_map.storage_pool_id FROM storage_pool_iso_map WHERE storage_pool_iso_map.storage_id = v_disk_profile_storage_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_disk_profile_storage_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 30 THEN -- CpuProfile SELECT INTO v_cpu_profile_cluster_id cpu_profiles.cluster_id FROM cpu_profiles WHERE cpu_profiles.id = v_entity_id; SELECT INTO v_storage_pool_id vds_groups.storage_pool_id FROM vds_groups WHERE vds_groups.vds_group_id = v_cpu_profile_cluster_id; RETURN QUERY SELECT system_root_id AS id UNION SELECT v_storage_pool_id AS id UNION SELECT v_cpu_profile_cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 23 THEN -- Gluster Hook -- get cluster id cluster_id := ( SELECT cluster_id FROM gluster_hooks WHERE id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; WHEN v_entity_type = 25 THEN -- Gluster Service -- get cluster id cluster_id := ( SELECT vds_group_id FROM vds_static WHERE vds_id = v_entity_id ); -- get data center id ds_id := ( SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = cluster_id ); RETURN QUERY SELECT system_root_id AS id UNION SELECT ds_id AS id UNION SELECT cluster_id AS id UNION SELECT v_entity_id AS id; ELSE IF v_entity_type IN ( 1,14,15,16,28 ) THEN -- Data Center, users, roles and mac pools are under system RETURN QUERY SELECT system_root_id AS id UNION SELECT v_entity_id AS id; END IF; END CASE; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_disk_commited_value_by_storage(v_storage_domain_id IN uuid) RETURNS integer STABLE AS $function$ DECLARE result integer; mult bigint; BEGIN mult := ( SELECT COALESCE(SUM( CASE WHEN (images_storage_domain_view.active = true AND (images_storage_domain_view.entity_type IS NULL OR -- Floating disk images_storage_domain_view.entity_type <> 'TEMPLATE')) -- or a VM THEN images_storage_domain_view.size ELSE images_storage_domain_view.actual_size END),0) FROM images_storage_domain_view WHERE images_storage_domain_view.storage_id = v_storage_domain_id ); -- convert to GB from bytes mult := CAST((mult * 0.000000000931322574615478515625) AS bigint); result := CAST(mult as integer); RETURN result; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_actual_images_size_by_storage(v_storage_domain_id IN uuid) RETURNS integer STABLE AS $function$ DECLARE result integer; mult bigint; BEGIN mult := ( SELECT COALESCE(SUM(images_storage_domain_view.actual_size),0) FROM images_storage_domain_view WHERE images_storage_domain_view.storage_id = v_storage_domain_id ); -- convert to GB from bytes mult := CAST((mult * 0.000000000931322574615478515625) AS bigint); result := CAST(mult as integer); RETURN result; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_get_storage_domain_shared_status_by_domain_id(v_storage_domain_id UUID, v_storage_status INTEGER, v_storage_domain_type INTEGER) RETURNS INTEGER AS $function$ DECLARE v_result INTEGER; v_rowsCount INTEGER; v_status INTEGER; BEGIN if (v_storage_domain_type != 2) then if (v_storage_status is null) then v_result := 0; else -- if 1 row and status active (3) then domain is active (1) if v_storage_status = 3 then v_result := 1; -- if 1 row and status not active then domain is inactive (2) else v_result := 2; end if; end if; else BEGIN CREATE TEMPORARY TABLE tt_TEMP22 ( status INTEGER, count INTEGER ) WITH OIDS; exception when others then truncate table tt_TEMP22; END; delete from tt_TEMP22; Insert INTO tt_TEMP22 select status, count(storage_id) from storage_pool_iso_map where storage_id = v_storage_domain_id group by status; select count(*) INTO v_rowsCount from tt_TEMP22; -- if return 0 rows then the domain is unattached if (v_rowsCount = 0) then v_result := 0; else if (v_rowsCount = 1) then -- if 1 row and status active (3) then domain is active (1) if v_storage_status = 3 then v_result := 1; -- if 1 row and status not active then domain is inactive (2) else v_result := 2; end if; -- else (if return more than 1 row) else select count(*) INTO v_rowsCount from tt_TEMP22 where status = 3; if (v_rowsCount > 0) then v_result := 3; -- non of the statuses is active else v_result := 2; end if; end if; end if; end if; return v_result; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_authz_entry_info(v_ad_element_id IN uuid) RETURNS AuthzEntryInfoType STABLE AS $function$ DECLARE result authzEntryInfoType; BEGIN if (v_ad_element_id = getGlobalIds('everyone')) then select 'Everyone','*','' into result; else select(COALESCE(name,'') || ' ' || COALESCE(surname,'') || ' (' || COALESCE(username,'') || '@' || COALESCE(domain,'') || ')'), namespace, domain INTO result from users where user_id = v_ad_element_id; if (result is null) then select name, namespace, domain INTO result from ad_groups where ID = v_ad_element_id; end if; end if; return result; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_ad_element_name(v_ad_element_id IN uuid) RETURNS text STABLE AS $function$ DECLARE result text; BEGIN if (v_ad_element_id = getGlobalIds('everyone')) then result := 'Everyone'; else select(COALESCE(name,'') || ' ' || COALESCE(surname,'') || ' (' || COALESCE(username,'') || '@' || COALESCE(domain,'') || ')') INTO result from users where user_id = v_ad_element_id; if (result is null) then select name INTO result from ad_groups where ID = v_ad_element_id; end if; end if; return result; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION public.fn_get_entity_name(v_entity_id IN uuid, v_object_type IN int4) RETURNS text STABLE AS $function$ /* Gets object name by its id and type Object Types (compatible with VdcObjectType, XXX entries are unused currently) Unknown XXX, System XXX, VM = 2, VDS = 3, VmTemplate = 4, VmPool = 5, AdElements XXX, Tags XXX, Bookmarks XXX, VdsGroups = 9, MultiLevelAdministration XXX, Storage = 11, EventNotification XXX, ImportExport XXX, StoragePool = 14, User = 15, Role = 16, Quota = 17, GlusterVolume = 18, Disk = 19, Network = 20, VNICProfile = 27, MacPool = 28, DiskProfile = 29 CpuProfile = 30 */ DECLARE v_entity_type int4 := v_object_type; result text; BEGIN CASE WHEN v_entity_type = 1 THEN result := 'System'; WHEN v_entity_type = 2 OR v_entity_type = 4 THEN result := ( SELECT vm_name FROM vm_static WHERE vm_guid = v_entity_id ); WHEN v_entity_type = 3 THEN result := ( SELECT vds_name FROM vds_static WHERE vds_id = v_entity_id ); WHEN v_entity_type = 5 THEN result := ( SELECT vm_pool_name FROM vm_pools WHERE vm_pool_id = v_entity_id ); WHEN v_entity_type = 7 THEN result := ( SELECT tag_name FROM tags WHERE tag_id = v_entity_id ); WHEN v_entity_type = 8 THEN result := ( SELECT bookmark_name FROM bookmarks WHERE bookmark_id = v_entity_id ); WHEN v_entity_type = 9 THEN result := ( SELECT name FROM vds_groups WHERE vds_group_id = v_entity_id ); WHEN v_entity_type = 11 THEN result := ( SELECT storage_name FROM storage_domain_static WHERE id = v_entity_id ); WHEN v_entity_type = 14 THEN result := ( SELECT name FROM storage_pool WHERE id = v_entity_id ); WHEN v_entity_type = 15 THEN result := ( SELECT username FROM users WHERE user_id = v_entity_id ); WHEN v_entity_type = 16 THEN result := ( SELECT name FROM roles WHERE id = v_entity_id ); WHEN v_entity_type = 17 THEN result := ( SELECT quota_name FROM quota WHERE id = v_entity_id ); WHEN v_entity_type = 18 THEN result := ( SELECT vol_name FROM gluster_volumes WHERE id = v_entity_id ); WHEN v_entity_type = 19 THEN result := ( SELECT disk_alias FROM base_disks WHERE disk_id = v_entity_id ); WHEN v_entity_type = 20 THEN result := ( SELECT name FROM network WHERE id = v_entity_id ); WHEN v_entity_type = 23 THEN result := ( SELECT concat(gluster_command,'-',stage,'-',name) FROM gluster_hooks where id = v_entity_id ); WHEN v_entity_type = 25 THEN result := ( SELECT service_name FROM gluster_services where id = v_entity_id ); WHEN v_entity_type = 27 THEN result := ( SELECT name FROM vnic_profiles where id = v_entity_id ); WHEN v_entity_type = 28 THEN result := ( SELECT name FROM mac_pools where id = v_entity_id ); WHEN v_entity_type = 29 THEN result := ( SELECT name FROM disk_profiles where id = v_entity_id ); WHEN v_entity_type = 30 THEN result := ( SELECT name FROM cpu_profiles where id = v_entity_id ); ELSE result := 'Unknown type ' || v_entity_type; END CASE; -- -- This should be written to an error var or include object_id that is missing -- IF result IS NULL THEN -- result := v_entity_id || '' NOT FOUND''; -- END IF; RETURN result; END;$function$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getUserAndGroupsById(v_id UUID) RETURNS SETOF idUuidType STABLE AS $function$ BEGIN RETURN QUERY select ad_groups.ID from ad_groups,engine_sessions where engine_sessions.user_id = v_id and ad_groups.id in(select * from fnsplitteruuid(engine_sessions.group_ids)) UNION select v_id UNION -- user is also member of 'Everyone' select 'EEE00000-0000-0000-0000-123456789EEE'; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getElementIdsByIdAndGroups(v_id UUID,v_group_ids text) RETURNS SETOF idUuidType STABLE AS $function$ BEGIN RETURN QUERY select * from fnsplitteruuid(v_group_ids) UNION select v_id UNION -- user is also member of 'Everyone' select 'EEE00000-0000-0000-0000-123456789EEE'; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS vds_group_usage_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE vds_group_usage_rs AS ( virtual_cpu_usage integer, mem_size_mb_usage bigint ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION getNonCountableQutoaVmStatuses() RETURNS SETOF INTEGER IMMUTABLE AS $BODY$ BEGIN RETURN query select 0 union select 13 union select 14 union select 15; --(Down(0), Suspended(13), ImageIllegal(14), ImageLocked(15)) END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CalculateVdsGroupUsage(v_quota_id UUID, v_vds_group_id UUID) RETURNS SETOF vds_group_usage_rs STABLE AS $function$ BEGIN RETURN QUERY SELECT cast(COALESCE(sum(num_of_sockets * cpu_per_socket), 0) as INTEGER) as virtual_cpu_usage, COALESCE(sum(mem_size_mb), 0) as mem_size_mb_usage FROM vm_static,vm_dynamic WHERE quota_id = v_quota_id AND vm_dynamic.vm_guid = vm_static.vm_guid AND vm_dynamic.status not in (SELECT getNonCountableQutoaVmStatuses()) AND (v_vds_group_id = vm_static.vds_group_id or v_vds_group_id IS NULL); END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS all_vds_group_usage_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE all_vds_group_usage_rs AS ( quota_vds_group_id uuid, quota_id uuid, vds_group_id uuid, vds_group_name character varying(40), virtual_cpu integer, virtual_cpu_usage integer, mem_size_mb bigint, mem_size_mb_usage bigint ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION calculateAllVdsGroupUsage() RETURNS SETOF all_vds_group_usage_rs STABLE AS $function$ BEGIN RETURN QUERY SELECT quota_limitation.id AS quota_vds_group_id, quota_limitation.quota_id as quota_id, quota_limitation.vds_group_id as vds_group_id, vds_groups.name AS vds_group_name, quota_limitation.virtual_cpu, cast(COALESCE(sum(num_of_sockets * cpu_per_socket * cast(vm_dynamic.status not in (SELECT getNonCountableQutoaVmStatuses()) as INTEGER)), 0) as INTEGER) as virtual_cpu_usage, quota_limitation.mem_size_mb, COALESCE(sum(vm_static.mem_size_mb), 0) as mem_size_mb_usage FROM quota_limitation LEFT JOIN vm_static ON vm_static.quota_id = quota_limitation.quota_id LEFT JOIN vm_dynamic ON vm_dynamic.vm_guid = vm_static.vm_guid LEFT JOIN vds_groups ON vds_groups.vds_group_id = vm_static.vds_group_id WHERE quota_limitation.virtual_cpu IS NOT NULL AND quota_limitation.mem_size_mb IS NOT NULL GROUP BY quota_limitation.quota_id, quota_limitation.vds_group_id, vds_group_name, quota_limitation.virtual_cpu, quota_limitation.mem_size_mb, vm_static.quota_id, vds_groups.vds_group_id, vm_static.vds_group_id, quota_limitation.id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS all_storage_usage_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE all_storage_usage_rs AS ( quota_storage_id uuid, quota_id uuid, storage_id uuid, storage_name character varying(250), storage_size_gb bigint, storage_size_gb_usage double precision ); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION calculateAllStorageUsage() RETURNS SETOF all_storage_usage_rs STABLE AS $function$ BEGIN -- Summarize size of all disks that are active. RETURN QUERY SELECT quota_limitation.id AS quota_storage_id, quota_limitation.quota_id as quota_id, quota_limitation.storage_id as storage_id, storage_domain_static.storage_name, quota_limitation.storage_size_gb, cast(COALESCE(sum(size * cast(active as integer) + disk_image_dynamic.actual_size * cast((not active) as integer)) / 1073741824 ,0) as double precision) as storage_usage -- 1073741824 is 1024^3 (for GB) FROM quota_limitation LEFT JOIN image_storage_domain_map ON quota_limitation.quota_id = image_storage_domain_map.quota_id LEFT JOIN images ON images.image_guid = image_storage_domain_map.image_id LEFT JOIN disk_image_dynamic ON images.image_guid = disk_image_dynamic.image_id LEFT JOIN storage_domain_static ON image_storage_domain_map.storage_domain_id = storage_domain_static.id WHERE quota_limitation.storage_size_gb IS NOT NULL GROUP BY quota_limitation.quota_id, storage_id,quota_limitation.id,storage_domain_static.storage_name,quota_limitation.storage_size_gb; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CalculateStorageUsage(v_quota_id UUID, v_storage_id UUID) RETURNS double precision STABLE AS $function$ DECLARE v_virtual_size double precision; v_actual_size double precision; BEGIN -- Summarize size of all disks that are active. SELECT COALESCE(sum(size) / (1024 * 1024 * 1024),0) INTO v_virtual_size FROM disk_image_dynamic, images_storage_domain_view WHERE image_guid = disk_image_dynamic.image_id AND image_guid in (SELECT image_guid FROM images WHERE active = TRUE) AND quota_id = v_quota_id AND (v_storage_id = images_storage_domain_view.storage_id or v_storage_id IS NULL); -- Summarize the actual size of all the rest disks that are read only disks such as snapshots, not active, template disks. SELECT COALESCE(sum(disk_image_dynamic.actual_size) / (1024 * 1024 * 1024),0) INTO v_actual_size FROM disk_image_dynamic, images_storage_domain_view WHERE image_guid = disk_image_dynamic.image_id AND image_guid not in (SELECT image_guid FROM images i WHERE active = TRUE) AND quota_id = v_quota_id AND (v_storage_id = images_storage_domain_view.storage_id or v_storage_id IS NULL); RETURN v_actual_size + v_virtual_size; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function create_uuid_sequence() returns void as $procedure$ begin if not exists (select 1 from information_schema.sequences where sequence_schema = 'public' and sequence_name = 'uuid_sequence') then create sequence uuid_sequence increment by 1 start with 1; end if; end; $procedure$ language plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select create_uuid_sequence(); ************************** ********* QUERY ********** drop function create_uuid_sequence(); ************************** DROP FUNCTION ********* QUERY ********** create or replace function uuid_generate_v1() returns uuid STABLE as $procedure$ declare v_val bigint; v_4_part char(4); v_8_part char(8); v_12_part char(12); v_4_part_max int; begin -- The only part we should use modulo is the 4 digit part, all the -- rest are really big numbers (i.e 16^8 - 1 and 16^12 - 1) -- The use of round(random() * 1000 is for getting a different id -- for DC/Cluster in different installations v_4_part_max = 65535; -- this is 16^4 -1 v_val := nextval('uuid_sequence'); v_4_part := lpad(to_hex(v_val % v_4_part_max), 4, '0'); v_8_part := lpad(to_hex(v_val), 8, '0'); v_12_part := lpad(to_hex((v_val + (round(random() * 1000))::bigint)), 12, '0'); return v_8_part || v_4_part || v_4_part || v_4_part || v_12_part; end; $procedure$ language plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_get_comparable_ip_list(text) RETURNS inet[] IMMUTABLE STRICT AS $procedure$ BEGIN CASE WHEN ($1 IS NULL) OR ($1 ~ E'^\\s*$') THEN RETURN NULL; ELSE RETURN regexp_split_to_array(trim(both from $1), E'\\s+')::inet[]; END CASE; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_dedicated_hosts_ids_by_vm_id(v_vm_id UUID) RETURNS text STABLE AS $function$ BEGIN RETURN array_to_string(array_agg(vds_id), ',') FROM vm_host_pinning_map WHERE vm_id = v_vm_id; END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (not exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin insert into vdc_options (option_name, option_value, version) values (v_option_name, v_option_value, v_version); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value_all_versions(v_option_name varchar(100)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name)) then begin delete from vdc_options where option_name ilike v_option_name; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value(v_option_name varchar(100), v_version text) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)))) then begin delete from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_for_version(v_version text) returns void AS $procedure$ BEGIN delete from vdc_options where version in (select ID from fnSplitter(v_version)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin update vdc_options set option_value = v_option_value where option_name ilike v_option_name and version = v_version; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_default_config_value(v_option_name varchar(100),v_default_option_value varchar(4000),v_option_value varchar(4000),v_version varchar(40),v_ignore_default_value_case boolean) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin if (v_ignore_default_value_case) then update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value ilike v_default_option_value and version = v_version; else update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value = v_default_option_value and version = v_version; end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_rename_config_key(v_old_option_name varchar(100),v_new_option_name varchar(100),v_version varchar(40)) returns void AS $procedure$ DECLARE v_current_option_value varchar(4000); begin if (exists (select 1 from vdc_options where option_name ilike v_old_option_name and version = v_version)) then v_current_option_value:=option_value from vdc_options where option_name ilike v_old_option_name and version = v_version; update vdc_options set option_name = v_new_option_name, option_value = v_current_option_value where option_name ilike v_old_option_name and version = v_version; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'public' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'public' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'public' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'public' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and table_schema = 'public' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION attach_user_to_role ( v_user_name VARCHAR(255), v_domain VARCHAR(255), v_namespace VARCHAR(255), v_domain_entry_id text, v_role_name VARCHAR(255) ) RETURNS void AS $BODY$ DECLARE selected_user_id uuid; input_role_id uuid; BEGIN select roles.id into input_role_id from roles where roles.name = v_role_name; -- The external identifier is the user identifier converted to an array of -- bytes: insert into users(user_id,external_id, namespace,name,domain,username,last_admin_check_status) select uuid_generate_v1(), v_domain_entry_id, v_namespace, v_user_name, v_domain, v_user_name,true where not exists (select 1 from users where domain = v_domain and external_id = v_domain_entry_id); select user_id from users where domain = v_domain and external_id = v_domain_entry_id into selected_user_id; insert into permissions(id,role_id,ad_element_id,object_id,object_type_id) select uuid_generate_v1(), input_role_id, selected_user_id, getGlobalIds('system'), 1 where not exists(select role_id,ad_element_id,object_id,object_type_id from permissions where role_id = input_role_id and ad_element_id = selected_user_id and object_id= getGlobalIds('system') and object_type_id = 1); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(role_id,action_group_id) SELECT v_role_id, v_action_group_id WHERE NOT EXISTS (SELECT 1 FROM roles_groups WHERE role_id = v_role_id AND action_group_id = v_action_group_id); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) RETURNS void AS $BODY$ declare v_old_value varchar(4000); v_cur cursor for select distinct version from vdc_options where version <> 'general' order by version; v_version varchar(40); v_index integer; v_count integer; v_total_count integer; v_version_count integer; begin v_total_count := count(version) from vdc_options where option_name = v_option_name; v_old_value := option_value from vdc_options where option_name = v_option_name and version = 'general'; v_version_count := count(distinct version) from vdc_options where version <> 'general'; if (v_total_count <= v_version_count) then begin if (v_old_value IS NULL) then v_old_value := v_old_option_value; end if; v_count := count(distinct version) from vdc_options where version <> 'general'; v_index := 1; open v_cur; loop fetch v_cur into v_version; exit when not found; -- We shouldn't update if already exists if (not exists (select 1 from vdc_options where option_name = v_option_name and version = v_version)) then -- Might not work well for versions such as 3.10, but we currently don't have any if (v_version >= v_update_from_version) then insert into vdc_options (option_name, option_value, version) values (v_option_name, v_new_option_value, v_version); else insert into vdc_options (option_name, option_value, version) values (v_option_name, v_old_value, v_version); end if; end if; v_index := v_index +1; end loop; close v_cur; delete from vdc_options where option_name = v_option_name and version = 'general'; end; end if; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_grant_action_group_to_all_roles_filter(v_action_group_id integer, uuid[]) RETURNS void AS $BODY$ declare v_role_id_to_filter alias for $2; begin insert into roles_groups (role_id, action_group_id) select distinct role_id, v_action_group_id from roles_groups rg where not ARRAY [role_id] <@ v_role_id_to_filter and not exists (select 1 from roles_groups where role_id = rg.role_id and action_group_id = v_action_group_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_column_to_object_white_list(v_object_name varchar(128), v_column_name varchar(128)) returns void AS $procedure$ begin if (not exists (select 1 from object_column_white_list where object_name = v_object_name and column_name = v_column_name)) then begin -- verify that there is such object in db if exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = v_object_name and column_name = v_column_name) then insert into object_column_white_list (object_name, column_name) values (v_object_name, v_column_name); end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_disk(v_id UUID) returns void AS $procedure$ declare OK integer; LOCKED integer; begin OK:=1; LOCKED:=2; update images set imagestatus = OK where imagestatus = LOCKED and image_group_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_snapshot(v_id UUID) returns void AS $procedure$ declare OK varchar; LOCKED varchar; begin OK:='OK'; LOCKED:='LOCKED'; update snapshots set status = OK where status = LOCKED and snapshot_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_entity(v_object_type varchar(10), v_name varchar(255), v_recursive boolean) returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; v_id UUID; begin DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; --unlock images and snapshots if recursive flag is set if (v_recursive) then update images set imagestatus = OK where imagestatus = LOCKED and image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED and vm_id = v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_all() returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; BEGIN DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED; update vm_dynamic set status = DOWN where status = IMAGE_LOCKED; update images set imagestatus = OK where imagestatus = LOCKED; update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Displays DC id , DC name, SPM Host id , SPM Host name and number of async tasks awaiting. 1) create a record type with DC name, DC id, SPM host id, SPM host name, count 2) get all distinct DC ids from async_tasks table 3) Run a cursor for each result in 2) a) get DC name b) get SPM Host id & name if available c) get count of tasks return current record 4) return set of generated records */ DROP TYPE IF EXISTS async_tasks_info_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** create or replace FUNCTION fn_db_get_async_tasks() returns SETOF async_tasks_info_rs STABLE AS $procedure$ DECLARE v_record async_tasks_info_rs; -- selects storage_pool_id uuid found in async_tasks v_tasks_cursor cursor for select distinct storage_pool_id from async_tasks; begin OPEN v_tasks_cursor; FETCH v_tasks_cursor into v_record.dc_id; WHILE FOUND LOOP -- get dc_name and SPM Host id v_record.dc_name := name from storage_pool where id = v_record.dc_id; v_record.spm_host_id := spm_vds_id from storage_pool where id = v_record.dc_id; -- get Host name if we have non NULL SPM Host if (v_record.spm_host_id IS NOT NULL) then v_record.spm_host_name := vds_name from vds_static where vds_id = v_record.spm_host_id; else v_record.spm_host_name:=''; end if; -- get tasks count for this DC v_record.task_count := count(*) from async_tasks where position (cast(v_record.dc_id as varchar) in action_parameters) > 0; -- return the record RETURN NEXT v_record; FETCH v_tasks_cursor into v_record.dc_id; END LOOP; CLOSE v_tasks_cursor; -- return full set of generated records RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ DECLARE v varchar[]; e varchar; v_result varchar; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; FOR e in select unnest(v) LOOP IF (e != v_value) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_uuid_from_csv(v_csv_text text, v_uuid uuid) returns text STABLE AS $procedure$ DECLARE v uuid[]; e uuid; v_result text; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(v_csv_text, ','); FOR e in select unnest(v) LOOP IF (e != v_uuid) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; IF (v_result = '') THEN v_result := null; END IF; return v_result; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT setval('vdc_options_seq', max(option_id)) FROM vdc_options; ************************** ********* QUERY ********** SELECT setval('custom_actions_seq', max(action_id)) FROM custom_actions; ************************** ********* QUERY ********** SELECT setval('vdc_db_log_seq', max(error_id)) FROM vdc_db_log; ************************** ********* QUERY ********** SELECT setval('audit_log_seq', max(audit_log_id)) FROM audit_log; ************************** ********* QUERY ********** SELECT setval('schema_version_seq', max(id)) FROM schema_version; ************************** 1 ********* QUERY ********** /************************************************************************************ DATABASE APPLICATION CONFIGURATION FILE This file is used to update the vdc_options configuration table. The following sections are available: Add Section Update section (w/o overriding current value) Delete section - Deprecated, all config key removals should be done in an upgrade script! Split config section Simple upgrades not available using a fn_db* function call Complex upgrades using temporary functions In each section (except simple/function sections), entries are ordered by key, please keep this when modifing this file. PLEASE NOTE THAT THIS SCRIPT MUST REMAIN RE-ENTRANT! ************************************************************************************/ select fn_db_rename_config_key('AuditLogAgingThreashold', 'AuditLogAgingThreshold', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('ClientConsoleModeDefault', 'ClientModeSpiceDefault', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('PowerClientAutoApprovePatterns','AutoApprovePatterns','general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('PowerClientAutoRegistrationDefaultVdsGroupID','AutoRegistrationDefaultVdsGroupID','general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('PowerClientAutoInstallCertificateOnApprove','AutoInstallCertificateOnApprove','general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('UseSecureConnectionWithServers', 'EncryptHostCommunication', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('SpiceReleaseCursorKeys', 'ConsoleReleaseCursorKeys', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('SpiceToggleFullScreenKeys', 'ConsoleToggleFullScreenKeys', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('SSHInactivityTimoutSeconds', 'SSHInactivityTimeoutSeconds', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('SSHInactivityHardTimoutSeconds', 'SSHInactivityHardTimeoutSeconds', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('StorageDomainFalureTimeoutInMinutes', 'StorageDomainFailureTimeoutInMinutes', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VdsLoadBalancingeIntervalInMinutes', 'VdsLoadBalancingIntervalInMinutes', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VdsRecoveryTimeoutInMintues', 'VdsRecoveryTimeoutInMinutes', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('UknownTaskPrePollingLapse', 'UnknownTaskPrePollingLapse', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('GlusterAysncTasksSupport', 'GlusterAsyncTasksSupport', '3.0'); ************************** ********* QUERY ********** select fn_db_rename_config_key('GlusterAysncTasksSupport', 'GlusterAsyncTasksSupport', '3.1'); ************************** ********* QUERY ********** select fn_db_rename_config_key('GlusterAysncTasksSupport', 'GlusterAsyncTasksSupport', '3.2'); ************************** ********* QUERY ********** select fn_db_rename_config_key('GlusterAysncTasksSupport', 'GlusterAsyncTasksSupport', '3.3'); ************************** ********* QUERY ********** select fn_db_rename_config_key('NormalizedMgmgNetworkEnabled', 'NormalizedMgmtNetworkEnabled', '3.0'); ************************** ********* QUERY ********** select fn_db_rename_config_key('NormalizedMgmgNetworkEnabled', 'NormalizedMgmtNetworkEnabled', '3.1'); ************************** ********* QUERY ********** select fn_db_rename_config_key('NormalizedMgmgNetworkEnabled', 'NormalizedMgmtNetworkEnabled', '3.2'); ************************** ********* QUERY ********** select fn_db_rename_config_key('DefaultMtu', 'DefaultMTU', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('ManagementNetwork', 'DefaultManagementNetwork', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('FreeSpaceCriticalLowInGB','CriticalSpaceActionBlocker', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('FreeSpaceLow', 'WarningLowSpaceIndicator', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VmStatsEvents', 'VmStatsEventsSupported', '3.0'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VmStatsEvents', 'VmStatsEventsSupported', '3.1'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VmStatsEvents', 'VmStatsEventsSupported', '3.2'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VmStatsEvents', 'VmStatsEventsSupported', '3.3'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VmStatsEvents', 'VmStatsEventsSupported', '3.4'); ************************** ********* QUERY ********** select fn_db_rename_config_key('VmStatsEvents', 'VmStatsEventsSupported', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('AbortMigrationOnError', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value('BootstrapMinimalVdsmVersion','4.9','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CpuPinMigrationEnabled','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CpuPinningEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('AdminDomain','internal','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AdUserId','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AdUserName','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AdUserPassword','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AdvancedNFSOptionsEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('AffinityRulesEnforcementManagerEnabled', 'true', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AffinityRulesEnforcementManagerRegularInterval', '1', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AgentAppName','ovirt-guest-agent-common,ovirt-guest-agent','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AllowClusterWithVirtGlusterEnabled','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AllowDuplicateMacAddresses','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ApplicationMode','255','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AsyncCommandPollingLoopInSeconds','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AsyncCommandPollingRateInSeconds','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AsyncTaskPollingRate','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AsyncTaskStatusCacheRefreshRateInSeconds','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AsyncTaskStatusCachingTimeInMinutes','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AsyncTaskZombieTaskLifeInMinutes','300','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AuditLogAgingThreshold','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AuditLogCleanupTime','03:35:35','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CoCoLifeInMinutes','3000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CommandCoordinatorThreadPoolSize','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CommandEntityAgingThreshold','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CommandEntityCleanupTime','03:35:35','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OnlyRequiredNetworksMandatoryForVdsSelection','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AuthenticationMethod','LDAP','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoApprovePatterns','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoInstallCertificateOnApprove','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoRecoverySchedule','0 0/5 * * * ?','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoRegistrationDefaultVdsGroupID','99408929-82CF-4DC7-A532-9D998063FA95','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoRepoDomainRefreshTime','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('BlockMigrationOnSwapUsagePercentage','0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CipherSuite','DEFAULT','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ConfigDir','/etc/engine','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ConnectToServerTimeoutInSeconds','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClusterEmulatedMachines','rhel6.2.0,pc-1.0','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClusterEmulatedMachines','rhel6.3.0,pc-1.0','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClusterEmulatedMachines','rhel6.4.0,pc-1.0','3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClusterEmulatedMachines','rhel6.4.0,pc-1.0,pseries','3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ClusterEmulatedMachines','rhel6.5.0,pc-1.0,pseries','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClusterEmulatedMachines','pc-i440fx-rhel7.2.0,pc-i440fx-2.1,pseries-rhel7.2.0','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('CpuOverCommitDurationMinutes','2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DataDir','/usr/share/engine','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DBEngine','Postgres','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DebugTimerLogging','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultMaxThreadPoolSize','500','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultMinThreadPoolSize','50','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultMaxThreadWaitQueueSize','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultWindowsTimeZone','GMT Standard Time','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultGeneralTimeZone','Etc/GMT','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultWorkgroup','WORKGROUP','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DisableFenceAtStartupInSec','300','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DirectLUNDiskEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('PopulateDirectLUNDiskDescriptionWithLUNId','4','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DomainName','example.com','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableHostTimeDrift','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('RemoteViewerSupportedVersions','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('RemoteViewerNewerVersionUrl','${console_client_resources_url}','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableSpiceRootCertificateValidation','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableSwapCheck','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableUSBAsDefault','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableVdsLoadBalancing','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('BackupCheckPeriodInHours','6','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('BackupAlertPeriodInDays','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EngineMode','Active','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FailedJobCleanupTimeInMinutes','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceAgentDefaultParams','drac7:privlvl=OPERATOR,lanplus,delay=10;ilo3:lanplus,power_wait=4;ilo4:lanplus,power_wait=4','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CustomFenceAgentDefaultParams','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceAgentDefaultParamsForPPC','ilo3:lanplus=1,cipher=1,privlvl=administrator,power_wait=4;ilo4:ilanplus=1,cipher=1,privlvl=administrator,power_wait=4;ipmilan:lanplus=1,cipher=1,privlvl=administrator,power_wait=4','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CustomFenceAgentDefaultParamsForPPC','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceAgentMapping','drac7=ipmilan,ilo2=ilo,ilo3=ipmilan,ilo4=ipmilan','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CustomFenceAgentMapping','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CustomFencePowerWaitParam','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceProxyDefaultPreferences','cluster,dc','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceQuietTimeBetweenOperationsInSec','180','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceStartStatusDelayBetweenRetriesInSec','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceStartStatusRetries','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceStopStatusDelayBetweenRetriesInSec','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceStopStatusRetries','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FencePowerWaitParam','apc=power_wait,apc_snmp=power_wait,bladecenter=power_wait,cisco_ucs=power_wait,drac5=power_wait,drac7=power_wait,eps=delay,hpblade=power_wait,ilo=power_wait,ilo2=power_wait,ilo3=power_wait,ilo4=power_wait,ipmilan=power_wait,rsa=power_wait,rsb=power_wait,wti=power_wait','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FilteringLUNsEnabled','true','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('FindFenceProxyDelayBetweenRetriesInSec','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FindFenceProxyRetries','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CriticalSpaceActionBlocker','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('WarningLowSpaceIndicator','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VirtIoRngDeviceSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterHooksEnabled', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterHostUUIDSupport', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterRefreshHeavyWeight', 'false', '3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateHooks', '7200', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateLight', '5', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateHeavy', '300', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateStorageDevices', '7200', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterSupport', 'false', '3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterSupportForceCreateVolume', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterVolumeOptionGroupVirtValue','virt','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterVolumeOptionOwnerUserVirtValue','36','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterVolumeOptionOwnerGroupVirtValue','36','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateTasks', '60', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterAsyncTasksSupport', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterPeerStatusRetries', '2', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterTaskMinWaitForCleanupInMins', '10', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterGeoReplicationEnabled', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateGeoRepDiscoveryInSecs', '3600', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateGeoRepStatusInSecs', '300', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterVolumeSnapshotSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterRefreshRateSnapshotDiscovery', '300', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterMetaVolumeName', 'gluster_shared_storage', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterBrickProvisioningEnabled', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterStorageDeviceListMountPointsToIgnore','/,/home,/boot,/run/gluster/snaps/.*','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterStorageDeviceListFileSystemTypesToIgnore','swap','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlusterDefaultBrickMountPoint','/gluster-bricks','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterStopServicesSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterNetworkRoleSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('KeystoneAuthUrl', '', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GuestToolsSetupIsoPrefix','ovirt-guest-tools-','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HardwareInfoEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('HardwareInfoEnabled','false','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('HighUtilizationForEvenlyDistribute','75','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HighUtilizationForPowerSave','75','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostPreparingForMaintenanceIdleTime', '300', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostTimeDriftInSec','300','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HotPlugEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HotPlugCpuSupported', '{"x86_64":"false","ppc64":"false"}', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HotPlugCpuSupported', '{"x86_64":"true","ppc64":"false"}', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HotUnplugCpuSupported', '{"x86_64":"false","ppc64":"false"}', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HotPlugMemorySupported', '{"x86_64":"false","ppc64":"false"}', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('HotPlugMemorySupported', '{"x86_64":"true","ppc64":"false"}', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HotUnplugMemorySupported', '{"x86_64":"false","ppc64":"false"}', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxMemorySlots','16','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HotPlugMemoryMultiplicationSizeMb','256','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IsMigrationSupported','{"undefined": "true", "x86_64": "true", "ppc64" : "true" }','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IsMemorySnapshotSupported','{"undefined": "true", "x86_64": "true", "ppc64" : "true" }','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IsSuspendSupported','{"undefined": "true", "x86_64": "true", "ppc64" : "true" }','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MigrationSupportForNativeUsb', 'false', '3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('NetworkLinkingSupported', 'false', '3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('DisconnectPoolOnReconstruct','0,2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('InitStorageSparseSizeInGB','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('TunnelMigrationEnabled', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MigrationNetworkEnabled', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MultipleGatewaysSupported', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MemorySnapshotSupported', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('OsRepositoryConfDir','/osinfo.conf.d','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VirtIoScsiEnabled', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('NormalizedMgmtNetworkEnabled', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('IterationsWithBalloonProblem','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MomPoliciesOnHostSupported', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('NetworkQosSupported', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('StorageQosSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CpuQosSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HostNetworkQosSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CloudInitSupported', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultSysprepLocale','en_US','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ImportGlanceImageAsTemplate', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HotPlugDiskSnapshotSupported', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GetFileStats', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('DefaultRouteSupported', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SerialNumberPolicySupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ReportWhetherDomainMonitoringResultIsActual', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('OvfStoreOnAnyDomain', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('DataCenterWithoutSpm', 'false', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('BootMenuSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('IscsiMultipathingSupported', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ImportDataStorageDomain', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MixedDomainTypesInDataCenter', 'false', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ClusterRequiredRngSourcesDefault', '', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ClusterRequiredRngSourcesDefault', 'RANDOM', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SpiceCopyPasteToggleSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GraphicsDeviceEnabled','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SpiceFileTransferToggleSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('StoragePoolMemoryBackend', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('JsonProtocolSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VmSlaPolicySupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ReportedDisksLogicalNames', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('AutoConvergenceSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MigrationCompressionSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ImportVmFromExternalProviderSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('HostDevicePassthroughSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostDevicePassthroughCapabilities', 'pci,scsi,usb_device', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PackageNamesForCheckUpdate','vdsm,vdsm-cli','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UserPackageNamesForCheckUpdate','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostPackagesUpdateTimeInHours','24','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CertificationValidityCheckTimeInHours','24','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('LiveStorageMigrationBetweenDifferentStorageTypes', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VmStatsEventsSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxIoThreadsPerVm','127','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DisplayUncaughtUIExceptions', 'true', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SpiceProxyDefault','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('RemapCtrlAltDelDefault','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('IoThreadsSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MultipleGraphicsSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VirtioSerialConsoleSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('InstallVds','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IoOpTimeoutSec','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IPTablesConfig', '# oVirt default firewall configuration. Automatically generated by vdsm bootstrap script. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT # vdsm -A INPUT -p tcp --dport @VDSM_PORT@ -j ACCEPT # libvirt tls -A INPUT -p tcp --dport 16514 -j ACCEPT # SSH -A INPUT -p tcp --dport @SSH_PORT@ -j ACCEPT # guest consoles -A INPUT -p tcp -m multiport --dports 5900:6923 -j ACCEPT # migration -A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT # snmp -A INPUT -p udp --dport 161 -j ACCEPT # Reject any other input traffic -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -m physdev ! --physdev-is-bridged -j REJECT --reject-with icmp-host-prohibited COMMIT ','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IPTablesConfigForGluster', ' # glusterd -A INPUT -p tcp -m tcp --dport 24007 -j ACCEPT # gluster swift -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT # portmapper -A INPUT -p udp -m udp --dport 111 -j ACCEPT -A INPUT -p tcp -m tcp --dport 38465 -j ACCEPT -A INPUT -p tcp -m tcp --dport 38466 -j ACCEPT # nfs -A INPUT -p tcp -m tcp --dport 38467 -j ACCEPT -A INPUT -p tcp -m tcp --dport 2049 -j ACCEPT -A INPUT -p tcp -m tcp --dport 38469 -j ACCEPT # nrpe -A INPUT -p tcp --dport 5666 -j ACCEPT # status -A INPUT -p tcp -m tcp --dport 39543 -j ACCEPT -A INPUT -p tcp -m tcp --dport 55863 -j ACCEPT # nlockmgr -A INPUT -p tcp -m tcp --dport 38468 -j ACCEPT -A INPUT -p udp -m udp --dport 963 -j ACCEPT -A INPUT -p tcp -m tcp --dport 965 -j ACCEPT # ctdbd -A INPUT -p tcp -m tcp --dport 4379 -j ACCEPT # smbd -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT # Ports for gluster volume bricks (default 100 ports) # Needed for gluster < 3.4.0 that may be still handled by the engine -A INPUT -p tcp -m tcp --dport 24009:24108 -j ACCEPT # Ports for gluster volume bricks in Hyper Converged setup(default 100 ports) -A INPUT -p tcp -m tcp --dport 49217:49316 -j ACCEPT ','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IPTablesConfigForVirt', ' # libvirt tls -A INPUT -p tcp --dport 16514 -j ACCEPT # serial consoles -A INPUT -p tcp -m multiport --dports 2223 -j ACCEPT # guest consoles -A INPUT -p tcp -m multiport --dports 5900:6923 -j ACCEPT # migration -A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT ', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IPTablesConfigSiteCustom','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IsMultilevelAdministrationOn','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('JobCleanupRateInMinutes','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('JobPageSize','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LdapQueryPageSize','1000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LDAPQueryTimeout','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LDAPConnectTimeout','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LDAPOperationTimeout','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LDAPSecurityAuthentication','GSSAPI','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LDAPServerPort','389','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LdapServers','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LDAPProviderTypes','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LeaseRetries','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LeaseTimeSec','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LicenseCertificateFingerPrint','5f 38 41 89 b1 33 49 0c 24 13 6b b3 e5 ba 9e c7 fd 83 80 3b','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('LiveMergeSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value('LiveSnapshotEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('LockPolicy','ON','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LockRenewalIntervalSec','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogPhysicalMemoryThresholdInMB','1024','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogSwapMemoryThresholdInMB','1024','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LowUtilizationForEvenlyDistribute','0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LowUtilizationForPowerSave','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MacPoolRanges','00:1A:4A:16:01:51-00:1A:4A:16:01:e6','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ManagedDevicesWhiteList','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultManagementNetwork','ovirtmgmt','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxAuditLogMessageLength','10000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxBlockDiskSize','8192','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxLDAPQueryPartsNumber','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxMacsCountInPool','100000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxNumberOfHostsInStoragePool','250','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MaxNumOfCpuPerSocket', '16', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MaxNumOfThreadsPerCpu', '8', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxNumOfVmCpus','64','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MaxNumOfVmCpus', '160', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxNumOfVmCpus', '240', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MaxNumOfVmSockets', '16', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxRerunVmOnVdsCount','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxStorageVdsDelayCheckSec','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxStorageVdsTimeoutCheckSec','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxVdsMemOverCommit','200','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxVdsMemOverCommitForServers','150','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxVdsNameLength','255','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxVmNameLengthNonWindows','64','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxVmNameLengthWindows','15','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxVmsInPool','1000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MinimalETLVersion','3.0.0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('NativeUSBEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('NicDHCPDelayGraceInMS','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('NonVmNetworkSupported','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('NumberOfFailedRunsOnVds','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('NumberOfUSBSlots','4','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('NumberVmRefreshesBeforeSave','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SupportBridgesReportByVDSM','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('SupportBridgesReportByVDSM','false','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('TotalNetworkStatisticsReported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CfgEntriesDeprecated', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('MacAntiSpoofingFilterRulesSupported','false', '3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('MacAntiSpoofingFilterRulesSupported','false', '3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableMACAntiSpoofingFilterRules','true', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterFsStorageEnabled', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxSchedulerWeight','1000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MTUOverrideSupported','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('PortMirroringSupported', 'false', '3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('SpeedOptimizationSchedulingThreshold','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SchedulerAllowOverBooking','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SchedulerOverBookingThreshold','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UploadFileMaxTimeInMinutes','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('RetrieveDataMaxTimeInMinutes','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('StorageDomainOvfStoreCount','2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OrganizationName','oVirt','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OriginType','OVIRT','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OvfVirtualSystemType','ENGINE','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OvirtInitialSupportedIsoVersion','2.5.5:5.8','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OvirtIsoPrefix','^ovirt-node-iso-([0-9].*)\.iso$:^rhevh-([0-9].*)\.iso$','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OvirtNodeOS','^ovirt.*$:^rhev.*$','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('oVirtISOsRepositoryPath','/usr/share/ovirt-node-iso:/usr/share/rhev-hypervisor','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('oVirtUpgradeScriptName','/usr/share/vdsm-reg/vdsm-upgrade','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('oVirtUploadPath','/data/updates/ovirt-node-image.iso','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OvfUpdateIntervalInMinutes','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('OvfItemsCountPerUpdate','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PayloadSize','8192','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PMHealthCheckEnabled','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PMHealthCheckIntervalInSec','3600','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PosixStorageEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('PostgresI18NPrefix','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PostgresLikeSyntax','ILIKE','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PostgresPagingSyntax',E' OFFSET (%1$s -1) LIMIT %2$s','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PostgresPagingType','Offset','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PostgresSearchTemplate',E'SELECT * FROM (%2$s) %1$s) as T1 %3$s','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('PredefinedVMProperties', 'sap_agent=^(true|false)$;sndbuf=^[0-9]+$;vhost=^(([a-zA-Z0-9_]*):(true|false))(,(([a-zA-Z0-9_]*):(true|false)))*$;viodiskcache=^(none|writeback|writethrough)$', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('ProductRPMVersion','3.0.0.0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QuotaGraceStorage','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QuotaGraceVdsGroup','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QuotaThresholdStorage','80','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QuotaThresholdVdsGroup','80','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('RhevhLocalFSPath','/data/images/','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SANWipeAfterDelete','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SASL_QOP','auth-conf','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SearchResultsLimit','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SendSMPOnRunVm','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SendVmTicketUID','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64;','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64;','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64;','3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; :IBM POWER 7 v2.0:powernv,model_POWER7_v2.0:POWER7_v2.0:ppc64; :IBM POWER 7 v2.1:powernv,model_POWER7_v2.1:POWER7_v2.1:ppc64; :IBM POWER 7 v2.3:powernv,model_POWER7_v2.3:POWER7_v2.3:ppc64; :IBM POWER 7+ v2.1:powernv,model_POWER7+_v2.1:POWER7+_v2.1:ppc64; :IBM POWER8 v1.0:powernv,model_POWER8_v1.0:POWER8_v1.0:ppc64;','3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_power8:power8:ppc64;','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell-noTSX Family:vmx,nx,model_Haswell-noTSX:Haswell-noTSX:x86_64; 9:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 10:Intel Broadwell-noTSX Family:vmx,nx,model_Broadwell-noTSX:Broadwell-noTSX:x86_64; 11:Intel Broadwell Family:vmx,nx,model_Broadwell:Broadwell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_POWER8:POWER8:ppc64;','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('ServerRebootTimeout','300','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SetupNetworksPollingTimeout','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ShareableDiskEnabled','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value('SignCertTimeoutInSeconds','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SpiceDriverNameInGuest','RHEV-Spice','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ConsoleReleaseCursorKeys','shift+f12','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ConsoleToggleFullScreenKeys','shift+f11','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SpiceUsbAutoShare','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('WANDisableEffects','animation','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('WANColorDepth','16','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SpmCommandFailOverRetries','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SPMFailOverAttempts','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SpmVCpuConsumption','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SSHInactivityTimeoutSeconds','300','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SSHInactivityHardTimeoutSeconds','1800','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SSLEnabled','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('StorageDomainFailureTimeoutInMinutes','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('StorageDomainNameSizeLimit','50','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('StoragePoolNameSizeLimit','40','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('StoragePoolNonOperationalResetTimeoutInMin','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('StoragePoolRefreshTimeInSeconds','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostStorageConnectionAndPoolRefreshTimeInSeconds','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SucceededJobCleanupTimeInMinutes','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SupportedClusterLevels','3.0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SupportedVDSMVersions','4.9,4.10,4.11,4.12,4.13,4.14','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SupportForceCreateVG','false','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SupportForceExtendVG', 'false','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value('SysPrepDefaultPassword','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SysPrepDefaultUser','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ThrottlerMaxWaitForVdsUpdateInMillis','10000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('TimeoutToResetVdsInSeconds','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DelayResetForSpmInSeconds','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DelayResetPerVmInSeconds','0.5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EncryptHostCommunication','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsmSSLProtocol','TLSv1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ExternalCommunicationProtocol','TLSv1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsRequestQueueName','jms.topic.vdsm_requests','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsResponseQueueName','jms.topic.vdsm_responses','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IrsRequestQueueName','jms.topic.vdsm_irs_requests','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IrsResponseQueueName','jms.topic.vdsm_irs_responses','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EventQueueName','jms.queue.events','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('EventsSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('EventProcessingPoolSize','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('TimeToReduceFailedRunOnVdsInMinutes','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UnknownTaskPrePollingLapse','60000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UserSessionHardLimit','600','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('UserDefinedVMProperties', '','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('UserSessionTimeOutInterval','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UtilizationThresholdInPercent','80','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ValidNumOfMonitors','1,2,4','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VcpuConsumptionPercentage','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdcVersion','3.0.0.0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VDSAttemptsToResetCount','2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsCertificateValidityInYears','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('vdsConnectionTimeout','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsMaxConnectionsPerHost','2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('IrsMaxConnectionsPerHost','2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxTotalConnections','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VdsFenceOptionMapping','alom:secure=secure,port=ipport;apc:secure=secure,port=ipport,slot=port;bladecenter:secure=secure,port=ipport,slot=port;drac5:secure=secure,port=ipport;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port,encrypt_options=encrypt_options;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;drac7:;eps:slot=port;hpblade:port=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('CustomVdsFenceOptionMapping','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsFenceOptions','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsFenceOptionTypes','encrypt_options=bool,secure=bool,port=int,slot=int','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VdsFenceType','alom,apc,bladecenter,drac5,eps,ilo,ilo3,ipmilan,rsa,rsb,wti,cisco_ucs','3.1'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VdsFenceType','apc,apc_snmp,bladecenter,cisco_ucs,drac5,eps,ilo,ilo2,ilo3,ilo4,ipmilan,rsa,rsb,wti','3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VdsFenceType','apc,apc_snmp,bladecenter,cisco_ucs,drac5,drac7,eps,hpblade,ilo,ilo2,ilo3,ilo4,ipmilan,rsa,rsb,wti','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('CustomVdsFenceType','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('vdsHeartbeatInSeconds','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsLoadBalancingIntervalInMinutes','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsLocalDisksCriticallyLowFreeSpace','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsLocalDisksLowFreeSpace','500','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsRecoveryTimeoutInMinutes','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsRefreshRate','2','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('vdsRetries','0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ProtocolFallbackRetries','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ProtocolFallbackTimeoutInMilliSeconds','5000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsSelectionAlgorithm','None','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('vdsTimeout','180','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VM32BitMaxMemorySizeInMB','20480','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VM64BitMaxMemorySizeInMB','524288','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VM64BitMaxMemorySizeInMB','2097152','3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VM64BitMaxMemorySizeInMB','4096000','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VM64BitMaxMemorySizeInMB','4194304','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('VMPpc64BitMaxMemorySizeInMB','524288','3.0'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VMPpc64BitMaxMemorySizeInMB','2097152','3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VMPpc64BitMaxMemorySizeInMB','4096000','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('VMPpc64BitMaxMemorySizeInMB','1048576','3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmGracefulShutdownMessage','System Administrator has initiated shutdown of this Virtual Machine. Virtual Machine is shutting down.','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmGracefulShutdownTimeout','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VMMinMemorySizeInMB','256','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmPoolMaxSubsequentFailures','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmPoolMonitorBatchSize','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmPoolMonitorIntervalInMinutes','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmPoolMonitorMaxAttempts','3','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VmPriorityMaxValue','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoStartVmsRunnerIntervalInSeconds','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('RetryToRunAutoStartVmIntervalInSeconds','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxNumOfTriesToRunFailedAutoStartVm','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VncKeyboardLayout','en-us','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VncKeyboardLayoutValidValues','ar,da,de,de-ch,en-gb,en-us,es,et,fi,fo,fr,fr-be,fr-ca,fr-ch,hr,hu,is,it,ja,lt,lv,mk,nl,nl-be,no,pl,pt,pt-br,ru,sl,sv,th,tr','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('WaitForVdsInitInSec','60','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('NetworkConnectivityCheckTimeoutInSeconds','120','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoRecoveryAllowedTypes','{"storage domains":"true","hosts":"true"}','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClientModeSpiceDefault','Native','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClientModeVncDefault','Native','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ClientModeRdpDefault','Auto','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UseFqdnForRdpIfAvailable','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('WebSocketProxy','Off','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('WebSocketProxyTicketValiditySeconds','120','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogMaxPhysicalMemoryUsedThresholdInPercentage', '95', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogMaxSwapMemoryUsedThresholdInPercentage', '95', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogMaxCpuUsedThresholdInPercentage', '95', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogMaxNetworkUsedThresholdInPercentage', '95', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogMinFreeSwapThresholdInMB', '256', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('LogMaxSwapUsedThresholdInPercentage', '95', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SupportCustomDeviceProperties', 'false', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CustomDeviceProperties', '', '3.3'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CustomDeviceProperties', '{type=interface;prop={SecurityGroups=^(?:(?:[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}, *)*[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}|)$}}', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('NetworkCustomPropertiesSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('PreDefinedNetworkCustomProperties', $q$bridge_opts=^[^\s=]+=[^\s=]+(\s+[^\s=]+=[^\s=]+)*$$q$, '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('UserDefinedNetworkCustomProperties', '', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('UserDefinedNetworkCustomProperties', '', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SshSoftFencingCommand', 'service vdsmd restart', '3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SshSoftFencingCommand', '/usr/bin/vdsm-tool service-restart vdsmd', '3.6'); ************************** ********* QUERY ********** select fn_db_add_config_value('SecureConnectionWithOATServers','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('PollUri','AttestationService/resources/PollHosts','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AttestationTruststore','TrustStore.jks','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AttestationPort','8443','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AttestationTruststorePass','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AttestationServer','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AttestationFirstStageSize','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxAverageNetworkQoSValue','1024','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxPeakNetworkQoSValue','2048','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxBurstNetworkQoSValue','10240','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('MaxHostNetworkQosShares', '100', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UserMessageOfTheDay','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QoSInboundAverageDefaultValue','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QoSInboundPeakDefaultValue','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QoSInboundBurstDefaultValue','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QoSOutboundAverageDefaultValue','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QoSOutboundPeakDefaultValue','10','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('QoSOutboundBurstDefaultValue','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SingleQxlPciEnabled','false','3.2'); ************************** ********* QUERY ********** select fn_db_add_config_value('ExternalSchedulerServiceURL','http://localhost:18781/','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ExternalSchedulerConnectionTimeout','100','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ExternalSchedulerEnabled','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ExternalSchedulerResponseTimeout','120000','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DwhHeartBeatInterval', '30', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DisconnectDwh', '0', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlanceImageListSize','20','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('GlanceImageTotalListSize','500','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CinderProviderSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('MigrateDowntimeSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GlusterVolumeInfoSupported', 'false', '3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('OverUtilizationForHaReservation','200','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ScaleDownForHaReservation','1','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('EnableVdsHaReservation','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('VdsHaReservationIntervalInMinutes','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultMaximumMigrationDowntime','0','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('ChangePasswordMsg','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultSerialNumberPolicy','HOST_ID','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultCustomSerialNumber','Dummy serial number.','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultMTU', '1500', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceKdumpDestinationAddress','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceKdumpDestinationPort','7410','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceKdumpMessageInterval','5','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('FenceKdumpListenerTimeout','90','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('KdumpStartedTimeout','30','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AlertOnNumberOfLVs','300','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CSRFProtection','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CORSSupport','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('CORSAllowedOrigins','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UsageHistoryLimit','40', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('SkipFencingIfSDActiveSupported', 'false', '3.4'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostStorageLeaseAliveCheckingInterval', '90', 'general'); ************************** ********* QUERY ********** select fn_db_add_config_value('SupportNUMAMigration','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('UnsupportedLocalesFilter','','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultAutoConvergence','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('DefaultMigrationCompression','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('NetworkSriovSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('RefreshLunSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostedEngineVmName','HostedEngine','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AutoImportHostedEngine','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('HostedEngineStorageDomainName','hosted_storage','general'); ************************** ********* QUERY ********** select fn_db_add_config_value('AllowEditingHostedEngine','true','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('ChangeNetworkUnderBridgeInUseSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('NetworkExclusivenessPermissiveValidation','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('GetDeviceListWithoutStatusSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('InitialSizeSparseDiskSupported','false','3.5'); ************************** ********* QUERY ********** select fn_db_add_config_value('CheckMixedRhelVersions','false','general'); ************************** ********* QUERY ********** select fn_db_add_config_value_for_versions_up_to('CheckMixedRhelVersions','true','3.5'); ************************** ********* QUERY ********** select fn_db_update_config_value('AutoRecoveryAllowedTypes','{"storage domains":"true","hosts":"true"}','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('BootstrapMinimalVdsmVersion','4.9','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('DBEngine','Postgres','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('DefaultTimeZone','(GMT) GMT Standard Time','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceAgentDefaultParams','drac7:privlvl=OPERATOR,lanplus=1,delay=10;ilo3:lanplus=1,power_wait=4;ilo4:lanplus=1,power_wait=4;ilo_ssh:secure=1','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceAgentDefaultParamsForPPC','ilo3:lanplus=1,cipher=1,privlvl=administrator,power_wait=4,retry_on=2;ilo4:ilanplus=1,cipher=1,privlvl=administrator,power_wait=4,retry_on=2;ipmilan:lanplus=1,cipher=1,privlvl=administrator,power_wait=4,retry_on=2;ilo_ssh:secure=1','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceAgentMapping','drac7=ipmilan,ilo2=ilo,ilo3=ipmilan,ilo4=ipmilan','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceStartStatusDelayBetweenRetriesInSec','10','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceStartStatusRetries','18','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceStopStatusDelayBetweenRetriesInSec','10','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FenceStopStatusRetries','18','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('FencePowerWaitParam','apc=power_wait,apc_snmp=power_wait,bladecenter=power_wait,cisco_ucs=power_wait,drac5=power_wait,drac7=power_wait,eps=delay,hpblade=power_wait,ilo=power_wait,ilo2=power_wait,ilo3=power_wait,ilo4=power_wait,ilo_ssh=power_wait,ipmilan=power_wait,rsa=power_wait,rsb=power_wait,wti=power_wait','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IPTablesConfig',' # oVirt default firewall configuration. Automatically generated by vdsm bootstrap script. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT # vdsm -A INPUT -p tcp --dport @VDSM_PORT@ -j ACCEPT # rpc.statd -A INPUT -p tcp --dport 111 -j ACCEPT -A INPUT -p udp --dport 111 -j ACCEPT # SSH -A INPUT -p tcp --dport @SSH_PORT@ -j ACCEPT # snmp -A INPUT -p udp --dport 161 -j ACCEPT # Cockpit -A INPUT -p tcp --dport 9090 -j ACCEPT @CUSTOM_RULES@ # Reject any other input traffic -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -m physdev ! --physdev-is-bridged -j REJECT --reject-with icmp-host-prohibited COMMIT ','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IPTablesConfigForGluster', ' # glusterd -A INPUT -p tcp -m tcp --dport 24007 -j ACCEPT # gluster swift -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT # portmapper -A INPUT -p tcp -m tcp --dport 38465 -j ACCEPT -A INPUT -p tcp -m tcp --dport 38466 -j ACCEPT # nfs -A INPUT -p tcp -m tcp --dport 38467 -j ACCEPT -A INPUT -p tcp -m tcp --dport 2049 -j ACCEPT -A INPUT -p tcp -m tcp --dport 38469 -j ACCEPT # nrpe -A INPUT -p tcp --dport 5666 -j ACCEPT # status -A INPUT -p tcp -m tcp --dport 39543 -j ACCEPT -A INPUT -p tcp -m tcp --dport 55863 -j ACCEPT # nlockmgr -A INPUT -p tcp -m tcp --dport 38468 -j ACCEPT -A INPUT -p udp -m udp --dport 963 -j ACCEPT -A INPUT -p tcp -m tcp --dport 965 -j ACCEPT # ctdbd -A INPUT -p tcp -m tcp --dport 4379 -j ACCEPT # smbd -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT # Ports for gluster volume bricks (default 100 ports) # Needed for Gluster < 3.4.0 compatibility -A INPUT -p tcp -m tcp --dport 24009:24108 -j ACCEPT # Ports required for GlusterFS brick processes have changed in # glusterfs 3.4.0 from 24009 onwards to 49152 onwards. -A INPUT -p tcp -m tcp --dport 49152:49251 -j ACCEPT # Ports for gluster volume bricks in Hyper Converged setup(default 100 ports) -A INPUT -p tcp -m tcp --dport 49217:49316 -j ACCEPT ','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IPTablesConfigForVirt', ' # libvirt tls -A INPUT -p tcp --dport 16514 -j ACCEPT # serial consoles -A INPUT -p tcp -m multiport --dports 2223 -j ACCEPT # guest consoles -A INPUT -p tcp -m multiport --dports 5900:6923 -j ACCEPT # migration -A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT ', 'general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IsMultilevelAdministrationOn','true','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('MaxNumOfVmCpus','64','3.0'); ************************** ********* QUERY ********** select fn_db_update_config_value('MaxNumOfVmCpus','160','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('MaxNumOfVmCpus','160','3.2'); ************************** ********* QUERY ********** select fn_db_update_config_value('MigrationSupportForNativeUsb','false','3.0'); ************************** ********* QUERY ********** select fn_db_update_config_value('MigrationSupportForNativeUsb','false','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('MinimalETLVersion','3.6.0','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('OvirtInitialSupportedIsoVersion','2.5.5:5.8','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('OvirtIsoPrefix','^ovirt-node-iso-([0-9].*)\.iso$:^rhevh-([0-9].*)\.iso$','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('OvirtNodeOS','^ovirt.*$:^rhev.*$','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('oVirtISOsRepositoryPath','/usr/share/ovirt-node-iso:/usr/share/rhev-hypervisor','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('PostgresPagingSyntax','OFFSET (%1$s -1) LIMIT %2$s','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('PostgresSearchTemplate','SELECT * FROM (%2$s) %1$s) as T1 %3$s','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('RhevhLocalFSPath','/data/images/rhev','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64;','3.0'); ************************** ********* QUERY ********** select fn_db_update_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64;','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64;','3.2'); ************************** ********* QUERY ********** select fn_db_update_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; :IBM POWER 7 v2.0:powernv,model_POWER7_v2.0:POWER7_v2.0:ppc64; :IBM POWER 7 v2.1:powernv,model_POWER7_v2.1:POWER7_v2.1:ppc64; :IBM POWER 7 v2.3:powernv,model_POWER7_v2.3:POWER7_v2.3:ppc64; :IBM POWER 7+ v2.1:powernv,model_POWER7+_v2.1:POWER7+_v2.1:ppc64; :IBM POWER8 v1.0:powernv,model_POWER8_v1.0:POWER8_v1.0:ppc64;','3.3'); ************************** ********* QUERY ********** select fn_db_update_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_power8:power8:ppc64;','3.4'); ************************** ********* QUERY ********** select fn_db_update_config_value('ServerCPUList','3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_power8:power8:ppc64;','3.5'); ************************** ********* QUERY ********** select fn_db_update_config_value('ClusterEmulatedMachines','rhel6.4.0,pc-1.0,pseries','3.3'); ************************** ********* QUERY ********** select fn_db_update_config_value('ClusterEmulatedMachines','pc-i440fx-rhel7.2.0,pc-i440fx-2.1,pseries-rhel7.2.0','3.6'); ************************** ********* QUERY ********** select fn_db_update_config_value('SpiceDriverNameInGuest','{"windows": "RHEV-Spice", "linux" : "xorg-x11-drv-qxl" }','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('SupportedClusterLevels','3.0,3.1,3.2,3.3,3.4,3.5,3.6','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('SupportedStorageFormats','0,2,3','3.1,3.2,3.3,3.4,3.5,3.6'); ************************** ********* QUERY ********** select fn_db_update_config_value('SupportedVDSMVersions','4.9,4.10,4.11,4.12,4.13,4.14,4.15,4.16,4.17','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdcVersion','3.6.0.0','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('ProductRPMVersion','3.6.0.0','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','alom:secure=secure,port=ipport;apc:secure=secure,port=ipport,slot=port;bladecenter:secure=secure,port=ipport,slot=port;drac5:secure=secure,port=ipport;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.0'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','alom:secure=secure,port=ipport;apc:secure=secure,port=ipport,slot=port;bladecenter:secure=secure,port=ipport,slot=port;drac5:secure=secure,port=ipport;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.2'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;eps:slot=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.3'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;drac7:;eps:slot=port;hpblade:port=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.4'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port,encrypt_options=encrypt_options;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;drac7:;eps:slot=port;hpblade:port=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.5'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceOptionMapping','apc:secure=secure,port=ipport,slot=port;apc_snmp:port=port,encrypt_options=encrypt_options;bladecenter:secure=secure,port=ipport,slot=port;cisco_ucs:secure=ssl,slot=port;drac5:secure=secure,slot=port;drac7:;eps:slot=port;hpblade:port=port;ilo:secure=ssl,port=ipport;ipmilan:;ilo2:secure=ssl,port=ipport;ilo3:;ilo4:;ilo_ssh:port=port;rsa:secure=secure,port=ipport;rsb:;wti:secure=secure,port=ipport,slot=port','3.6'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceType','alom,apc,bladecenter,drac5,eps,ilo,ilo3,ipmilan,rsa,rsb,wti,cisco_ucs','3.0'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceType','alom,apc,bladecenter,drac5,eps,ilo,ilo3,ipmilan,rsa,rsb,wti,cisco_ucs','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceType','apc,apc_snmp,bladecenter,cisco_ucs,drac5,eps,ilo,ilo2,ilo3,ilo4,ipmilan,rsa,rsb,wti','3.2'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceType','apc,apc_snmp,bladecenter,cisco_ucs,drac5,drac7,eps,hpblade,ilo,ilo2,ilo3,ilo4,ipmilan,rsa,rsb,wti','3.4'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceType','apc,apc_snmp,bladecenter,cisco_ucs,drac5,drac7,eps,hpblade,ilo,ilo2,ilo3,ilo4,ipmilan,rsa,rsb,wti','3.5'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsFenceType','apc,apc_snmp,bladecenter,cisco_ucs,drac5,drac7,eps,hpblade,ilo,ilo2,ilo3,ilo4,ilo_ssh,ipmilan,rsa,rsb,wti','3.6'); ************************** ********* QUERY ********** select fn_db_update_config_value('VdsRefreshRate','3','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('VmGracefulShutdownMessage','System Administrator has initiated shutdown of this Virtual Machine. Virtual Machine is shutting down.','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('DisconnectPoolOnReconstruct','0,2,3','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('SupportBridgesReportByVDSM','false','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('AgentAppName','ovirt-guest-agent-common,ovirt-guest-agent','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('VM64BitMaxMemorySizeInMB','2097152','3.1'); ************************** ********* QUERY ********** select fn_db_update_config_value('VM64BitMaxMemorySizeInMB','2097152','3.2'); ************************** ********* QUERY ********** select fn_db_update_config_value('VM64BitMaxMemorySizeInMB','2097152','3.3'); ************************** ********* QUERY ********** select fn_db_update_config_value('VM64BitMaxMemorySizeInMB','4096000','3.4'); ************************** ********* QUERY ********** select fn_db_update_config_value('VM64BitMaxMemorySizeInMB','4096000','3.5'); ************************** ********* QUERY ********** select fn_db_update_config_value('VM64BitMaxMemorySizeInMB','4194304','3.6'); ************************** ********* QUERY ********** select fn_db_update_config_value('AutoStartVmsRunnerIntervalInSeconds','1','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('AllowEditingHostedEngine','true','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IsMigrationSupported','{"undefined": "true", "x86_64": "true", "ppc64" : "true" }','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IsMemorySnapshotSupported','{"undefined": "true", "x86_64": "true", "ppc64" : "true" }','general'); ************************** ********* QUERY ********** select fn_db_update_config_value('IsSuspendSupported','{"undefined": "true", "x86_64": "true", "ppc64" : "true" }','general'); ************************** ********* QUERY ********** select fn_db_update_default_config_value('AdUserId','example.com:00000000-0000-0000-0000-000000000000','','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('AdUserName','example.com:SampleUser','','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('AdUserPassword','example.com:SamplePassword','','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('AsyncTaskZombieTaskLifeInMinutes','300','3000','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('DomainName','example.com','','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('LDAPSecurityAuthentication','GSSAPI','default:GSSAPI','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('LDAPSecurityAuthentication','SIMPLE','default:SIMPLE','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('VdsLocalDisksCriticallyLowFreeSpace','100','500','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('VdsLocalDisksLowFreeSpace','1000', '100','general',false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('GuestToolsSetupIsoPrefix','RHEV-toolsSetup_', 'ovirt-guest-tools-','general', false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('vdsConnectionTimeout', '180', '2', 'general', false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('vdsRetries', '3', '0', 'general', false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('VdsmSSLProtocol','SSLv3','TLSv1','general', false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('ExternalCommunicationProtocol','SSLv3','TLSv1','general', false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('ServerCPUList', '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell-noTSX Family:vmx,nx,model_Haswell-noTSX:Haswell-noTSX:x86_64; 9:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 10:Intel Broadwell-noTSX Family:vmx,nx,model_Broadwell-noTSX:Broadwell-noTSX:x86_64; 11:Intel Broadwell Family:vmx,nx,model_Broadwell:Broadwell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER 8:powernv,model_power8:power8:ppc64; 4:IBM POWER 8E:powernv,model_power8e:power8e:ppc64;', '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell-noTSX Family:vmx,nx,model_Haswell-noTSX:Haswell-noTSX:x86_64; 9:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 10:Intel Broadwell-noTSX Family:vmx,nx,model_Broadwell-noTSX:Broadwell-noTSX:x86_64; 11:Intel Broadwell Family:vmx,nx,model_Broadwell:Broadwell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_POWER8:POWER8:ppc64;', '3.6', FALSE); ************************** ********* QUERY ********** select fn_db_update_default_config_value('GlusterStorageDeviceListMountPointsToIgnore','/,/home,/boot,/run/gluster/snaps/.*', '/,/home,/boot,/run/gluster/snaps/.*,/var/run/gluster/snaps/.*','general', false); ************************** ********* QUERY ********** select fn_db_update_default_config_value('vdsHeartbeatInSeconds','10','30','general',false); ************************** ********* QUERY ********** select fn_db_rename_config_key('MaxVmNameLengthNonWindows', 'MaxVmNameLength', 'general'); ************************** ********* QUERY ********** select fn_db_rename_config_key('MaxVmNameLengthWindows', 'MaxVmNameLengthSysprep', 'general'); ************************** ********* QUERY ********** select fn_db_update_default_config_value('vdsConnectionTimeout','2','20','general',false); ************************** ********* QUERY ********** select fn_db_add_config_value('UseHostNameIdentifier', 'false', 'general'); ************************** ********* QUERY ********** select fn_db_split_config_value('SpiceSecureChannels','smain,sinputs','smain,sinputs,scursor,splayback,srecord,sdisplay,susbredir,ssmartcard', '3.1'); ************************** ********* QUERY ********** select fn_db_split_config_value('GlusterTunedProfile', 'rhs-high-throughput,rhs-virtualization', 'rhgs-sequential-io,rhgs-random-io', '3.6'); ************************** ********* QUERY ********** update vdc_options set version = '3.0' where version = '2.3'; ************************** UPDATE 0 ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_upgrade_remove_default_security_auth(a_input VARCHAR(40)) RETURNS void AS $BODY$ DECLARE v_entry VARCHAR(4000); v_pos integer; BEGIN v_entry := option_value FROM vdc_options WHERE option_name='LDAPSecurityAuthentication'; v_pos := strpos(lower(v_entry), ',' || lower(a_input) || ','); IF (v_pos = 0) THEN UPDATE vdc_options SET option_value = regexp_replace(option_value, ',?' || a_input || ',?' ,'','i') WHERE option_name = 'LDAPSecurityAuthentication'; ELSE UPDATE vdc_options SET option_value = regexp_replace(option_value, ',' || a_input || ',' ,',','i') WHERE option_name = 'LDAPSecurityAuthentication'; END IF; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_upgrade_remove_default_security_auth('default:GSSAPI'); ************************** ********* QUERY ********** SELECT __temp_upgrade_remove_default_security_auth('default:SIMPLE'); ************************** ********* QUERY ********** DROP FUNCTION __temp_upgrade_remove_default_security_auth(VARCHAR); ************************** DROP FUNCTION ********* QUERY ********** create or replace function __temp_update_ldap_provier_types() RETURNS void AS $procedure$ DECLARE v_domains text; v_provider_types text; v_temp text; v_values record; boo smallint; BEGIN v_temp := ''; v_domains := (SELECT option_value FROM vdc_options where option_name = 'DomainName'); v_provider_types := (SELECT option_value FROM vdc_options where option_name = 'LDAPProviderTypes'); boo := (SELECT count(*) from regexp_matches(v_provider_types ,'[:]')); IF (boo = 0) THEN FOR v_values in select regexp_split_to_table(v_domains, ',') as val LOOP IF (length(v_values.val) > 0) THEN v_temp := v_temp || v_values.val || ':general,'; END IF; END LOOP; v_temp = rtrim(v_temp,','); UPDATE vdc_options SET option_value = v_temp where option_name = 'LDAPProviderTypes'; END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_update_ldap_provier_types(); ************************** ********* QUERY ********** DROP FUNCTION __temp_update_ldap_provier_types(); ************************** DROP FUNCTION ********* QUERY ********** create or replace function __temp_set_pg_major_release() RETURNS void AS $procedure$ DECLARE v_pg_major_release char(1); BEGIN -- the folowing evaluates currently to 8 on PG 8.x and to 9 on PG 9.x v_pg_major_release:=substring ((string_to_array(version(),' '))[2],1,1); perform fn_db_add_config_value('PgMajorRelease',v_pg_major_release,'general'); -- ensure that if PG was upgraded we will get the right value perform fn_db_update_config_value('PgMajorRelease',v_pg_major_release,'general'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_set_pg_major_release(); ************************** ********* QUERY ********** DROP FUNCTION __temp_set_pg_major_release(); ************************** DROP FUNCTION ********* QUERY ********** /********************************************************************************************** Currently we have a bug that upgarde 03010250 was cherry-picked and installed after 03010130 This caused all scripts between 03010140 and 03010240 not to run. This scripts removes the 03010250 from schema_version and updates 03010130 to be the curent version So, after that , all scripts from 03010140 and up will run Since 03010250 was a configuration change that is already handled in the new config.sql, no other handling is needed. **********************************************************************************************/ update schema_version set current = true where version = '03010130' and exists(select 1 from schema_version where version = '03010250' and current = true); ************************** UPDATE 0 ********* QUERY ********** delete from schema_version where version = '03010250' and current = true; ************************** DELETE 0 ********* QUERY ********** select fn_db_add_column('vds_dynamic','supported_engines','varchar(40)'); ************************** ********* QUERY ********** CREATE FUNCTION __temp__0030_add_materialized_views_table() RETURNS VOID AS $procedure$ BEGIN IF not exists (select 1 from information_schema.tables where table_schema = 'public' and table_name ='materialized_views') then CREATE TABLE materialized_views ( mv_name NAME NOT NULL PRIMARY KEY, v_name NAME NOT NULL, refresh_rate_in_sec INTEGER, last_refresh TIMESTAMP WITH TIME ZONE, avg_cost_ms int not null default 0 ); END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp__0030_add_materialized_views_table(); ************************** ********* QUERY ********** DROP FUNCTION __temp__0030_add_materialized_views_table(); ************************** DROP FUNCTION ********* QUERY ********** select fn_db_add_column('materialized_views', 'min_refresh_rate_in_sec', 'int default 0'); ************************** ********* QUERY ********** select fn_db_add_column('materialized_views', 'custom', 'boolean default false'); ************************** ********* QUERY ********** select fn_db_add_column('materialized_views', 'active', 'boolean default true'); ************************** ********* QUERY ********** ALTER TABLE schema_version ALTER COLUMN installed_by TYPE varchar(63); ************************** ALTER TABLE ********* QUERY ********** /* This file adds Snapshot Materialized Views support to Postgres. A Snapshot Materialized View is actually a table built on top of a real view that enables to select data from the Snapshot Materialized View easily and efficiently. Candidates for Snapshot Materialized Views are views that are based on slowly-changing data. The Snapshot Materialized Views is actually functioning as a cache. The Snapshot Materialized View is refreshed per request. The Snapshot Materialized View definitions are stored in the materialized_views table. Flow: 1) Create the Materialized View by calling: CreateMaterializedView - if you are creating a new view CreateMaterializedViewAs - If you want to preserve the original view name in this case the original view will be renamed and the new Materialized View will have the original view name. The following should be called for Custom Materialized Views CreateCustomMaterializedView CreateCustomMaterializedViewAs 2) If your Snapshot Materialized View is my_mt you should create Stored Procedures: MtDropmy_mtIndexes - Drops indexes on my_mt MtCreatemy_mtIndexes - Creates needed indexes on my_mt Those indexes should be defined in the "Snapshot Materialized Views Index Definitions Section" in post_upgrade/0020_create_materialized_views.sql file. Those SP are called automatically when a Snapshot Materialized View is refreshed to boost refresh performance. 3) You can call IsMaterializedViewRefreshed to check if it is time to refresh the view and if yes call RefreshMaterializedView manually. or You can define a cron job that calls RefreshAllMaterializedViews that loops over all Snapshot Materialized Views and refreshes it automatically RefreshAllMaterializedViews recieves a boolean v_force flag, please set this flag to false when calling it from a cron job in order to update the materialized views only when needed. (This SP is called with v_force = true after create/upgrade DB) There are also additional functions : CreateAllMaterializedViewsiIndexes - Creates indexes for all Snapshot Materialized views DropMaterializedView - Drops the Materialized View DropAllMaterializedViews - Drop all Materialized Views DropAllCustomMaterializedViews - Drop all custom Materialized Views UpdateMaterializedViewRefreshRate - Updates the Materialized View refresh rate UpdateMaterializedViewMinRefreshRate - Updates the Materialized View minimal refresh rate ActivateMaterializedView - activates/decativates a Materialized View ActivateAllMaterializedViews - activates/decativates all Materialized Views In addition, you can create a file named create_materialized_views.sql under dbscripts/upgrade/post_upgrade/custom/ This file may include other custom materialized views settings and is executed by the create/upgrade database scripts. NOTE : Materialized Views are automatically refreshed upon create/upgrade */ CREATE OR REPLACE FUNCTION to_interval (sec INTEGER) RETURNS INTERVAL AS $$ BEGIN RETURN (sec || ' seconds')::INTERVAL; END; $$ LANGUAGE 'plpgsql' IMMUTABLE STRICT; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_custom BOOLEAN, v_min_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF FOUND THEN RAISE EXCEPTION 'Materialized view % already exists.', v_matview; END IF; IF current_user != usename from pg_database , pg_user where datdba=usesysid and datname=current_database THEN RAISE EXCEPTION 'Materialized view % should be created with user ''engine''.', v_matview; END IF; EXECUTE 'REVOKE ALL ON ' || v_view_name || ' FROM PUBLIC'; EXECUTE 'GRANT SELECT ON ' || v_view_name || ' TO PUBLIC'; EXECUTE 'CREATE TABLE ' || v_matview || ' AS SELECT * FROM ' || v_view_name; EXECUTE 'REVOKE ALL ON ' || v_matview || ' FROM PUBLIC'; EXECUTE 'GRANT SELECT ON ' || v_matview || ' TO PUBLIC'; INSERT INTO materialized_views (mv_name, v_name, refresh_rate_in_sec, last_refresh, custom, min_refresh_rate_in_sec) VALUES (v_matview, v_view_name, v_refresh_rate_in_sec, CURRENT_TIMESTAMP, v_custom, v_min_refresh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, false, v_min_refresh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, true, v_min_refresh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, false, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, true, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_custom BOOLEAN, v_min_refesh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; v_renamed_view NAME; BEGIN IF FOUND THEN RAISE EXCEPTION 'Materialized view % already exists.', v_view_name; END IF; v_renamed_view := v_view_name || '_mt_base'; EXECUTE 'ALTER VIEW ' || v_view_name || ' RENAME TO ' || v_renamed_view; perform CreateMaterializedView(v_view_name, v_renamed_view, v_refresh_rate_in_sec, v_custom, v_min_refesh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refesh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, false, v_min_refesh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refesh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, true, v_min_refesh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, false, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, true, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DropMaterializedView(v_matview NAME) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; EXECUTE 'DROP TABLE ' || v_matview || ' CASCADE'; DELETE FROM materialized_views WHERE mv_name=v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DropAllMaterializedViews() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views; v_record materialized_views%ROWTYPE; BEGIN OPEN v_cur; -- loop on all entries in materialized_views LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; perform DropMaterializedView(v_record.mv_name); END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DropAllCustomMaterializedViews() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views where custom; v_record materialized_views%ROWTYPE; BEGIN OPEN v_cur; -- loop on all entries in materialized_views LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; perform DropMaterializedView(v_record.mv_name); END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION IsMaterializedViewRefreshed(v_matview NAME) RETURNS boolean STABLE AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; v_is_refreshed boolean; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; -- check if materialized View should refresh v_is_refreshed := (((CURRENT_TIMESTAMP - to_interval(refresh_rate_in_sec)) <= last_refresh) and ((CURRENT_TIMESTAMP - to_interval(min_refresh_rate_in_sec)) <= last_refresh)) or not active from materialized_views where mv_name = v_matview; RETURN v_is_refreshed; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION RefreshMaterializedView(v_matview NAME) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; v_drop_index_sp NAME; v_create_index_sp NAME; v_start_time TIMESTAMP WITH TIME ZONE; v_avg_cost_ms int; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; -- get start time v_start_time:=CURRENT_TIMESTAMP; -- SP for Drop / create Index should follow naming convention Mt[Drop|Create]Indexes v_drop_index_sp := 'MtDrop' || v_matview || 'Indexes'; v_create_index_sp := 'MtCreate' || v_matview || 'Indexes'; IF NOT EXISTS (select 1 from information_schema.routines where routine_name ilike v_drop_index_sp) THEN v_drop_index_sp := NULL; END IF; IF NOT EXISTS (select 1 from information_schema.routines where routine_name ilike v_create_index_sp) THEN v_create_index_sp := NULL; END IF; -- Lock materialized_views table until refresh completes to prevent duplicate refreshes by other threads LOCK TABLE materialized_views; -- taking a lock on the snapshot materialized view until it refreshed EXECUTE 'LOCK TABLE ' || v_matview; -- drop indexes on the snapshot materialized view if exists IF (v_drop_index_sp IS NOT NULL) THEN EXECUTE 'select ' || v_drop_index_sp || '()'; END IF; -- refresh the view EXECUTE 'TRUNCATE TABLE ' || v_matview; EXECUTE 'INSERT INTO ' || v_matview || ' SELECT * FROM ' || v_entry.v_name; -- restore indexes on the snapshot materialized view if exists IF (v_create_index_sp IS NOT NULL) THEN EXECUTE 'select ' || v_create_index_sp || '()'; END IF; -- update last refresh time and average cost in [ms] IF (v_entry.avg_cost_ms = 0) THEN v_avg_cost_ms:=EXTRACT(EPOCH FROM current_timestamp - v_start_time) * 1000; ELSE v_avg_cost_ms:=((EXTRACT(EPOCH FROM current_timestamp - v_start_time) * 1000) + v_entry.avg_cost_ms)/2; END IF; update materialized_views set last_refresh = CURRENT_TIMESTAMP, avg_cost_ms = v_avg_cost_ms where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION RefreshAllMaterializedViews(v_force boolean) RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views; v_record materialized_views%ROWTYPE; BEGIN OPEN v_cur; -- loop on all entries in materialized_views and refresh only needed snapshots LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; IF ((v_force and v_record.min_refresh_rate_in_sec = 0) or not IsMaterializedViewRefreshed(v_record.mv_name)) THEN perform RefreshMaterializedView(v_record.mv_name); END IF; END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateAllMaterializedViewsiIndexes() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views; v_record materialized_views%ROWTYPE; v_create_index_sp NAME; BEGIN OPEN v_cur; -- loop on all entries in materialized_views and create indexes(if defined) LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; v_create_index_sp := 'MtCreate' || v_record.mv_name || 'Indexes'; -- Check if SP that creates the indexes exists IF NOT EXISTS (select 1 from information_schema.routines where routine_name ilike v_create_index_sp) THEN v_create_index_sp := NULL; END IF; IF (v_create_index_sp IS NOT NULL) THEN EXECUTE 'select ' || v_create_index_sp || '()'; END IF; END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateMaterializedViewRefreshRate(v_matview NAME, v_refresh_rate INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; update materialized_views set refresh_rate_in_sec = v_refresh_rate where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateMaterializedViewMinRefreshRate(v_matview NAME, v_min_refresh_rate INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; update materialized_views set min_refresh_rate_in_sec = v_min_refresh_rate where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION ActivateMaterializedView(v_matview NAME, v_active BOOLEAN) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; update materialized_views set active = v_active where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION ActivateAllMaterializedViews(v_active BOOLEAN) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN update materialized_views set active = v_active; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select DropAllMaterializedViews(); ************************** ********* QUERY ********** copy ( select version from schema_version where current = true order by id LIMIT 1 ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd5ffb43021d6bf95736bb419dce86e8e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'instance_type_id', 'uuid default null'); ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'image_type_id', 'uuid default null'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040010'), 'upgrade/03_04_0010_add_instance_type_to_vm.sql', 'd5ffb43021d6bf95736bb419dce86e8e', 'engine', cast(trim('2016-07-12 18:23:20.786336-04') as timestamp), cast(trim('2016-07-12 18:23:20.869001-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8ec875e63637626cd1fc34bfbee16f43' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_insert_predefined_roles_03_03_instance_types() RETURNS VOID AS $procedure$ DECLARE v_INSTANCE_CREATOR_ID UUID; v_USER_INSTANCE_MANAGER_ID UUID; BEGIN v_INSTANCE_CREATOR_ID := 'DEF00011-0000-0000-0000-DEF000000011'; v_USER_INSTANCE_MANAGER_ID := 'DEF00012-0000-0000-0000-DEF000000012'; ------------------------ -- ADD INSTANCE_CREATOR role ------------------------ DELETE FROM roles_groups WHERE role_id = v_INSTANCE_CREATOR_ID; INSERT INTO roles(id,name,description,is_readonly,role_type,allows_viewing_children,app_mode) select v_INSTANCE_CREATOR_ID, 'InstanceCreator', 'User Role, permission to create Instances', true, 2, false, 1 WHERE NOT EXISTS (SELECT id FROM roles WHERE id = v_INSTANCE_CREATOR_ID); -- Add CREATE_INSTANCE(16) PERFORM fn_db_add_action_group_to_role(v_INSTANCE_CREATOR_ID,16); -- Add CREATE_DISK(1100) PERFORM fn_db_add_action_group_to_role(v_INSTANCE_CREATOR_ID,1100); -- Add LOGIN(1300) PERFORM fn_db_add_action_group_to_role(v_INSTANCE_CREATOR_ID,1300); ------------------------ -- ADD USER_INSTANCE_MANAGER role ------------------------ DELETE FROM roles_groups WHERE role_id = v_USER_INSTANCE_MANAGER_ID; INSERT INTO roles(id,name,description,is_readonly,role_type,allows_viewing_children,app_mode) select v_USER_INSTANCE_MANAGER_ID, 'UserInstanceManager', 'User Role, with permission for any operation on Instances', true, 2, false, 1 WHERE NOT EXISTS (SELECT id FROM roles WHERE id = v_USER_INSTANCE_MANAGER_ID); -- Add DELETE_VM(2) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,2); -- Add EDIT_VM_PROPERTIES(3) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,3); -- Add VM_BASIC_OPERATIONS(4) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,4); -- Add CHANGE_VM_CD(5) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,5); -- Add CONNECT_TO_VM(7) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,7); -- Add IMPORT_EXPORT_VM(8) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,8); -- Add CONFIGURE_VM_STORAGE(10) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,10); -- Add MANIPULATE_VM_SNAPSHOTS(12) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,12); -- Add CREATE_DISK(1100) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,1100); -- Add ATTACH_DISK(1101) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,1101); -- Add EDIT_DISK_PROPERTIES(1102) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,1102); -- Add DELETE_DISK(1104) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,1104); -- Add LOGIN(1300) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,1300); -- Add MANIPULATE_PERMISSIONS(502) PERFORM fn_db_add_action_group_to_role(v_USER_INSTANCE_MANAGER_ID,502); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_insert_predefined_roles_03_03_instance_types(); ************************** ********* QUERY ********** DROP function __temp_insert_predefined_roles_03_03_instance_types(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040020'), 'upgrade/03_04_0020_add_instance_permissions.sql', '8ec875e63637626cd1fc34bfbee16f43', 'engine', cast(trim('2016-07-12 18:23:20.910503-04') as timestamp), cast(trim('2016-07-12 18:23:21.01071-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '63f31857c334677cfc8b042234c86bde' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics', 'ha_score', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040030'), 'upgrade/03_04_0030_add_ha_score_to_vds_statistics.sql', '63f31857c334677cfc8b042234c86bde', 'engine', cast(trim('2016-07-12 18:23:21.051991-04') as timestamp), cast(trim('2016-07-12 18:23:21.211107-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3f254a4a85bf40f17bfc1c6ea4ef74de' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('e659c871-0bf1-4ccc-b748-f28f5d08dffd', 'HA', true, NULL, 0, true, 'Runs the hosted engine VM only on hosts with a positive score'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('98e92667-6161-41fb-b3fa-34f820ccbc4b', 'HA', true, NULL, 1, true, 'Weights hosts according to their HA score'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 'e659c871-0bf1-4ccc-b748-f28f5d08dffd', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 'e659c871-0bf1-4ccc-b748-f28f5d08dffd', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 'e659c871-0bf1-4ccc-b748-f28f5d08dffd', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040040'), 'upgrade/03_04_0040_add_ha_policy_units.sql', '3f254a4a85bf40f17bfc1c6ea4ef74de', 'engine', cast(trim('2016-07-12 18:23:21.252029-04') as timestamp), cast(trim('2016-07-12 18:23:21.502369-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3977c2b068b9d22d903f7a0925406e37' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set os = 5 where os = 100; ************************** UPDATE 0 ********* QUERY ********** update vm_static set os = 1 where os = 200; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040050'), 'upgrade/03_04_0050_move_rename_of_other_linux_type.sql', '3977c2b068b9d22d903f7a0925406e37', 'engine', cast(trim('2016-07-12 18:23:21.543646-04') as timestamp), cast(trim('2016-07-12 18:23:21.570387-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c9786a3a67d5ffa23f14cb45be3168d2' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_device', 'snapshot_id', 'UUID REFERENCES SNAPSHOTS(snapshot_id) ON DELETE CASCADE DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040060'), 'upgrade/03_04_0060_add_snapshot_id_column_to_vm_device.sql', 'c9786a3a67d5ffa23f14cb45be3168d2', 'engine', cast(trim('2016-07-12 18:23:21.610285-04') as timestamp), cast(trim('2016-07-12 18:23:21.668882-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0190b94f2e7a07126c36c28fcc6359f6' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_network_external_id ON network(provider_network_external_id) WHERE provider_network_external_id IS NOT NULL; ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040070'), 'upgrade/03_04_0070_index_network_by_external_id.sql', '0190b94f2e7a07126c36c28fcc6359f6', 'engine', cast(trim('2016-07-12 18:23:21.709964-04') as timestamp), cast(trim('2016-07-12 18:23:21.835341-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2e8edf8df1b23008e2840c909e91ec7d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_BRICK_STATUS_CHANGED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040080'), 'upgrade/03_04_0080_add_brick_status_change_event_map.sql', '2e8edf8df1b23008e2840c909e91ec7d', 'engine', cast(trim('2016-07-12 18:23:21.876935-04') as timestamp), cast(trim('2016-07-12 18:23:21.926731-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3bc1a28250bafafd865ff0a41de80330' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_move_quota_id() RETURNS void AS $FUNCTION$ BEGIN IF (NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' AND table_name ILIKE 'image_storage_domain_map' AND column_name ILIKE 'quota_id')) THEN -- add quota id column to the image-storage map table PERFORM fn_db_add_column('image_storage_domain_map','quota_id', 'UUID NULL'); -- copy old quota from images table UPDATE image_storage_domain_map SET quota_id = (SELECT quota_id FROM images WHERE image_id = image_guid); -- create a FK to quota table to that column ALTER TABLE image_storage_domain_map ADD CONSTRAINT fk_image_storage_domain_map_quota FOREIGN KEY (quota_id) REFERENCES quota(id) ON DELETE SET NULL; -- remove quota_id column from images table PERFORM fn_db_drop_column ('images', 'quota_id'); END IF; END; $FUNCTION$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_move_quota_id(); ************************** ********* QUERY ********** DROP FUNCTION __temp_move_quota_id(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040090'), 'upgrade/03_04_0090_move_quota_id.sql', '3bc1a28250bafafd865ff0a41de80330', 'engine', cast(trim('2016-07-12 18:23:21.968445-04') as timestamp), cast(trim('2016-07-12 18:23:22.077475-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b3e0f09287c328e5f77b4675878158a3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_add_host_permissions_to_gluster_admin_role() RETURNS VOID AS $procedure$ DECLARE v_GLUSTER_ADMIN_ROLE_ID UUID; BEGIN v_GLUSTER_ADMIN_ROLE_ID := 'DEF0000b-0000-0000-0000-DEF00000000b'; --CREATE_CLUSTER INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 400 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=400); --EDIT_CLUSTER_CONFIGURATION INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 401 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=401); --DELETE_CLUSTER INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 402 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=402); --CONFIGURE_CLUSTER_NETWORK INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 403 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=403); --ASSIGN_CLUSTER_NETWORK INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 404 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=404); --CREATE_HOST INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 100 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=100); --EDIT_HOST_CONFIGURATION INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 101 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=101); --DELETE_HOST INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 102 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=102); --MANIPULATE_HOST INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 103 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=103); --CONFIGURE_HOST_NETWORK INSERT INTO roles_groups(role_id,action_group_id) SELECT v_GLUSTER_ADMIN_ROLE_ID, 104 WHERE not exists (SELECT role_id, action_group_id FROM roles_groups WHERE role_id=v_GLUSTER_ADMIN_ROLE_ID and action_group_id=104); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_add_host_permissions_to_gluster_admin_role(); ************************** ********* QUERY ********** drop function __temp_add_host_permissions_to_gluster_admin_role(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040100'), 'upgrade/03_04_0100_add_cluster_host_permissions_to_gluster_admin_role.sql', 'b3e0f09287c328e5f77b4675878158a3', 'engine', cast(trim('2016-07-12 18:23:22.11881-04') as timestamp), cast(trim('2016-07-12 18:23:22.218781-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3dea9bd8eff3161611809d8098113344' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units SET name='OptimalForPowerSaving' WHERE id='736999d0-1023-46a4-9a75-1316ed50e151'; ************************** UPDATE 1 ********* QUERY ********** UPDATE policy_units SET name='OptimalForPowerSaving' WHERE id='736999d0-1023-46a4-9a75-1316ed50e15b'; ************************** UPDATE 1 ********* QUERY ********** UPDATE policy_units SET name='OptimalForEvenDistribution' WHERE id='7db4ab05-81ab-42e8-868a-aee2df483ed2'; ************************** UPDATE 1 ********* QUERY ********** UPDATE policy_units SET name='OptimalForEvenDistribution' WHERE id='7db4ab05-81ab-42e8-868a-aee2df483edb'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040110'), 'upgrade/03_04_0110_change_policy_names.sql', '3dea9bd8eff3161611809d8098113344', 'engine', cast(trim('2016-07-12 18:23:22.260068-04') as timestamp), cast(trim('2016-07-12 18:23:22.385082-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '92cfbf51b3c7ec8b7237174dafe81a27' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'gluster_version', 'varchar(4000)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040120'), 'upgrade/03_04_0120_add_gluster_version_to_vds_dynamic.sql', '92cfbf51b3c7ec8b7237174dafe81a27', 'engine', cast(trim('2016-07-12 18:23:22.426917-04') as timestamp), cast(trim('2016-07-12 18:23:22.485556-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '37e6eaabbc3266ff3c83f8aed1d3258b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DROP INDEX if exists IDX_job_start_time; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_job_start_time ON job(start_time); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040130'), 'upgrade/03_04_0130_add_start_time_idx_job.sql', '37e6eaabbc3266ff3c83f8aed1d3258b', 'engine', cast(trim('2016-07-12 18:23:22.526835-04') as timestamp), cast(trim('2016-07-12 18:23:22.677026-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e1a08bba589ea13cc0408f619813ac6a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'sso_method', 'VARCHAR(32) NOT NULL DEFAULT ''guest_agent'''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040140'), 'upgrade/03_04_0140_add_sso_method_to_vm_static.sql', 'e1a08bba589ea13cc0408f619813ac6a', 'engine', cast(trim('2016-07-12 18:23:22.719036-04') as timestamp), cast(trim('2016-07-12 18:23:23.04477-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e9d8210d28a0de4fe945732a2a81fe64' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_REBALANCE_FINISHED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_MIGRATE_BRICK_DATA_FINISHED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040150'), 'upgrade/03_04_0150_gluster_async_tasks_finished_event_map.sql', 'e9d8210d28a0de4fe945732a2a81fe64', 'engine', cast(trim('2016-07-12 18:23:23.08514-04') as timestamp), cast(trim('2016-07-12 18:23:23.17675-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '07093445ebe47847f6849a6b25ffbdeb' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_insert_read_only_admin_role() RETURNS VOID AS $procedure$ DECLARE v_ROLE_ID UUID; BEGIN v_ROLE_ID := 'DEF0000C-0000-0000-0000-DEF00000000C'; DELETE FROM roles_groups WHERE role_id = v_ROLE_ID; INSERT INTO roles(id,name,description,is_readonly,role_type,allows_viewing_children,app_mode) SELECT v_ROLE_ID, 'ReadOnlyAdmin', 'Read Only Administrator Role', true, 1, true, 1 WHERE NOT EXISTS (SELECT id,name,description,is_readonly,role_type FROM roles WHERE id = v_ROLE_ID AND name='ReadOnlyAdmin' AND description='Read Only Administrator Role' AND is_readonly=true AND role_type=1); -- Allowing this role to login INSERT INTO roles_groups(role_id,action_group_id) VALUES(v_ROLE_ID, 1300); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_insert_read_only_admin_role(); ************************** ********* QUERY ********** DROP function __temp_insert_read_only_admin_role(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040160'), 'upgrade/03_04_0160_create_read_only_admin_role.sql', '07093445ebe47847f6849a6b25ffbdeb', 'engine', cast(trim('2016-07-12 18:23:23.210372-04') as timestamp), cast(trim('2016-07-12 18:23:23.310462-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0926c4fc405221786acc97eb50e9c2c1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'architecture', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** UPDATE vds_groups SET architecture = 1 where cpu_name is not NULL and architecture = 0; ************************** UPDATE 0 ********* QUERY ********** UPDATE vds_groups AS c SET architecture = 1 WHERE c.cpu_name is null and exists (select 1 from vm_static where vm_static.vds_group_id = c.vds_group_id and vm_static.vm_guid != '00000000-0000-0000-0000-000000000000'); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040170'), 'upgrade/03_04_0170_add_architecture_name_column.sql', '0926c4fc405221786acc97eb50e9c2c1', 'engine', cast(trim('2016-07-12 18:23:23.352101-04') as timestamp), cast(trim('2016-07-12 18:23:23.669072-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '28661ac96b720f6b002774695b833607' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'optimization_type', 'smallint default 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040180'), 'upgrade/03_04_0180_add_vds_group_optimization_field.sql', '28661ac96b720f6b002774695b833607', 'engine', cast(trim('2016-07-12 18:23:23.71064-04') as timestamp), cast(trim('2016-07-12 18:23:23.97786-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3ebfb0d2f0e35b190a8f1f1b4609ae9f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_REMOVE_BRICKS_STOP', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_REMOVE_BRICKS_STOP_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040190'), 'upgrade/03_04_0190_gluster_async_tasks_stop_remove-brick_event_map.sql', '3ebfb0d2f0e35b190a8f1f1b4609ae9f', 'engine', cast(trim('2016-07-12 18:23:24.018701-04') as timestamp), cast(trim('2016-07-12 18:23:24.093675-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0f399f7c05ca20c59ee991367f9b103c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_REBALANCE_START_DETECTED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('START_REMOVING_GLUSTER_VOLUME_BRICKS_DETECTED_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040200'), 'upgrade/03_04_0200_gluster_async_tasks_fromcli_event_map.sql', '0f399f7c05ca20c59ee991367f9b103c', 'engine', cast(trim('2016-07-12 18:23:24.135327-04') as timestamp), cast(trim('2016-07-12 18:23:24.210438-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ae8fd303c8c87051c514b0d12616591a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE storage_domain_static SET storage_type = 0 WHERE storage_type = -1; ************************** UPDATE 0 ********* QUERY ********** UPDATE storage_pool SET storage_pool_type = 0 WHERE storage_pool_type = -1; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040210'), 'upgrade/03_04_0210_replace_storage_type_all_with_unknown.sql', 'ae8fd303c8c87051c514b0d12616591a', 'engine', cast(trim('2016-07-12 18:23:24.252021-04') as timestamp), cast(trim('2016-07-12 18:23:24.326826-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1929e483fac20e769027989048620c55' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('VM_CONSOLE_CONNECTED', ''); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('VM_CONSOLE_DISCONNECTED', ''); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('VM_SET_TICKET', ''); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040220'), 'upgrade/03_04_0220_add_console_events.sql', '1929e483fac20e769027989048620c55', 'engine', cast(trim('2016-07-12 18:23:24.368504-04') as timestamp), cast(trim('2016-07-12 18:23:24.468513-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7c6181c01c67e1f099f9b19dba982d51' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('VM_DOWN_ERROR', ''); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('VDS_INITIATED_RUN_VM_FAIL', ''); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040230'), 'upgrade/03_04_0230_vm_down_error_and_vds_initiated_run_fail_event_map.sql', '7c6181c01c67e1f099f9b19dba982d51', 'engine', cast(trim('2016-07-12 18:23:24.510391-04') as timestamp), cast(trim('2016-07-12 18:23:24.585103-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b278b951715db212dbf8d0c9ea312aef' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_REBALANCE_NOT_FOUND_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('REMOVE_GLUSTER_VOLUME_BRICKS_NOT_FOUND_FROM_CLI', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040240'), 'upgrade/03_04_0240_gluster_async_tasks_notfound_fromcli_event_map.sql', 'b278b951715db212dbf8d0c9ea312aef', 'engine', cast(trim('2016-07-12 18:23:24.627035-04') as timestamp), cast(trim('2016-07-12 18:23:24.701771-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'be0fd40be801a2ebffcf029e356a2500' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** alter table users add column active boolean not null default false; ************************** ALTER TABLE ********* QUERY ********** update users set active = status::boolean; ************************** UPDATE 0 ********* QUERY ********** alter table users drop column status; ************************** ALTER TABLE ********* QUERY ********** alter table ad_groups add column active boolean not null default false; ************************** ALTER TABLE ********* QUERY ********** update ad_groups set active = status::boolean; ************************** UPDATE 1 ********* QUERY ********** alter table ad_groups drop column status; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040250'), 'upgrade/03_04_0250_rename_user_and_group_status_to_active.sql', 'be0fd40be801a2ebffcf029e356a2500', 'engine', cast(trim('2016-07-12 18:23:24.735307-04') as timestamp), cast(trim('2016-07-12 18:23:25.368958-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8a5004294554af4d4930ae73075e5302' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** alter table ad_groups add column external_id bytea not null default ''; ************************** ALTER TABLE ********* QUERY ********** update ad_groups set external_id = decode(replace(id::text, '-', ''), 'hex'); ************************** UPDATE 1 ********* QUERY ********** select fn_db_create_constraint('ad_groups', 'groups_domain_external_id_unique', 'unique (domain, external_id)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040260'), 'upgrade/03_04_0260_add_external_id_to_groups.sql', '8a5004294554af4d4930ae73075e5302', 'engine', cast(trim('2016-07-12 18:23:25.410494-04') as timestamp), cast(trim('2016-07-12 18:23:25.769027-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2413e4ae02d943619a0a8a91d9c6b970' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX IDX_gluster_bricks_task_id ON gluster_volume_bricks(task_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040270'), 'upgrade/03_04_0270_add_task_id_idx_gluster_bricks.sql', '2413e4ae02d943619a0a8a91d9c6b970', 'engine', cast(trim('2016-07-12 18:23:25.81075-04') as timestamp), cast(trim('2016-07-12 18:23:25.93573-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c3ebb0eeb63fa4a066ef3f6a6e5ded8e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'original_template_id', 'UUID default null'); ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'original_template_name', 'VARCHAR(255) default null'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040280'), 'upgrade/03_04_0280_add_original_template_to_vm_static.sql', 'c3ebb0eeb63fa4a066ef3f6a6e5ded8e', 'engine', cast(trim('2016-07-12 18:23:25.977319-04') as timestamp), cast(trim('2016-07-12 18:23:26.377847-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd760094f81a4819b019e89e48cb03971' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'spice_proxy', 'varchar(255)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_pools', 'spice_proxy', 'varchar(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040290'), 'upgrade/03_04_0290_add_spice_proxy_to_vds_groups_and_vm_pools.sql', 'd760094f81a4819b019e89e48cb03971', 'engine', cast(trim('2016-07-12 18:23:26.426803-04') as timestamp), cast(trim('2016-07-12 18:23:26.518487-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3c77e70807009c3aa5d0f015c806a2da' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('network', 'label', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040300'), 'upgrade/03_04_0300_add_label_column_to_networks.sql', '3c77e70807009c3aa5d0f015c806a2da', 'engine', cast(trim('2016-07-12 18:23:26.551663-04') as timestamp), cast(trim('2016-07-12 18:23:26.618439-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6ae3a6405c257409eaea6785380a32c6' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_interface', 'labels', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040310'), 'upgrade/03_04_0310_add_labels_column_to_vds_interfaces.sql', '6ae3a6405c257409eaea6785380a32c6', 'engine', cast(trim('2016-07-12 18:23:26.66004-04') as timestamp), cast(trim('2016-07-12 18:23:26.726722-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '95fe97ead68a20188cdd60aba6db219b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics','anonymous_hugepages', 'INTEGER NULL'); ************************** ********* QUERY ********** UPDATE vds_statistics vs SET anonymous_hugepages = (SELECT anonymous_hugepages FROM vds_dynamic vd WHERE vs.vds_id = vd.vds_id); ************************** UPDATE 0 ********* QUERY ********** select fn_db_drop_column ('vds_dynamic', 'anonymous_hugepages'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040320'), 'upgrade/03_04_0320_move_anonymousHugePages.sql', '95fe97ead68a20188cdd60aba6db219b', 'engine', cast(trim('2016-07-12 18:23:26.768517-04') as timestamp), cast(trim('2016-07-12 18:23:26.868496-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6f98be3b8fb3d715ecf9ff8f1747fcbb' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_add_admin_operations_action_groups() RETURNS void AS $BODY$ DECLARE v_roles_to_filter_out uuid[]; v_TAG_MANAGER_ROLE_ID uuid; v_BOOKMARK_MANAGER_ROLE_ID uuid; v_EVENT_NOTIFICATION_MANAGER_ROLE_ID uuid; BEGIN v_TAG_MANAGER_ROLE_ID := 'DEF00011-0000-0000-0000-DEF000000013'; v_BOOKMARK_MANAGER_ROLE_ID := 'DEF00011-0000-0000-0000-DEF000000014'; v_EVENT_NOTIFICATION_MANAGER_ROLE_ID := 'DEF00011-0000-0000-0000-DEF000000015'; -- We only add these action groups to ADMIN roles that have an action group that isn't the login permissions one v_roles_to_filter_out := array(select id from roles where role_type = 2 or (exists (select * from roles_groups where role_id = id) and not exists (select * from roles_groups where role_id = id and action_group_id != 1300))); -- Adding the TAG_MANAGEMENT action group perform fn_db_grant_action_group_to_all_roles_filter(1301, v_roles_to_filter_out); -- Adding the BOOKMARK_MANAGEMENT action group perform fn_db_grant_action_group_to_all_roles_filter(1302, v_roles_to_filter_out); -- Adding the EVENT_NOTIFICATION_MANAGEMENT action group perform fn_db_grant_action_group_to_all_roles_filter(1303, v_roles_to_filter_out); -- Adding the TagManager role DELETE FROM roles_groups WHERE role_id = v_TAG_MANAGER_ROLE_ID; INSERT INTO roles(id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) SELECT v_TAG_MANAGER_ROLE_ID, 'TagManager', 'Tag Manager', true, 1, false, 255 WHERE NOT EXISTS (SELECT id FROM roles WHERE id = v_TAG_MANAGER_ROLE_ID); INSERT INTO roles_groups values(v_TAG_MANAGER_ROLE_ID, 1301); INSERT INTO roles_groups values(v_TAG_MANAGER_ROLE_ID, 1300); -- Adding the BookmarkManager role DELETE FROM roles_groups WHERE role_id = v_BOOKMARK_MANAGER_ROLE_ID; INSERT INTO roles(id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) SELECT v_BOOKMARK_MANAGER_ROLE_ID, 'BookmarkManager', 'Bookmark Manager', true, 1, false, 255 WHERE NOT EXISTS (SELECT id FROM roles WHERE id = v_BOOKMARK_MANAGER_ROLE_ID); INSERT INTO roles_groups values(v_BOOKMARK_MANAGER_ROLE_ID, 1302); INSERT INTO roles_groups values(v_BOOKMARK_MANAGER_ROLE_ID, 1300); -- Adding the EventNotificationManager role DELETE FROM roles_groups WHERE role_id = v_EVENT_NOTIFICATION_MANAGER_ROLE_ID; INSERT INTO roles(id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) SELECT v_EVENT_NOTIFICATION_MANAGER_ROLE_ID, 'EventNotificationManager', 'Event Notification Manager', true, 1, false, 255 WHERE NOT EXISTS (SELECT id FROM roles WHERE id = v_EVENT_NOTIFICATION_MANAGER_ROLE_ID); INSERT INTO roles_groups values(v_EVENT_NOTIFICATION_MANAGER_ROLE_ID, 1303); INSERT INTO roles_groups values(v_EVENT_NOTIFICATION_MANAGER_ROLE_ID, 1300); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_add_admin_operations_action_groups(); ************************** ********* QUERY ********** drop function __temp_add_admin_operations_action_groups(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040330'), 'upgrade/03_04_0330_add_admin_operations_action_groups_and_roles.sql', '6f98be3b8fb3d715ecf9ff8f1747fcbb', 'engine', cast(trim('2016-07-12 18:23:26.901567-04') as timestamp), cast(trim('2016-07-12 18:23:27.018393-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ff56ce3cf88976e4c561dfb7e48355c7' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_add_action_groups_of_network_labels_03_04_0340() RETURNS VOID AS $procedure$ DECLARE v_SUPER_USER_ID_0001 UUID; v_DATA_CENTER_ADMIN_ID UUID; v_NETWORK_ADMIN_ID UUID; v_HOST_ADMIN_ID UUID; BEGIN v_SUPER_USER_ID_0001 := '00000000-0000-0000-0000-000000000001'; v_DATA_CENTER_ADMIN_ID := 'DEF00002-0000-0000-0000-DEF000000002'; v_NETWORK_ADMIN_ID := 'DEF00005-0000-0000-0000-DEF000000005'; v_HOST_ADMIN_ID := 'DEF00004-0000-0000-0000-DEF000000004'; ------------------------------------------------ --- Update existing roles with new Action Groups ------------------------------------------------ -- Action 163: LabelNetwork -- Action 164: UnlabelNetwork -- Action 165: LabelNic -- Action 166: UnlabelNic ------------------------- --- Update SuperUser role ------------------------- PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ID_0001, 163); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ID_0001, 164); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ID_0001, 165); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ID_0001, 166); -------------------------------- -- UPDATE DATA_CENTER_ADMIN role -------------------------------- PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ID, 163); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ID, 164); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ID, 165); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ID, 166); ---------------------------- -- UPDATE NETWORK_ADMIN role ---------------------------- PERFORM fn_db_add_action_group_to_role(v_NETWORK_ADMIN_ID, 163); PERFORM fn_db_add_action_group_to_role(v_NETWORK_ADMIN_ID, 164); PERFORM fn_db_add_action_group_to_role(v_NETWORK_ADMIN_ID, 165); PERFORM fn_db_add_action_group_to_role(v_NETWORK_ADMIN_ID, 166); ---------------------------- -- UPDATE HOST_ADMIN role ---------------------------- PERFORM fn_db_add_action_group_to_role(v_HOST_ADMIN_ID, 165); PERFORM fn_db_add_action_group_to_role(v_HOST_ADMIN_ID, 166); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_add_action_groups_of_network_labels_03_04_0340(); ************************** ********* QUERY ********** DROP function __temp_add_action_groups_of_network_labels_03_04_0340(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040340'), 'upgrade/03_04_0340_add_network_labels_action_groups.sql', 'ff56ce3cf88976e4c561dfb7e48355c7', 'engine', cast(trim('2016-07-12 18:23:27.060044-04') as timestamp), cast(trim('2016-07-12 18:23:27.185101-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9c587817ecc1e175598d3271b8d91754' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE network_qos ALTER COLUMN name DROP NOT NULL, ALTER COLUMN storage_pool_id DROP NOT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040350'), 'upgrade/03_04_0350_relax_network_qos_constraints.sql', '9c587817ecc1e175598d3271b8d91754', 'engine', cast(trim('2016-07-12 18:23:27.226594-04') as timestamp), cast(trim('2016-07-12 18:23:27.284748-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '32d659cbbc415a5b63c5569d7bed3d29' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('network', 'qos_id', 'UUID'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('network', 'fk_network_qos_id', 'FOREIGN KEY (qos_id) REFERENCES network_qos(id) ON DELETE SET NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040360'), 'upgrade/03_04_0360_add_qos_id_to_network.sql', '32d659cbbc415a5b63c5569d7bed3d29', 'engine', cast(trim('2016-07-12 18:23:27.326094-04') as timestamp), cast(trim('2016-07-12 18:23:27.426675-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a6aeeee79f2617c01517a98ad7396cf0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface', 'qos_overridden', 'boolean NOT NULL DEFAULT false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040370'), 'upgrade/03_04_0370_add_qos_overridden_to_vds_interface.sql', 'a6aeeee79f2617c01517a98ad7396cf0', 'engine', cast(trim('2016-07-12 18:23:27.468147-04') as timestamp), cast(trim('2016-07-12 18:23:27.844255-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '762ce9adc03d468b90fbbd3502636903' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'last_stop_time', 'timestamp with time zone'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040380'), 'upgrade/03_04_0380_add_last_stop_time_to_vm_dynamic.sql', '762ce9adc03d468b90fbbd3502636903', 'engine', cast(trim('2016-07-12 18:23:27.88483-04') as timestamp), cast(trim('2016-07-12 18:23:27.951519-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '580aee7c34801bd4f6005217487ff11a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'ha_reservation', 'boolean not null default false'); ************************** ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, description) VALUES ('7f262d70-6cac-11e3-981f-0800200c9a66', 'OptimalForHaReservation', true, '{ "ScaleDown" : "(100|[1-9]|[1-9][0-9])$" }', 1, 'Weights hosts according to their HA score regardless of hosted engine'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) SELECT cluster_policies.id, '7f262d70-6cac-11e3-981f-0800200c9a66', 0, 1 FROM cluster_policies; ************************** INSERT 0 3 ********* QUERY ********** INSERT INTO event_map(event_up_name, event_down_name) VALUES ('CLUSTER_ALERT_HA_RESERVATION', ''); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040390'), 'upgrade/03_04_0390_add_ha_reservation.sql', '580aee7c34801bd4f6005217487ff11a', 'engine', cast(trim('2016-07-12 18:23:27.993193-04') as timestamp), cast(trim('2016-07-12 18:23:28.643397-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1c8df49d692499c49de73e9f055a260a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO dwh_history_timekeeping(var_name,var_value) SELECT 'DwhCurrentlyRunning','0' WHERE not exists (SELECT 1 FROM dwh_history_timekeeping WHERE var_name = 'DwhCurrentlyRunning'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040400'), 'upgrade/03_04_0400_add_var_on_dwh_status.sql', '1c8df49d692499c49de73e9f055a260a', 'engine', cast(trim('2016-07-12 18:23:28.684539-04') as timestamp), cast(trim('2016-07-12 18:23:28.73493-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f7310beca6b3baef6084b68b3e205b31' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, type, enabled, custom_properties_regex, description) VALUES ('d58c8e32-44e1-418f-9222-52cd887bf9e0', 'OptimalForEvenGuestDistribution', true, 2, true, '{ "HighVmCount" : "^([0-9][0-9]*)$", "MigrationThreshold" : "^([5-9][0-9]*)$", "SpmVmGrace":"^([5-9][0-9]*)$" }', 'Even VM count distribution policy' ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policies (id, name, description, is_locked, is_default, custom_properties) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d579','VM_Evenly_Distributed', '', true, false, '{ "HighVmCount" : "10", "MigrationThreshold" : "5", "SpmVmGrace" : "5" }'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', 'd58c8e32-44e1-418f-9222-52cd887bf9e0', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040410'), 'upgrade/03_04_0410_add_even_guest_distribution_policy.sql', 'f7310beca6b3baef6084b68b3e205b31', 'engine', cast(trim('2016-07-12 18:23:28.776354-04') as timestamp), cast(trim('2016-07-12 18:23:28.893265-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '33552acdb8c1ad56e946ce96db476358' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_static', 'disable_auto_pm', 'BOOLEAN default false'); ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'controlled_by_pm_policy', 'BOOLEAN default false'); ************************** ********* QUERY ********** UPDATE vds_dynamic set controlled_by_pm_policy=true WHERE status=3; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040420'), 'upgrade/03_04_0420_add_vds_pm_flags.sql', '33552acdb8c1ad56e946ce96db476358', 'engine', cast(trim('2016-07-12 18:23:28.934582-04') as timestamp), cast(trim('2016-07-12 18:23:29.568779-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5446d0003b4e2cb6e50f4ca8b7d54b10' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units SET custom_properties_regex='{ "CpuOverCommitDurationMinutes" : "^([1-9])$", "HighUtilization" : "^([5-9][0-9])$", "LowUtilization" : "^([1-4][0-9])$", "HostsInReserve": "^[0-9][0-9]*$", "EnableAutomaticHostPowerManagement": "^(true|false)$" }' WHERE id='736999d0-1023-46a4-9a75-1316ed50e151'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040430'), 'upgrade/03_04_0430_add_power_management_to_cluster_policy.sql', '5446d0003b4e2cb6e50f4ca8b7d54b10', 'engine', cast(trim('2016-07-12 18:23:29.60979-04') as timestamp), cast(trim('2016-07-12 18:23:29.668104-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '08e3b932bfd35de5096ed2a8246c8f2d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE affinity_groups ( id UUID NOT NULL CONSTRAINT affinity_group_pk PRIMARY KEY, name VARCHAR(128) NOT NULL, description VARCHAR(4000), cluster_id UUID NOT NULL CONSTRAINT affinity_group_cluster_id_fk REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE, positive BOOLEAN NOT NULL DEFAULT TRUE, enforcing BOOLEAN NOT NULL DEFAULT TRUE, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE default NULL ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX IDX_affinity_group_cluster_id ON affinity_groups(cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE affinity_group_members ( affinity_group_id UUID NOT NULL CONSTRAINT affinity_group_member_affinity_id_fk REFERENCES affinity_groups(id) ON DELETE CASCADE, vm_id UUID NOT NULL CONSTRAINT affinity_group_member_vm_id_fk REFERENCES vm_static(vm_guid) ON DELETE CASCADE ); ************************** CREATE TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040440'), 'upgrade/03_04_0440_create_affinity_group_tables.sql', '08e3b932bfd35de5096ed2a8246c8f2d', 'engine', cast(trim('2016-07-12 18:23:29.709804-04') as timestamp), cast(trim('2016-07-12 18:23:30.110035-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3974d01f629e099d0c0d11553ccd9eff' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO roles_groups(role_id,action_group_id) VALUES('00000000-0000-0000-0000-000000000001', 1550); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups(role_id,action_group_id) VALUES('DEF00002-0000-0000-0000-DEF000000002', 1550); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO roles_groups(role_id,action_group_id) VALUES('DEF00001-0000-0000-0000-DEF000000001', 1550); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040450'), 'upgrade/03_04_0450_add_affinity_group_action_group.sql', '3974d01f629e099d0c0d11553ccd9eff', 'engine', cast(trim('2016-07-12 18:23:30.15137-04') as timestamp), cast(trim('2016-07-12 18:23:30.276251-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '32ab3909c5cba69324ca2d5020b05def' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units(id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('84e6ddee-ab0d-42dd-82f0-c297779db566', 'VmAffinityGroups', TRUE, NULL, 0, true, 'Enables Affinity Groups hard enforcement for VMs; VMs in group are required to run either on the same hypervisor host (positive) or on independent hypervisor hosts (negative)'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) SELECT cluster_policies.id, '84e6ddee-ab0d-42dd-82f0-c297779db566', 0, 0 FROM cluster_policies; ************************** INSERT 0 4 ********* QUERY ********** INSERT INTO policy_units(id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('84e6ddee-ab0d-42dd-82f0-c297779db567', 'VmAffinityGroups', TRUE, NULL, 1, true, 'Enables Affinity Groups soft enforcement for VMs; VMs in group are most likely to run either on the same hypervisor host (positive) or on independent hypervisor hosts (negative)'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) SELECT cluster_policies.id, '84e6ddee-ab0d-42dd-82f0-c297779db567', 0, 1 FROM cluster_policies; ************************** INSERT 0 4 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040460'), 'upgrade/03_04_0460_add_affinity_group_filter_and_weight.sql', '32ab3909c5cba69324ca2d5020b05def', 'engine', cast(trim('2016-07-12 18:23:30.318132-04') as timestamp), cast(trim('2016-07-12 18:23:30.476329-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e747bf9f65d2bec76e6574707b6e231a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into action_version_map values (6, '3.4', '*'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040470'), 'upgrade/03_04_0470_add_reboot_command.sql', 'e747bf9f65d2bec76e6574707b6e231a', 'engine', cast(trim('2016-07-12 18:23:30.517901-04') as timestamp), cast(trim('2016-07-12 18:23:30.576352-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ac1b7518d2b142a8173a09d7361dfe55' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'migration_downtime', 'integer default null'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040480'), 'upgrade/03_04_0480_add_vm_migration_downtime.sql', 'ac1b7518d2b142a8173a09d7361dfe55', 'engine', cast(trim('2016-07-12 18:23:30.617771-04') as timestamp), cast(trim('2016-07-12 18:23:30.676458-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7a4596c214f991867bb865b1ffe8feaf' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'enable_ksm', 'boolean not null default true'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040490'), 'upgrade/03_04_0490_add_enable_ksm_to_vds_groups.sql', '7a4596c214f991867bb865b1ffe8feaf', 'engine', cast(trim('2016-07-12 18:23:30.717774-04') as timestamp), cast(trim('2016-07-12 18:23:30.993913-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '773d220ff630d81a237b47a124553922' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE iscsi_bonds ( id UUID NOT NULL, name varchar(50) NOT NULL, description varchar(4000), storage_pool_id UUID NOT NULL, CONSTRAINT PK_iscsi_bonds PRIMARY KEY(id), CONSTRAINT FK_iscsi_bonds_storage_pool FOREIGN KEY(storage_pool_id) REFERENCES storage_pool(id) ON DELETE CASCADE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE iscsi_bonds_networks_map ( iscsi_bond_id UUID NOT NULL, network_id UUID NOT NULL, CONSTRAINT PK_iscsi_bonds_networks_map PRIMARY KEY(iscsi_bond_id,network_id), CONSTRAINT FK_iscsi_bonds_networks_map_iscsi_bond_id FOREIGN KEY(iscsi_bond_id) REFERENCES iscsi_bonds(id) ON DELETE CASCADE, CONSTRAINT FK_iscsi_bonds_networks_map_network_id FOREIGN KEY(network_id) REFERENCES network(id) ON DELETE CASCADE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE iscsi_bonds_storage_connections_map ( iscsi_bond_id UUID NOT NULL, connection_id varchar(50) NOT NULL, CONSTRAINT PK_iscsi_bonds_storage_connections_map PRIMARY KEY(iscsi_bond_id,connection_id), CONSTRAINT FK_iscsi_bonds_storage_connections_map_iscsi_bond_id FOREIGN KEY(iscsi_bond_id) REFERENCES iscsi_bonds(id) ON DELETE CASCADE, CONSTRAINT FK_iscsi_bonds_storage_connections_map_connection_id FOREIGN KEY(connection_id) REFERENCES storage_server_connections(id) ON DELETE CASCADE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040500'), 'upgrade/03_04_0500_add_iscsi_bond.sql', '773d220ff630d81a237b47a124553922', 'engine', cast(trim('2016-07-12 18:23:31.034637-04') as timestamp), cast(trim('2016-07-12 18:23:31.576307-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ad0d2f486704100ec927a59b93c83d56' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vds_static set pm_proxy_preferences = 'cluster,dc' where pm_enabled and pm_proxy_preferences = ''; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040510'), 'upgrade/03_04_0510_set_proxy_preferences_default.sql', 'ad0d2f486704100ec927a59b93c83d56', 'engine', cast(trim('2016-07-12 18:23:31.617819-04') as timestamp), cast(trim('2016-07-12 18:23:31.67614-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6499e09b35627d7485bf490a698567af' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE gluster_volume_details ( volume_id UUID NOT NULL REFERENCES gluster_volumes(id) ON DELETE CASCADE, total_space BIGINT, used_space BIGINT, free_space BIGINT, _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_gluster_volume_details PRIMARY KEY(volume_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_volume_brick_details ( brick_id UUID NOT NULL REFERENCES gluster_volume_bricks(id) ON DELETE CASCADE, total_space BIGINT, used_space BIGINT, free_space BIGINT, _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_gluster_volume_brick_details PRIMARY KEY(brick_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040520'), 'upgrade/03_04_0520_add_tables_for_gluster_volume_and_brick_details.sql', '6499e09b35627d7485bf490a698567af', 'engine', cast(trim('2016-07-12 18:23:31.717802-04') as timestamp), cast(trim('2016-07-12 18:23:31.992926-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5fe6824a23f2b10bc8d1f5aa0904d680' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_DETAILS_REFRESH', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('GLUSTER_VOLUME_DETAILS_REFRESH_FAILED', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040530'), 'upgrade/03_04_0530_gluster_refresh_gluster_volume_details-event_map.sql', '5fe6824a23f2b10bc8d1f5aa0904d680', 'engine', cast(trim('2016-07-12 18:23:32.034549-04') as timestamp), cast(trim('2016-07-12 18:23:32.125961-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b1919140e03ce6ed9a7ef77e37e0b0b5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('storage_pool', 'is_local', 'boolean'); ************************** ********* QUERY ********** create or replace function __temp_update_storage_domain_is_local() returns void as $function$ begin if (exists (select 1 from information_schema.columns where table_schema = 'public' AND table_name ilike 'storage_pool' and column_name ilike 'storage_pool_type')) then update storage_pool set is_local = (storage_pool_type=4); end if; end; $function$ language plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_update_storage_domain_is_local(); ************************** ********* QUERY ********** drop function __temp_update_storage_domain_is_local(); ************************** DROP FUNCTION ********* QUERY ********** ALTER TABLE storage_pool ALTER COLUMN storage_pool_type DROP NOT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040540'), 'upgrade/03_04_0540_remove_storage_pool_type.sql', 'b1919140e03ce6ed9a7ef77e37e0b0b5', 'engine', cast(trim('2016-07-12 18:23:32.167728-04') as timestamp), cast(trim('2016-07-12 18:23:32.359713-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1015cf2947a698c600297d39509706bc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'template_version_number', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'template_version_name', 'varchar(40) DEFAULT NULL'); ************************** ********* QUERY ********** update vm_static set template_version_number=1; ************************** UPDATE 1 ********* QUERY ********** update vm_static set vmt_guid = vm_guid where entity_type='TEMPLATE'; ************************** UPDATE 1 ********* QUERY ********** update vm_static set template_version_name = 'base version' where entity_type='TEMPLATE'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040550'), 'upgrade/03_04_0550_add_template_version_to_vm_static.sql', '1015cf2947a698c600297d39509706bc', 'engine', cast(trim('2016-07-12 18:23:32.401136-04') as timestamp), cast(trim('2016-07-12 18:23:32.851353-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8625b7d0e4695c7244c47aca2166fbb4' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE vm_init ( vm_id UUID NOT NULL, host_name TEXT DEFAULT NULL, domain TEXT DEFAULT NULL, authorized_keys TEXT DEFAULT NULL, regenerate_keys BOOLEAN DEFAULT FALSE, time_zone VARCHAR(40) DEFAULT NULL, dns_servers TEXT DEFAULT NULL, dns_search_domains TEXT DEFAULT NULL, networks TEXT DEFAULT NULL, password TEXT DEFAULT NULL, winkey VARCHAR(30) DEFAULT NULL, custom_script TEXT DEFAULT NULL, CONSTRAINT pk_vm_init PRIMARY KEY (vm_id), CONSTRAINT vm_static_vm_init FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** INSERT into vm_init (vm_id, domain, time_zone) SELECT vm_guid, domain, time_zone from vm_static WHERE domain is NOT null OR time_zone is NOT null; ************************** INSERT 18141 1 ********* QUERY ********** ALTER TABLE vm_static DROP COLUMN domain CASCADE; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040560'), 'upgrade/03_04_0560_add_vm_init_table.sql', '8625b7d0e4695c7244c47aca2166fbb4', 'engine', cast(trim('2016-07-12 18:23:32.892645-04') as timestamp), cast(trim('2016-07-12 18:23:33.192782-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '71629cc4cdc710a72475f547ae78eaf5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, type, enabled, custom_properties_regex, description) VALUES ('3ba8c988-f779-42c0-90ce-caa8243edee7', 'OptimalForEvenGuestDistribution', true, 1, true, NULL, 'Weights host according the number of running VMs'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', '3ba8c988-f779-42c0-90ce-caa8243edee7', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', '12262ab6-9690-4bc3-a2b3-35573b172d54', -1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', '72163d1c-9468-4480-99d9-0888664eb143', 1, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) SELECT '8d5d7bec-68de-4a67-b53e-0ac54686d579', policy_units.id, 0, 1 FROM policy_units WHERE not exists (SELECT id FROM cluster_policy_units WHERE cluster_policy_id = '8d5d7bec-68de-4a67-b53e-0ac54686d579' AND policy_unit_id = policy_units.id) AND policy_units.type = 0 AND policy_units.is_internal = true; ************************** INSERT 0 4 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', '7f262d70-6cac-11e3-981f-0800200c9a66', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', '98e92667-6161-41fb-b3fa-34f820ccbc4b', 0, 1); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040570'), 'upgrade/03_04_0570_add_all_basic_filters_to_even_guest_policy.sql', '71629cc4cdc710a72475f547ae78eaf5', 'engine', cast(trim('2016-07-12 18:23:33.234194-04') as timestamp), cast(trim('2016-07-12 18:23:33.551144-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ce1f90457eb1bed1f085b4af30185071' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('VDS_INITIATED_RUN_VM_FAILED', ''); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040580'), 'upgrade/03_04_0580_add_restart_different_host_event.sql', 'ce1f90457eb1bed1f085b4af30185071', 'engine', cast(trim('2016-07-12 18:23:33.592771-04') as timestamp), cast(trim('2016-07-12 18:23:33.651001-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd646eb15f4d2bb2148dbd40a433da2e7' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('storage_server_connections','password','varchar','text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040590'), 'upgrade/03_04_0590_change_storage_server_connections_password_length.sql', 'd646eb15f4d2bb2148dbd40a433da2e7', 'engine', cast(trim('2016-07-12 18:23:33.692377-04') as timestamp), cast(trim('2016-07-12 18:23:33.968486-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '34b74bd1e459b34cc60d4e59f87c6219' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'current_cd', 'varchar(4000) default null'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040600'), 'upgrade/03_04_0600_add_current_cd_to_vm_dynamic.sql', '34b74bd1e459b34cc60d4e59f87c6219', 'engine', cast(trim('2016-07-12 18:23:34.025788-04') as timestamp), cast(trim('2016-07-12 18:23:34.393663-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '821fb4b4f4b2471dc57ffd883dbc7ae8' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update event_map set event_down_name = 'VDS_DETECTED' where event_up_name='VDS_SET_NONOPERATIONAL'; ************************** UPDATE 1 ********* QUERY ********** update event_map set event_down_name = 'VDS_DETECTED' where event_up_name='VDS_SET_NONOPERATIONAL_IFACE_DOWN'; ************************** UPDATE 1 ********* QUERY ********** update event_map set event_down_name = 'VDS_DETECTED' where event_up_name='VDS_SET_NONOPERATIONAL_DOMAIN'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040610'), 'upgrade/03_04_0610_map_vds_detected_to_event_map.sql', '821fb4b4f4b2471dc57ffd883dbc7ae8', 'engine', cast(trim('2016-07-12 18:23:34.434212-04') as timestamp), cast(trim('2016-07-12 18:23:34.559137-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0f766ba280012cc20b5d66355e59080f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update users set username = regexp_replace(username, '@.*', ''); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040620'), 'upgrade/03_04_0620_remove_directory_suffix_from_login_name.sql', '0f766ba280012cc20b5d66355e59080f', 'engine', cast(trim('2016-07-12 18:23:34.600814-04') as timestamp), cast(trim('2016-07-12 18:23:34.659143-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0e58b30629213beaf97ab57da9a554a0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE users SET last_admin_check_status=TRUE WHERE user_id = 'FDFC627C-D875-11E0-90F0-83DF133B58CC'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040630'), 'upgrade/03_04_0630_fix_admin_internal_permissions.sql', '0e58b30629213beaf97ab57da9a554a0', 'engine', cast(trim('2016-07-12 18:23:34.700611-04') as timestamp), cast(trim('2016-07-12 18:23:34.727637-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3954122943e15cafb5f3d9e679c01248' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units set custom_properties_regex = '{ "HighVmCount" : "^([0-9]|[1-9][0-9]+)$", "MigrationThreshold" : "^([2-9]|[1-9][0-9]+)$", "SpmVmGrace":"^([0-9]|[1-9][0-9]+)$" }' where id = 'd58c8e32-44e1-418f-9222-52cd887bf9e0'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03040640'), 'upgrade/03_04_0640_fix_even_guest_distribution_parameters.sql', '3954122943e15cafb5f3d9e679c01248', 'engine', cast(trim('2016-07-12 18:23:34.767488-04') as timestamp), cast(trim('2016-07-12 18:23:34.825958-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6499e09b35627d7485bf490a698567af' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050010'), 'upgrade/03_05_0010_add_tables_for_gluster_volume_and_brick_details.sql', '6499e09b35627d7485bf490a698567af', 'engine', cast(trim('2016-07-12 18:23:34.867544-04') as timestamp), cast(trim('2016-07-12 18:23:34.887115-04') as timestamp), 'SKIPPED', false, 'Installed already by 03040520' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5fe6824a23f2b10bc8d1f5aa0904d680' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050020'), 'upgrade/03_05_0020_gluster_refresh_gluster_volume_details-event_map.sql', '5fe6824a23f2b10bc8d1f5aa0904d680', 'engine', cast(trim('2016-07-12 18:23:34.925804-04') as timestamp), cast(trim('2016-07-12 18:23:34.945088-04') as timestamp), 'SKIPPED', false, 'Installed already by 03040530' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '07ce60c1d0de2764751fed166a01598a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics', 'ha_configured', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics', 'ha_active', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics', 'ha_global_maintenance', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics', 'ha_local_maintenance', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050030'), 'upgrade/03_05_0030_add_ha_columns_to_vds_statistics.sql', '07ce60c1d0de2764751fed166a01598a', 'engine', cast(trim('2016-07-12 18:23:34.983992-04') as timestamp), cast(trim('2016-07-12 18:23:35.567987-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ac2fd91283cbcdbb22c8d616ddddb0ff' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO event_map(event_up_name, event_down_name) values('USER_VDS_MAINTENANCE_MANUAL_HA', 'VDS_ACTIVATE'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050040'), 'upgrade/03_05_0040_add_ha_maintenance_events.sql', 'ac2fd91283cbcdbb22c8d616ddddb0ff', 'engine', cast(trim('2016-07-12 18:23:35.608995-04') as timestamp), cast(trim('2016-07-12 18:23:35.659041-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'feabc7bc7bb7ff749f075be48538c92e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE event_subscriber DROP CONSTRAINT fk_event_subscriber_event_notification_methods; ************************** ALTER TABLE ********* QUERY ********** DROP TABLE event_notification_methods ; ************************** DROP TABLE ********* QUERY ********** ALTER TABLE event_subscriber ADD COLUMN notification_method CHARACTER VARYING(32) DEFAULT 'EMAIL' CHECK (notification_method IN ('EMAIL', 'SNMP_TRAP')); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE event_subscriber DROP CONSTRAINT pk_event_subscriber; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE event_subscriber ADD CONSTRAINT pk_event_subscriber PRIMARY KEY (subscriber_id, event_up_name, notification_method, tag_name); ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE event_subscriber DROP COLUMN method_id; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE event_subscriber ALTER notification_method SET NOT NULL; ************************** ALTER TABLE ********* QUERY ********** UPDATE event_subscriber AS es SET method_address = u.email FROM event_subscriber AS es2 INNER JOIN users u ON es2.subscriber_id = u.user_id WHERE (es.method_address is NULL OR trim(both from es.method_address) = ''); ************************** UPDATE 0 ********* QUERY ********** ALTER TABLE event_notification_hist DROP COLUMN subscriber_id; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050050'), 'upgrade/03_05_0050_event_notification_methods.sql', 'feabc7bc7bb7ff749f075be48538c92e', 'engine', cast(trim('2016-07-12 18:23:35.700251-04') as timestamp), cast(trim('2016-07-12 18:23:36.153993-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '03ffe543a142f001053e3ffedd22aeae' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update event_map set event_down_name = 'VDS_DETECTED' where event_up_name='VDS_FAILURE'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050060'), 'upgrade/03_05_0060_event_map_vds_failure.sql', '03ffe543a142f001053e3ffedd22aeae', 'engine', cast(trim('2016-07-12 18:23:36.192172-04') as timestamp), cast(trim('2016-07-12 18:23:36.242208-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8741793705486ebcf2fe913efbf643d4' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE event_subscriber RENAME COLUMN notification_method TO nmx; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE event_subscriber ADD COLUMN notification_method CHARACTER VARYING(32); ************************** ALTER TABLE ********* QUERY ********** UPDATE event_subscriber SET notification_method = 'smtp' WHERE nmx = 'EMAIL'; ************************** UPDATE 0 ********* QUERY ********** UPDATE event_subscriber SET notification_method = 'snmp' WHERE nmx = 'SNMP_TRAP'; ************************** UPDATE 0 ********* QUERY ********** ALTER TABLE event_subscriber DROP COLUMN nmx; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE event_subscriber ADD CONSTRAINT event_subscriber_method_check CHECK (notification_method IN ('smtp', 'snmp')); ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050070'), 'upgrade/03_05_0070_fix_event_notfication_method.sql', '8741793705486ebcf2fe913efbf643d4', 'engine', cast(trim('2016-07-12 18:23:36.283817-04') as timestamp), cast(trim('2016-07-12 18:23:36.442164-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3f4dda75146e664754c932522c4bc6f9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION _temp_add_missing_manipulate_users_permissions() RETURNS VOID AS $procedure$ DECLARE v_ADD_USERS_AND_GROUPS_FROM_DIRECTORY INTEGER; v_MANIPULATE_PERMISSIONS INTEGER; BEGIN v_ADD_USERS_AND_GROUPS_FROM_DIRECTORY = 503; v_MANIPULATE_PERMISSIONS = 502; INSERT INTO ROLES_GROUPS(role_id,action_group_id) SELECT rg.role_id, v_ADD_USERS_AND_GROUPS_FROM_DIRECTORY FROM ROLES_GROUPS rg WHERE action_group_id = v_MANIPULATE_PERMISSIONS AND NOT EXISTS (SELECT 1 FROM ROLES_GROUPS rg2 WHERE rg2.role_id = rg.role_id AND action_group_id = v_ADD_USERS_AND_GROUPS_FROM_DIRECTORY); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT _temp_add_missing_manipulate_users_permissions(); ************************** ********* QUERY ********** drop function _temp_add_missing_manipulate_users_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050080'), 'upgrade/03_05_0080_add_missing_manipulate_users_permissions.sql', '3f4dda75146e664754c932522c4bc6f9', 'engine', cast(trim('2016-07-12 18:23:36.483831-04') as timestamp), cast(trim('2016-07-12 18:23:36.600319-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e8e76c44aa9fdfc3c9b25614f8d985d5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM roles_groups WHERE action_group_id in (163, 164, 165, 166); ************************** DELETE 14 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050090'), 'upgrade/03_05_0090_delete_network_labels_action_groups.sql', 'e8e76c44aa9fdfc3c9b25614f8d985d5', 'engine', cast(trim('2016-07-12 18:23:36.642102-04') as timestamp), cast(trim('2016-07-12 18:23:36.692118-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f6ee521065330a42df8480683e2d5691' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units set custom_properties_regex = '{ "CpuOverCommitDurationMinutes" : "^([1-9][0-9]*)$", "HighUtilization" : "^([5-9][0-9])$", "LowUtilization" : "^([0-9]|[1-4][0-9])$" }' WHERE id = '736999d0-1023-46a4-9a75-1316ed50e151'; ************************** UPDATE 1 ********* QUERY ********** UPDATE policy_units set custom_properties_regex = '{ "CpuOverCommitDurationMinutes" : "^([1-9][0-9]*)$", "HighUtilization" : "^([5-9][0-9])$" }' WHERE id = '7db4ab05-81ab-42e8-868a-aee2df483ed2'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050100'), 'upgrade/03_05_0100_allow_values_higher_9_for_cpuovercommit.sql', 'f6ee521065330a42df8480683e2d5691', 'engine', cast(trim('2016-07-12 18:23:36.733639-04') as timestamp), cast(trim('2016-07-12 18:23:36.808737-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a8490b31e224dcafd3a2821bcd7c6979' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'serial_number_policy', 'smallint default null'); ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'custom_serial_number', 'varchar(255) default null'); ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'serial_number_policy', 'smallint default null'); ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'custom_serial_number', 'varchar(255) default null'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050110'), 'upgrade/03_05_0110_add_vm_serial_number_policy.sql', 'a8490b31e224dcafd3a2821bcd7c6979', 'engine', cast(trim('2016-07-12 18:23:36.850428-04') as timestamp), cast(trim('2016-07-12 18:23:37.434795-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a4f0b99e7d82a7d9fd633df06d49927e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE storage_domains_ovf_info ( storage_domain_id UUID REFERENCES storage_domain_static(id) ON DELETE CASCADE, status INTEGER DEFAULT 0, ovf_disk_id UUID PRIMARY KEY REFERENCES base_disks(disk_id) ON DELETE CASCADE, stored_ovfs_ids TEXT, last_updated TIMESTAMP WITH TIME ZONE ); ************************** CREATE TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050120'), 'upgrade/03_05_0120_add_storage_domain_ovf.sql', 'a4f0b99e7d82a7d9fd633df06d49927e', 'engine', cast(trim('2016-07-12 18:23:37.475435-04') as timestamp), cast(trim('2016-07-12 18:23:37.742238-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '50e5445fac0ab91cfb2a6050e26f96b2' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_ovf_generations', 'ovf_data', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050130'), 'upgrade/03_05_0130_add_ovf_data_column.sql', '50e5445fac0ab91cfb2a6050e26f96b2', 'engine', cast(trim('2016-07-12 18:23:37.783625-04') as timestamp), cast(trim('2016-07-12 18:23:37.933741-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '329b8ee3da59a0a14a621823effe4a3c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_add_install_vds_upgrade_node_action_group_03_05_0140() RETURNS VOID AS $procedure$ DECLARE v_SUPER_USER_ID_0001 UUID; v_DATA_CENTER_ADMIN_ID UUID; v_CLUSTER_ADMIN_ID UUID; BEGIN v_SUPER_USER_ID_0001 := '00000000-0000-0000-0000-000000000001'; v_DATA_CENTER_ADMIN_ID := 'DEF00002-0000-0000-0000-DEF000000002'; v_CLUSTER_ADMIN_ID := 'DEF00001-0000-0000-0000-DEF000000001'; ------------------------- --- Update SuperUser role ------------------------- PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ID_0001, 130); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ID_0001, 131); -------------------------------- -- UPDATE DATA_CENTER_ADMIN role -------------------------------- PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ID, 130); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ID, 131); -------------------------------- -- UPDATE CLUSTER_ADMIN role -------------------------------- PERFORM fn_db_add_action_group_to_role(v_CLUSTER_ADMIN_ID, 130); PERFORM fn_db_add_action_group_to_role(v_CLUSTER_ADMIN_ID, 131); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_add_install_vds_upgrade_node_action_group_03_05_0140(); ************************** ********* QUERY ********** DROP function __temp_add_install_vds_upgrade_node_action_group_03_05_0140(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050140'), 'upgrade/03_05_0140_add_install_vds_upgrade_ovirt_node_action_group.sql', '329b8ee3da59a0a14a621823effe4a3c', 'engine', cast(trim('2016-07-12 18:23:37.975273-04') as timestamp), cast(trim('2016-07-12 18:23:38.075172-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e1af151d7f6dfa6c67297eba8be35e58' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_fix_user_vm_manager_role() RETURNS VOID AS $procedure$ DECLARE v_VM_ADMIN_ID UUID; BEGIN v_VM_ADMIN_ID := 'def00012-0000-0000-0000-def000000012'; -- Remove the import export vm action group from USER_VM_MANAGER role DELETE FROM roles_groups WHERE role_id = v_VM_ADMIN_ID AND action_group_id = 8; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_fix_user_vm_manager_role(); ************************** ********* QUERY ********** DROP function __temp_fix_user_vm_manager_role(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050150'), 'upgrade/03_05_0150_remove_import_export_permission_from_user_instance_manager_role.sql', 'e1af151d7f6dfa6c67297eba8be35e58', 'engine', cast(trim('2016-07-12 18:23:38.116791-04') as timestamp), cast(trim('2016-07-12 18:23:38.216959-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fb885bc1c0048763375d6fa1ac9ea034' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE event_subscriber DROP CONSTRAINT fk_event_subscriber_event_map; ************************** ALTER TABLE ********* QUERY ********** update event_subscriber set event_up_name = 'HOST_INTERFACE_HIGH_NETWORK_USE' where event_up_name='VDS_HIGH_NETWORK_USE'; ************************** UPDATE 0 ********* QUERY ********** update event_map set event_up_name = 'HOST_INTERFACE_HIGH_NETWORK_USE' where event_up_name='VDS_HIGH_NETWORK_USE'; ************************** UPDATE 1 ********* QUERY ********** ALTER TABLE event_subscriber ADD CONSTRAINT fk_event_subscriber_event_map FOREIGN KEY (event_up_name) REFERENCES event_map(event_up_name) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050160'), 'upgrade/03_05_0160_add_host_interface_high_network_use_event.sql', 'fb885bc1c0048763375d6fa1ac9ea034', 'engine', cast(trim('2016-07-12 18:23:38.258542-04') as timestamp), cast(trim('2016-07-12 18:23:38.425323-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6dad2d9d8cad07d6edebf575b8eb4735' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_statistics', 'boot_time', 'BIGINT'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050170'), 'upgrade/03_05_0170_add_boot_time_to_vds_statistics.sql', '6dad2d9d8cad07d6edebf575b8eb4735', 'engine', cast(trim('2016-07-12 18:23:38.466795-04') as timestamp), cast(trim('2016-07-12 18:23:38.525546-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '144f59f2832f9be70cf02631ea85074f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** alter table vm_init add column input_locale VARCHAR(256) DEFAULT NULL, add column ui_language VARCHAR(256) DEFAULT NULL, add column system_locale VARCHAR(256) DEFAULT NULL, add column user_locale VARCHAR(256) DEFAULT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050180'), 'upgrade/03_05_0180_vm_init_add_sysprep_locale.sql', '144f59f2832f9be70cf02631ea85074f', 'engine', cast(trim('2016-07-12 18:23:38.567047-04') as timestamp), cast(trim('2016-07-12 18:23:38.834264-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b0ec8b51da128b6a5c035474cc78f54a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** alter table vm_init add column user_name VARCHAR(256) DEFAULT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050190'), 'upgrade/03_05_0190_vm_init_add_user_name.sql', 'b0ec8b51da128b6a5c035474cc78f54a', 'engine', cast(trim('2016-07-12 18:23:38.875297-04') as timestamp), cast(trim('2016-07-12 18:23:39.117635-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1443c55b4695947c44ca5286fb4b0edd' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** alter table vm_init add column active_directory_ou VARCHAR(256) DEFAULT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050200'), 'upgrade/03_05_0200_vm_init_add_active_directory_ou.sql', '1443c55b4695947c44ca5286fb4b0edd', 'engine', cast(trim('2016-07-12 18:23:39.158594-04') as timestamp), cast(trim('2016-07-12 18:23:39.392459-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b4d98e282a9d33cb5c03eaf0c7023c1c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_change_group_ids_03_05_0210() RETURNS VOID AS $procedure$ BEGIN --If there is no external_id set at users, populate it with content based on the id update ad_groups set external_id = decode(replace(CAST(id as text),'-',''),'HEX') where encode(external_id,'HEX') = ''; --groups.external_id holds a hex representation of the id of groups at ldap directories. -- This script sets the guid representation at ad_groups.id, and modifies all relevant references, --using the following steps: --1. Adding temp column for mapping from old uuid to new uuid PERFORM fn_db_add_column('ad_groups', 'temp_id', 'uuid'); --Filling the new column with guid repreentation of external_id UPDATE ad_groups SET temp_id = CAST(substring(encode(external_id,'hex') FROM 1 FOR 8) || '-' || substring(encode(external_id,'hex') FROM 9 FOR 4) || '-' || substring(encode(external_id,'hex') FROM 13 FOR 4) || '-' || substring(encode(external_id,'hex') FROM 17 FOR 4) || '-' || substring(encode(external_id,'hex') FROM 21 FOR 12) AS uuid); --2. Changing relevant group_id appearances in other tables ALTER TABLE tags_user_group_map drop constraint tags_user_map_user_group; UPDATE tags_user_group_map m set group_id = ( SELECT temp_id FROM ad_groups WHERE id = m.group_id ); UPDATE permissions p SET ad_element_id = ( SELECT temp_id FROM ad_groups g1 WHERE g1.id = p.ad_element_id ) WHERE EXISTS ( SELECT id from ad_groups where id = p.ad_element_id ); --3. Fixing group_ids at users CREATE temp TABLE tmp_users_groups ON COMMIT DROP AS SELECT fnsplitteruuid(group_ids) AS group_id, user_id FROM users; UPDATE tmp_users_groups t SET group_id = ( SELECT temp_id FROM ad_groups WHERE id = t.group_id ); CREATE temp TABLE tmp_users_group_ids ON COMMIT DROP AS SELECT user_id, array_to_string(array_agg(group_id), ',') group_ids FROM tmp_users_groups GROUP BY user_id; UPDATE users u SET group_ids = ( SELECT group_ids FROM tmp_users_group_ids WHERE user_id = u.user_id ); UPDATE ad_groups SET id = temp_id; --4. Cleanup --DROP TABLE tmp_users_group_ids; --DROP TABLE tmp_users_groups; ALTER TABLE tags_user_group_map add constraint "tags_user_map_user_group" FOREIGN KEY (group_id) REFERENCES ad_groups(id); PERFORM fn_db_drop_column('ad_groups','temp_id'); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_change_group_ids_03_05_0210(); ************************** ********* QUERY ********** DROP FUNCTION __temp_change_group_ids_03_05_0210(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050210'), 'upgrade/03_05_0210_change_group_ids.sql', 'b4d98e282a9d33cb5c03eaf0c7023c1c', 'engine', cast(trim('2016-07-12 18:23:39.43337-04') as timestamp), cast(trim('2016-07-12 18:23:39.550443-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '90af4811c4dab5add0b153416132dffa' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_update_user_ids_03_05_0220() RETURNS VOID AS $procedure$ BEGIN --If there is no external_id set at users, populate it with content based on the user_id update users set external_id = decode(replace(CAST(user_id as text),'-',''),'HEX') where encode(external_id,'HEX') = ''; --users.external_id holds a hex representation of the id of users at ldap directories. -- This script sets the guid representation at users.id, and modifies all relevant references, --using the following steps: --1. Adding temp column for mapping from old uuid to new uuid PERFORM fn_db_add_column('users', 'temp_id', 'uuid'); --Filling the new column with guid repreentation of external_id UPDATE users SET temp_id = CAST(substring(encode(external_id,'hex') FROM 1 FOR 8) || '-' || substring(encode(external_id,'hex') FROM 9 FOR 4) || '-' || substring(encode(external_id,'hex') FROM 13 FOR 4) || '-' || substring(encode(external_id,'hex') FROM 17 FOR 4) || '-' || substring(encode(external_id,'hex') FROM 21 FOR 12) AS uuid); --2. Changing relevant group_id appearances in other tables ALTER TABLE tags_user_map drop constraint "tags_user_map_user"; UPDATE tags_user_map m set user_id = ( SELECT temp_id FROM users WHERE user_id = m.user_id); UPDATE permissions p SET ad_element_id = ( SELECT temp_id FROM users u1 WHERE u1.user_id = p.ad_element_id ) WHERE EXISTS ( SELECT user_id from users where user_id = p.ad_element_id ); UPDATE users SET user_id = temp_id; --3. Cleanup ALTER TABLE tags_user_map add constraint "tags_user_map_user" FOREIGN KEY (user_id) REFERENCES users(user_id); PERFORM fn_db_drop_column('users','temp_id'); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_update_user_ids_03_05_0220(); ************************** ********* QUERY ********** DROP FUNCTION __temp_update_user_ids_03_05_0220(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050220'), 'upgrade/03_05_0220_update_user_ids.sql', '90af4811c4dab5add0b153416132dffa', 'engine', cast(trim('2016-07-12 18:23:39.591869-04') as timestamp), cast(trim('2016-07-12 18:23:39.700347-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5954e2d839c458b31c8f636b98f5d060' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('HOST_INTERFACE_STATE_DOWN', 'HOST_INTERFACE_STATE_UP'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('HOST_BOND_SLAVE_STATE_DOWN', 'HOST_BOND_SLAVE_STATE_UP'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050230'), 'upgrade/03_05_0230_add_host_interface_status_change_events.sql', '5954e2d839c458b31c8f636b98f5d060', 'engine', cast(trim('2016-07-12 18:23:39.741824-04') as timestamp), cast(trim('2016-07-12 18:23:39.816828-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '54aaca4624f1d747521f8539f90e2c85' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE users ALTER COLUMN external_id DROP DEFAULT; ************************** ALTER TABLE ********* QUERY ********** SELECT fn_db_change_column_type('users', 'external_id', 'bytea', 'text'); ************************** ********* QUERY ********** ALTER TABLE users ALTER COLUMN external_id SET NOT NULL; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ad_groups ALTER COLUMN external_id DROP DEFAULT; ************************** ALTER TABLE ********* QUERY ********** SELECT fn_db_change_column_type('ad_groups', 'external_id', 'bytea', 'text'); ************************** ********* QUERY ********** ALTER TABLE ad_groups ALTER COLUMN external_id SET NOT NULL; ************************** ALTER TABLE ********* QUERY ********** UPDATE ad_groups SET external_id = CAST( id AS text ); ************************** UPDATE 1 ********* QUERY ********** UPDATE users SET external_id = CAST (user_id as text ); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050240'), 'upgrade/03_05_0240_change_external_id_to_string.sql', '54aaca4624f1d747521f8539f90e2c85', 'engine', cast(trim('2016-07-12 18:23:39.858161-04') as timestamp), cast(trim('2016-07-12 18:23:40.600237-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '983a280ca928836dae0e0213291b6297' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'reason', 'text'); ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'optional_reason', 'boolean not null default false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050250'), 'upgrade/03_05_0250_add_reason_columns.sql', '983a280ca928836dae0e0213291b6297', 'engine', cast(trim('2016-07-12 18:23:40.641815-04') as timestamp), cast(trim('2016-07-12 18:23:40.934152-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f02ba42fd10e432ffe44931fc2f78a97' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'exit_reason', 'integer default -1'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050260'), 'upgrade/03_05_0260_add_exit_reason_to_vm_dynamic.sql', 'f02ba42fd10e432ffe44931fc2f78a97', 'engine', cast(trim('2016-07-12 18:23:40.974681-04') as timestamp), cast(trim('2016-07-12 18:23:41.334398-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c906e895cbaa8f264b8b0da44bbeb2e9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set template_version_name=vm_name where entity_type='TEMPLATE' and template_version_number>1 and (template_version_name is null or template_version_name=''); ************************** UPDATE 0 ********* QUERY ********** update vm_static vm1 set vm_name= (select vm2.vm_name from vm_static vm2 where vm2.vm_guid = vm1.vmt_guid) where entity_type='TEMPLATE' and template_version_number>1; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050270'), 'upgrade/03_05_0270_update_template_version_naming.sql', 'c906e895cbaa8f264b8b0da44bbeb2e9', 'engine', cast(trim('2016-07-12 18:23:41.374976-04') as timestamp), cast(trim('2016-07-12 18:23:41.425148-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '29d9fe5782715d6aeabd322048a86ee7' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'is_boot_menu_enabled', 'boolean not null default false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050280'), 'upgrade/03_05_0280_add_vm_boot_menu.sql', '29d9fe5782715d6aeabd322048a86ee7', 'engine', cast(trim('2016-07-12 18:23:41.458113-04') as timestamp), cast(trim('2016-07-12 18:23:41.8174-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '433942876ca82605012225b8b097eb88' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE vm_static ALTER COLUMN vds_group_id DROP NOT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050290'), 'upgrade/03_05_0290_drop_vds_group_id_constraint_from_vm_static.sql', '433942876ca82605012225b8b097eb88', 'engine', cast(trim('2016-07-12 18:23:41.857727-04') as timestamp), cast(trim('2016-07-12 18:23:41.908058-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd8dbe912f05981a9ff5d88ffda6d5eea' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_static', 'pm_detect_kdump', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050300'), 'upgrade/03_05_0300_add_host_kdump_detection.sql', 'd8dbe912f05981a9ff5d88ffda6d5eea', 'engine', cast(trim('2016-07-12 18:23:41.941438-04') as timestamp), cast(trim('2016-07-12 18:23:42.359422-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c3bd57e139de5736c3501c12f8aed196' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_dynamic', 'kdump_status', 'SMALLINT NOT NULL DEFAULT -1'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050310'), 'upgrade/03_05_0310_add_host_kdump_status.sql', 'c3bd57e139de5736c3501c12f8aed196', 'engine', cast(trim('2016-07-12 18:23:42.407976-04') as timestamp), cast(trim('2016-07-12 18:23:42.650645-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9c15a0ce8e92d4c022f6b7e6dad6cc6b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface', 'custom_properties', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050320'), 'upgrade/03_05_0320_add_vds_interface_custom_properties.sql', '9c15a0ce8e92d4c022f6b7e6dad6cc6b', 'engine', cast(trim('2016-07-12 18:23:42.699816-04') as timestamp), cast(trim('2016-07-12 18:23:42.766274-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'cc65cd3924e0c064ff29af84b713138a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE network SET label=NULL WHERE provider_network_external_id IS NOT NULL; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050330'), 'upgrade/03_05_0330_nullify_external_network_labels.sql', 'cc65cd3924e0c064ff29af84b713138a', 'engine', cast(trim('2016-07-12 18:23:42.807902-04') as timestamp), cast(trim('2016-07-12 18:23:42.834676-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'dc3c7608e930f54f25087b1993ed6dfc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_statistics', 'migration_progress_percent', 'integer default 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050340'), 'upgrade/03_05_0340_add_migration_progress_percent_to_vm_dynamic.sql', 'dc3c7608e930f54f25087b1993ed6dfc', 'engine', cast(trim('2016-07-12 18:23:42.882719-04') as timestamp), cast(trim('2016-07-12 18:23:43.150714-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6822029e2bbedfad5ed2376d59006be1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** delete from event_map where event_up_name in ( 'NETWORK_UPDATE_DISPLAY_FOR_CLUSTER_WITH_ACTIVE_VM', 'NETWORK_UPDATE_DISPLAY_FOR_HOST_WITH_ACTIVE_VM'); ************************** DELETE 0 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('NETWORK_UPDATE_DISPLAY_FOR_CLUSTER_WITH_ACTIVE_VM', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map(event_up_name, event_down_name) values('NETWORK_UPDATE_DISPLAY_FOR_HOST_WITH_ACTIVE_VM', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050350'), 'upgrade/03_05_0350_add_display_network_change_events.sql', '6822029e2bbedfad5ed2376d59006be1', 'engine', cast(trim('2016-07-12 18:23:43.191413-04') as timestamp), cast(trim('2016-07-12 18:23:43.316832-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0615b912497be6e07894ac7a404ee8d8' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_add_audit_log_operation_action_groups() RETURNS void AS $BODY$ DECLARE v_roles_to_filter_out uuid[]; v_AUDIT_LOG_MANAGER_ROLE_ID uuid; BEGIN v_AUDIT_LOG_MANAGER_ROLE_ID := 'DEF00011-0000-0000-0000-DEF000000016'; -- We only add these action groups to ADMIN roles that have an action group that isn't the login permissions one v_roles_to_filter_out := array(select id from roles where role_type = 2 or (exists (select * from roles_groups where role_id = id) and not exists (select * from roles_groups where role_id = id and action_group_id != 1300))); -- Adding the TAG_MANAGEMENT action group perform fn_db_grant_action_group_to_all_roles_filter(1304, v_roles_to_filter_out); -- Adding the TagManager role DELETE FROM roles_groups WHERE role_id = v_AUDIT_LOG_MANAGER_ROLE_ID; INSERT INTO roles(id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) SELECT v_AUDIT_LOG_MANAGER_ROLE_ID, 'AuditLogManager', 'Audit Log Manager', true, 1, false, 255 WHERE NOT EXISTS (SELECT id FROM roles WHERE id = v_AUDIT_LOG_MANAGER_ROLE_ID); INSERT INTO roles_groups values(v_AUDIT_LOG_MANAGER_ROLE_ID, 1304); INSERT INTO roles_groups values(v_AUDIT_LOG_MANAGER_ROLE_ID, 1300); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_add_audit_log_operation_action_groups(); ************************** ********* QUERY ********** drop function __temp_add_audit_log_operation_action_groups(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050360'), 'upgrade/03_05_0360_add_audit_log_operation_action_group_and_roles.sql', '0615b912497be6e07894ac7a404ee8d8', 'engine', cast(trim('2016-07-12 18:23:43.424893-04') as timestamp), cast(trim('2016-07-12 18:23:43.541851-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'df6555e62d3347bc2b5329f7aefc240f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_interface', 'base_interface', 'varchar(50)'); ************************** ********* QUERY ********** update vds_interface set base_interface = substring(name from '(.*)\.[^\.]*') where vlan_id is not NULL; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050370'), 'upgrade/03_05_0370_add_base_interface_column_to_vds_interfaces.sql', 'df6555e62d3347bc2b5329f7aefc240f', 'engine', cast(trim('2016-07-12 18:23:43.58331-04') as timestamp), cast(trim('2016-07-12 18:23:43.650698-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a7970c56ead8ac50992e30c98043cc86' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units SET custom_properties_regex='{ "CpuOverCommitDurationMinutes" : "^([1-9][0-9]*)$", "HighUtilization" : "^([5-9][0-9])$", "LowUtilization" : "^([0-9]|[1-4][0-9])$", "HostsInReserve": "^[0-9][0-9]*$", "EnableAutomaticHostPowerManagement": "^(true|false)$" }' WHERE id='736999d0-1023-46a4-9a75-1316ed50e151'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050380'), 'upgrade/03_05_0380_reintroduce_powersaving_variables.sql', 'a7970c56ead8ac50992e30c98043cc86', 'engine', cast(trim('2016-07-12 18:23:43.683204-04') as timestamp), cast(trim('2016-07-12 18:23:43.741573-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e49398055417067fab92b3613dda8a08' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guest_cpu_count', 'INTEGER'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050390'), 'upgrade/03_05_0390_add_guest_cpu_count_to_vm_dynamic.sql', 'e49398055417067fab92b3613dda8a08', 'engine', cast(trim('2016-07-12 18:23:43.783226-04') as timestamp), cast(trim('2016-07-12 18:23:43.841755-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f28cb0cc01fc0f0bc98b1d102966e377' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX IDX_snapshots_snapshot_type ON snapshots(snapshot_type); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050400'), 'upgrade/03_05_0400_index_for_snapshot_type.sql', 'f28cb0cc01fc0f0bc98b1d102966e377', 'engine', cast(trim('2016-07-12 18:23:43.874806-04') as timestamp), cast(trim('2016-07-12 18:23:44.041355-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9bfa1afc2a343117726d312a4cb0a213' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'selinux_enforce_mode', 'INTEGER'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050410'), 'upgrade/03_05_0410_add_selinux_to_vds_dynamic.sql', '9bfa1afc2a343117726d312a4cb0a213', 'engine', cast(trim('2016-07-12 18:23:44.091408-04') as timestamp), cast(trim('2016-07-12 18:23:44.141525-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ff72604dccdf6469de8c50fa979f2156' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update providers set agent_configuration = replace (agent_configuration, '"qpidConfiguration" : {', E'"messagingConfiguration" : {\n "brokerType" : "QPID",'); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050420'), 'upgrade/03_05_0420_generalize_messaging_broker_type.sql', 'ff72604dccdf6469de8c50fa979f2156', 'engine', cast(trim('2016-07-12 18:23:44.174589-04') as timestamp), cast(trim('2016-07-12 18:23:44.200777-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '10ac58bb1d43eab9a414aeb95e05b2dc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_add_numa_tables() returns void AS $procedure$ BEGIN -- Numa nodes table CREATE TABLE numa_node ( numa_node_id UUID NOT NULL, vds_id UUID, vm_id UUID, numa_node_index SMALLINT, mem_total BIGINT, cpu_count SMALLINT, mem_free BIGINT, usage_mem_percent INTEGER, cpu_sys numeric(5,2), cpu_user numeric(5,2), cpu_idle numeric(5,2), usage_cpu_percent INTEGER, distance text, CONSTRAINT pk_numa_node PRIMARY KEY(numa_node_id), CONSTRAINT fk_numa_node_vds FOREIGN KEY(vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE, CONSTRAINT fk_numa_node_vm FOREIGN KEY(vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE ); -- Create partial index for numa nodes CREATE INDEX IDX_numa_node_vds_id ON numa_node(vds_id); CREATE INDEX IDX_numa_node_vm_id ON numa_node(vm_id); -- Vds cpu statistics table CREATE TABLE vds_cpu_statistics ( vds_cpu_id UUID NOT NULL, vds_id UUID NOT NULL, cpu_core_id SMALLINT, cpu_sys numeric(5,2), cpu_user numeric(5,2), cpu_idle numeric(5,2), usage_cpu_percent INTEGER, CONSTRAINT pk_vds_cpu_statistics PRIMARY KEY(vds_cpu_id), CONSTRAINT fk_vds_cpu_statistics_vds FOREIGN KEY(vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE ); -- Create partial index for vds cpu statistics CREATE INDEX IDX_vds_cpu_statistics_vds_id ON vds_cpu_statistics(vds_id); -- Numa nodes internal connection table CREATE TABLE vm_vds_numa_node_map ( id UUID NOT NULL, vm_numa_node_id UUID NOT NULL, vds_numa_node_id UUID, vds_numa_node_index SMALLINT, is_pinned BOOLEAN DEFAULT false NOT NULL, CONSTRAINT pk_vm_vds_numa_node_map PRIMARY KEY(id), CONSTRAINT fk_vm_vds_numa_node_map_vds_numa_node FOREIGN KEY(vds_numa_node_id) REFERENCES numa_node(numa_node_id) ON DELETE SET NULL, CONSTRAINT fk_vm_vds_numa_node_map_vm_numa_node FOREIGN KEY(vm_numa_node_id) REFERENCES numa_node(numa_node_id) ON DELETE CASCADE ); -- Create partial index for numa node map CREATE INDEX IDX_vm_vds_numa_node_map_vm_numa_node_id ON vm_vds_numa_node_map(vm_numa_node_id); CREATE INDEX IDX_vm_vds_numa_node_map_vds_numa_node_id ON vm_vds_numa_node_map(vds_numa_node_id); -- Numa node cpus table CREATE TABLE numa_node_cpu_map ( id UUID NOT NULL, numa_node_id UUID NOT NULL, cpu_core_id INTEGER, CONSTRAINT pk_numa_node_cpu_map PRIMARY KEY(id), CONSTRAINT fk_numa_node_cpu_map_numa_node FOREIGN KEY(numa_node_id) REFERENCES numa_node(numa_node_id) ON DELETE CASCADE ); -- Create partial index for numa node cpu map CREATE INDEX IDX_numa_node_cpu_map_numa_node_id ON numa_node_cpu_map(numa_node_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_add_numa_tables(); ************************** ********* QUERY ********** drop function __temp_add_numa_tables(); ************************** DROP FUNCTION ********* QUERY ********** Create or replace FUNCTION __temp_add_numa_columns() returns void AS $procedure$ BEGIN -- Add columns in table vm_static PERFORM fn_db_add_column('vm_static', 'numatune_mode', 'varchar(20)'); -- Add columns in table vds_dynamic PERFORM fn_db_add_column('vds_dynamic', 'auto_numa_balancing', 'smallint'); PERFORM fn_db_add_column('vds_dynamic', 'is_numa_supported', 'boolean'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_add_numa_columns(); ************************** ********* QUERY ********** drop function __temp_add_numa_columns(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050430'), 'upgrade/03_05_0430_add_numa_tables_and_columns.sql', '10ac58bb1d43eab9a414aeb95e05b2dc', 'engine', cast(trim('2016-07-12 18:23:44.241153-04') as timestamp), cast(trim('2016-07-12 18:23:45.516953-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '961f022fa17f16ef388681403d188c27' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('users', '_create_date', 'timestamp with time zone DEFAULT CURRENT_TIMESTAMP'); ************************** ********* QUERY ********** SELECT fn_db_add_column('users', '_update_date', 'timestamp with time zone'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050440'), 'upgrade/03_05_0440_add_create_and_update_dates_to_users_table.sql', '961f022fa17f16ef388681403d188c27', 'engine', cast(trim('2016-07-12 18:23:45.558326-04') as timestamp), cast(trim('2016-07-12 18:23:45.916882-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '009e1ca1910dba5c3299f7070e561787' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set numatune_mode ='preferred'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050450'), 'upgrade/03_05_0450_set_default_value_for_numa_tune_mode.sql', '009e1ca1910dba5c3299f7070e561787', 'engine', cast(trim('2016-07-12 18:23:45.95835-04') as timestamp), cast(trim('2016-07-12 18:23:46.064021-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4a249884378c2787d8d2d2d92c128aec' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE FUNCTION __temp_set_display_migration() RETURNS VOID AS $$ DECLARE mgmt_name CHARACTER VARYING(15); BEGIN SELECT option_value FROM vdc_options WHERE option_name='ManagementNetwork' INTO mgmt_name; UPDATE network_cluster nc1 SET is_display = true WHERE EXISTS (SELECT 1 FROM network WHERE network.id = nc1.network_id AND name = mgmt_name) AND NOT EXISTS (SELECT 1 FROM network_cluster nc2 WHERE nc2.cluster_id = nc1.cluster_id AND nc2.is_display); UPDATE network_cluster nc1 SET migration = true WHERE EXISTS (SELECT 1 FROM network WHERE network.id = nc1.network_id AND name = mgmt_name) AND NOT EXISTS (SELECT 1 FROM network_cluster nc2 WHERE nc2.cluster_id = nc1.cluster_id AND nc2.migration); END; $$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_set_display_migration(); ************************** ********* QUERY ********** DROP FUNCTION __temp_set_display_migration(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050460'), 'upgrade/03_05_0460_set_display_migration_cluster_network.sql', '4a249884378c2787d8d2d2d92c128aec', 'engine', cast(trim('2016-07-12 18:23:46.099919-04') as timestamp), cast(trim('2016-07-12 18:23:46.191582-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5d3b6047971973fb9ac5143ff9fd4b21' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vm_static as a SET child_count =(SELECT COUNT(*) FROM vm_static as b WHERE a.vm_guid = b.vmt_guid and entity_type = 'VM'); ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050470'), 'upgrade/03_05_0470_update_vm_static_child_count.sql', '5d3b6047971973fb9ac5143ff9fd4b21', 'engine', cast(trim('2016-07-12 18:23:46.233031-04') as timestamp), cast(trim('2016-07-12 18:23:46.291291-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2a369ed5c06b4f5e9a1226f806446627' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** alter table vm_init add column org_name VARCHAR(256) DEFAULT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050480'), 'upgrade/03_05_0480_add_org_name_for_sysprep.sql', '2a369ed5c06b4f5e9a1226f806446627', 'engine', cast(trim('2016-07-12 18:23:46.333008-04') as timestamp), cast(trim('2016-07-12 18:23:46.575407-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c75aa917b43ee25f513fb14a9004ce87' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** delete from vm_device a where device='smartcard' and device_id not in ( select device_id from vm_device where vm_id=a.vm_id and device='smartcard' limit 1); ************************** DELETE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050490'), 'upgrade/03_05_0490_remove_duplicate_smartcards.sql', 'c75aa917b43ee25f513fb14a9004ce87', 'engine', cast(trim('2016-07-12 18:23:46.61629-04') as timestamp), cast(trim('2016-07-12 18:23:46.643636-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '09fd2bcc67e2c43b46cccaec37f9d138' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'required_rng_sources', 'varchar(255)'); ************************** ********* QUERY ********** UPDATE vds_groups SET required_rng_sources = 'RANDOM' WHERE cast(compatibility_version as float) >= 3.5; ************************** UPDATE 1 ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'supported_rng_sources', 'varchar(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050500'), 'upgrade/03_05_0500_add_rng_device_columns.sql', '09fd2bcc67e2c43b46cccaec37f9d138', 'engine', cast(trim('2016-07-12 18:23:46.690964-04') as timestamp), cast(trim('2016-07-12 18:23:46.81662-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '62f334d941f846569109d1f209aa0bce' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE unregistered_ovf_of_entities ( entity_guid UUID, entity_name VARCHAR(255) NOT NULL, entity_type VARCHAR(32) NOT NULL, architecture INTEGER, lowest_comp_version VARCHAR(40), storage_domain_id UUID, ovf_data TEXT, ovf_extra_data TEXT, CONSTRAINT pk_entity_guid_storage_domain_unregistered PRIMARY KEY(entity_guid, storage_domain_id) ); ************************** CREATE TABLE ********* QUERY ********** ALTER TABLE unregistered_ovf_of_entities add constraint fk_unregistered_ovf_of_entities_storage_domain FOREIGN KEY (storage_domain_id) REFERENCES storage_domain_static(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050510'), 'upgrade/03_05_0510_unregistered_ovf_of_entities.sql', '62f334d941f846569109d1f209aa0bce', 'engine', cast(trim('2016-07-12 18:23:46.857822-04') as timestamp), cast(trim('2016-07-12 18:23:47.158069-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5e3107c4c71f37c16dfc0081764df9b3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units SET description='Gives hosts with higher CPU usage, lower weight (means that hosts with higher CPU usage are more likely to be selected)' WHERE id = '736999d0-1023-46a4-9a75-1316ed50e15b'; ************************** UPDATE 1 ********* QUERY ********** UPDATE policy_units SET description='Gives hosts with lower CPU usage, lower weight (means that hosts with lower CPU usage are more likely to be selected)' WHERE id = '7db4ab05-81ab-42e8-868a-aee2df483edb'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050520'), 'upgrade/03_05_0520_fix_description_of_balancing_policy_units.sql', '5e3107c4c71f37c16dfc0081764df9b3', 'engine', cast(trim('2016-07-12 18:23:47.199788-04') as timestamp), cast(trim('2016-07-12 18:23:47.283037-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'be5938c01964970ee44039d0b0e76f0f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE from event_map where event_up_name = 'VDS_INITIATED_RUN_VM_FAIL'; ************************** DELETE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050530'), 'upgrade/03_05_0530_remove_unused_event.sql', 'be5938c01964970ee44039d0b0e76f0f', 'engine', cast(trim('2016-07-12 18:23:47.324441-04') as timestamp), cast(trim('2016-07-12 18:23:47.374409-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '035fa5f8fa411067c1877bf722c29728' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'is_spice_file_transfer_enabled', 'boolean not null default true'); ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'is_spice_copy_paste_enabled', 'boolean not null default true'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050540'), 'upgrade/03_05_0540_add_spice_transfer_toggle.sql', '035fa5f8fa411067c1877bf722c29728', 'engine', cast(trim('2016-07-12 18:23:47.416325-04') as timestamp), cast(trim('2016-07-12 18:23:48.108973-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0809aee6013689fcf6166329387aecc4' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'is_live_snapshot_supported', 'boolean not null default true'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050550'), 'upgrade/03_05_0550_add_live_snapshot_support.sql', '0809aee6013689fcf6166329387aecc4', 'engine', cast(trim('2016-07-12 18:23:48.149528-04') as timestamp), cast(trim('2016-07-12 18:23:48.392121-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7dccff60f90e12097d50dee8435ce031' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('users', 'namespace', 'varchar(2048) default ''*'''); ************************** ********* QUERY ********** select fn_db_add_column('ad_groups', 'namespace', 'varchar(2048) default ''*'''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050560'), 'upgrade/03_05_0560_aaa_add_namespace.sql', '7dccff60f90e12097d50dee8435ce031', 'engine', cast(trim('2016-07-12 18:23:48.432777-04') as timestamp), cast(trim('2016-07-12 18:23:49.050336-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '95402941e8fb65a23c1be1711a45ef59' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE images SET imagestatus = 4 FROM snapshots WHERE images.vm_snapshot_id = snapshots.snapshot_id AND snapshots.status = 'BROKEN'; ************************** UPDATE 0 ********* QUERY ********** UPDATE snapshots SET status = 'OK' WHERE status = 'BROKEN'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050570'), 'upgrade/03_05_0570_deprecate_broken_snapshots.sql', '95402941e8fb65a23c1be1711a45ef59', 'engine', cast(trim('2016-07-12 18:23:49.091235-04') as timestamp), cast(trim('2016-07-12 18:23:49.149462-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3c4293c1763fba7597382d13c16ee16c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION do_insert_instance_type(v_name VARCHAR(255), v_description VARCHAR(4000), v_mem_size integer, v_num_of_sockets integer, v_cpu_per_socket integer) RETURNS VOID AS $procedure$ DECLARE v_instance_type_id UUID; BEGIN v_instance_type_id := uuid_generate_v1(); INSERT INTO vm_static (vm_guid, vm_name, mem_size_mb, vmt_guid, os, description, vds_group_id, creation_date, num_of_monitors, is_initialized, is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, time_zone, is_stateless, fail_back, _create_date, _update_date, dedicated_vm_for_vds, auto_startup, vm_type, nice_level, default_boot_sequence, default_display_type, priority, iso_path, origin, initrd_url, kernel_url, kernel_params, migration_support, userdefined_properties, predefined_properties, min_allocated_mem, entity_type, child_count, template_status, quota_id, allow_console_reconnect, cpu_pinning, is_smartcard_enabled) VALUES (v_instance_type_id, v_name, v_mem_size, v_instance_type_id, 0, v_description, NULL, '2014-05-05 00:00:00+03', 1, NULL, false, v_num_of_sockets, v_cpu_per_socket, 1, NULL, NULL, false, '2013-12-25 15:31:54.367179+02', '2013-12-25 15:31:53.239308+02', NULL, NULL, 0, 0, 0, 1, 0, '', 0, NULL, NULL, NULL, 0, NULL, NULL, 0, 'INSTANCE_TYPE', 0, 0, NULL, false, NULL, false); INSERT INTO permissions(id, role_id, ad_element_id, object_id, object_type_id) SELECT uuid_generate_v1(), 'DEF00009-0000-0000-0000-DEF000000009', -- UserTemplateBasedVm 'EEE00000-0000-0000-0000-123456789EEE', -- Everyone v_instance_type_id, 4 -- template ; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION insert_default_instance_types() RETURNS VOID AS $procedure$ BEGIN perform do_insert_instance_type('Tiny', 'Tiny instance type', 512, 1, 1); perform do_insert_instance_type('Small', 'Small instance type', 2048, 1, 1); perform do_insert_instance_type('Medium', 'Medium instance type', 4096, 1, 1); perform do_insert_instance_type('Large', 'Large instance type', 8192, 2, 1); perform do_insert_instance_type('XLarge', 'Extra Large instance type', 16384, 4, 1); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select insert_default_instance_types(); ************************** ********* QUERY ********** drop function insert_default_instance_types(); ************************** DROP FUNCTION ********* QUERY ********** drop function do_insert_instance_type(v_name VARCHAR(255), v_description VARCHAR(4000), v_mem_size integer, v_num_of_sockets integer, v_cpu_per_socket integer); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050580'), 'upgrade/03_05_0580_add_default_instance_types.sql', '3c4293c1763fba7597382d13c16ee16c', 'engine', cast(trim('2016-07-12 18:23:49.190949-04') as timestamp), cast(trim('2016-07-12 18:23:49.382786-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ad0205f7bbd76f7c3484a6e69a897ccd' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set time_zone=(select option_value from vdc_options where option_name = 'DefaultWindowsTimeZone') where time_zone is NULL and os in (select os_id from dwh_osinfo where os_name ilike '%windows%') and vm_guid != '00000000-0000-0000-0000-000000000000'; ************************** UPDATE 0 ********* QUERY ********** update vm_static set time_zone=(select option_value from vdc_options where option_name = 'DefaultGeneralTimeZone') where time_zone is NULL and os not in (select os_id from dwh_osinfo where os_name ilike '%windows%') and vm_guid != '00000000-0000-0000-0000-000000000000'; ************************** UPDATE 5 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050590'), 'upgrade/03_05_0590_set_default_time_zone.sql', 'ad0205f7bbd76f7c3484a6e69a897ccd', 'engine', cast(trim('2016-07-12 18:23:49.424469-04') as timestamp), cast(trim('2016-07-12 18:23:49.482774-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'afe0fd01716963b36635aa00117d3c9f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE images DROP CONSTRAINT image_templates_images; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050600'), 'upgrade/03_05_0600_drop_images_fk.sql', 'afe0fd01716963b36635aa00117d3c9f', 'engine', cast(trim('2016-07-12 18:23:49.524366-04') as timestamp), cast(trim('2016-07-12 18:23:49.582567-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9056f5e77325bee56f388b63e34267b2' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE command_entities ( command_id UUID NOT NULL, command_type integer NOT NULL, root_command_id UUID DEFAULT NULL, action_parameters text, action_parameters_class varchar(256), created_at TIMESTAMP WITH TIME ZONE, status varchar(20) DEFAULT NULL, CONSTRAINT pk_command_entities PRIMARY KEY(command_id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX idx_root_command_id ON command_entities(root_command_id) WHERE root_command_id IS NOT NULL; ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050610'), 'upgrade/03_05_0610_add_command_entity_table.sql', '9056f5e77325bee56f388b63e34267b2', 'engine', cast(trim('2016-07-12 18:23:49.624268-04') as timestamp), cast(trim('2016-07-12 18:23:49.990991-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '381323f5832d0ec6637866ec1caa5e7f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE cluster_policies SET name = 'evenly_distributed' WHERE name = 'Evenly_Distributed'; ************************** UPDATE 1 ********* QUERY ********** UPDATE cluster_policies SET name = 'power_saving' WHERE name = 'Power_Saving'; ************************** UPDATE 1 ********* QUERY ********** UPDATE cluster_policies SET name = 'none' WHERE name = 'None'; ************************** UPDATE 1 ********* QUERY ********** UPDATE cluster_policies SET name = 'vm_evenly_distributed' WHERE name = 'VM_Evenly_Distributed'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050620'), 'upgrade/03_05_0620_lowercase_default_cluster_policies_names.sql', '381323f5832d0ec6637866ec1caa5e7f', 'engine', cast(trim('2016-07-12 18:23:50.032371-04') as timestamp), cast(trim('2016-07-12 18:23:50.18252-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '252d39ba56de127146bcaaeccb04ba3f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_static', 'protocol', 'SMALLINT NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050630'), 'upgrade/03_05_0630_add_host_protocol.sql', '252d39ba56de127146bcaaeccb04ba3f', 'engine', cast(trim('2016-07-12 18:23:50.224037-04') as timestamp), cast(trim('2016-07-12 18:23:50.683783-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fcc7481bf4866042df9646cd16f4cde9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE external_variable ( var_name VARCHAR(100) NOT NULL, var_value VARCHAR(4000), _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_external_variable PRIMARY KEY(var_name) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050640'), 'upgrade/03_05_0640_add_external_variable.sql', 'fcc7481bf4866042df9646cd16f4cde9', 'engine', cast(trim('2016-07-12 18:23:50.724109-04') as timestamp), cast(trim('2016-07-12 18:23:50.949232-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3db84fa310408632f0848586bfae6df4' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE vds_kdump_status ( vds_id UUID NOT NULL, status VARCHAR(20) NOT NULL, address VARCHAR(255) NOT NULL, CONSTRAINT pk_vds_kdump_status PRIMARY KEY(vds_id), CONSTRAINT fk_vds_kdump_status_vds_static FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX idx_vds_kdump_status_status ON vds_kdump_status(status); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050650'), 'upgrade/03_05_0650_add_vds_kdump_status.sql', '3db84fa310408632f0848586bfae6df4', 'engine', cast(trim('2016-07-12 18:23:50.990861-04') as timestamp), cast(trim('2016-07-12 18:23:51.22429-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4f6a301feaebccb5e2a18c83052c48bb' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_drop_column ('async_tasks', 'action_parameters'); ************************** ********* QUERY ********** select fn_db_drop_column ('async_tasks', 'action_params_class'); ************************** ********* QUERY ********** select fn_db_drop_column ('async_tasks', 'root_command_id'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050660'), 'upgrade/03_05_0660_remove_command_from_async_tasks.sql', '4f6a301feaebccb5e2a18c83052c48bb', 'engine', cast(trim('2016-07-12 18:23:51.265914-04') as timestamp), cast(trim('2016-07-12 18:23:51.374315-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'cb407acaa7be3a278361036c225feb00' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'callback_enabled', 'boolean default false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050670'), 'upgrade/03_05_0670_add_cmd_entity_callback_enabled.sql', 'cb407acaa7be3a278361036c225feb00', 'engine', cast(trim('2016-07-12 18:23:51.415842-04') as timestamp), cast(trim('2016-07-12 18:23:51.716853-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '375dc0d8e71ce26aeb3b021ff2d33a3e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'callback_notified', 'boolean default false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050680'), 'upgrade/03_05_0680_add_cmd_entity_callback_notified.sql', '375dc0d8e71ce26aeb3b021ff2d33a3e', 'engine', cast(trim('2016-07-12 18:23:51.757482-04') as timestamp), cast(trim('2016-07-12 18:23:52.091854-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c493140a6de6188ad213e7bf7d5d316f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'return_value', 'text'); ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'return_value_class', 'varchar(256)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050690'), 'upgrade/03_05_0690_add_cmd_entity_return_value.sql', 'c493140a6de6188ad213e7bf7d5d316f', 'engine', cast(trim('2016-07-12 18:23:52.132494-04') as timestamp), cast(trim('2016-07-12 18:23:52.224291-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8b8f2782f0547867d6cdbc33e80687ac' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE vm_jobs ( vm_job_id UUID NOT NULL, vm_id UUID NOT NULL, job_state INTEGER DEFAULT 0 NOT NULL, job_type INTEGER NOT NULL, block_job_type INTEGER, bandwidth INTEGER, cursor_cur BIGINT, cursor_end BIGINT, image_group_id UUID, CONSTRAINT pk_vm_jobs PRIMARY KEY(vm_job_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX IDX_vm_jobs_vm_id ON vm_jobs(vm_id); ************************** CREATE INDEX ********* QUERY ********** ALTER TABLE ONLY vm_jobs ADD CONSTRAINT fk_vm_jobs_vm_static FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050700'), 'upgrade/03_05_0700_create_vm_jobs_table.sql', '8b8f2782f0547867d6cdbc33e80687ac', 'engine', cast(trim('2016-07-12 18:23:52.265909-04') as timestamp), cast(trim('2016-07-12 18:23:52.57433-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4052e44109b3829bfe45dda25635452d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO ROLES_GROUPS(role_id,action_group_id) VALUES('DEF00008-0000-0000-0000-DEF000000008', 502); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO ROLES_GROUPS(role_id,action_group_id) VALUES('DEF00008-0000-0000-0000-DEF000000008', 503); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050710'), 'upgrade/03_05_0710_add_manipulate_permissions_for_template_admin.sql', '4052e44109b3829bfe45dda25635452d', 'engine', cast(trim('2016-07-12 18:23:52.615779-04') as timestamp), cast(trim('2016-07-12 18:23:52.707265-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd5433d14ca79628a3c508f987a1aac45' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_index('IDX_unregistered_ovf_of_entities_storage_domain_id', 'unregistered_ovf_of_entities', 'storage_domain_id', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050720'), 'upgrade/03_05_0720_index_for_stoarge_domain_id_in_unregistered_ovf_of_entities.sql', 'd5433d14ca79628a3c508f987a1aac45', 'engine', cast(trim('2016-07-12 18:23:52.749102-04') as timestamp), cast(trim('2016-07-12 18:23:52.899235-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9f391723ab1a0779bdfabe9e5cbcab9f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE disk_image_dynamic DROP CONSTRAINT fk_disk_image_dynamic_images; ************************** ALTER TABLE ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_image_deleted() RETURNS TRIGGER AS $$ BEGIN DELETE FROM disk_image_dynamic dim WHERE DIM.image_id = OLD.image_guid; RETURN OLD; END; $$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE TRIGGER delete_disk_image_dynamic_for_image BEFORE DELETE ON IMAGES FOR EACH ROW EXECUTE PROCEDURE fn_image_deleted() ************************** CREATE TRIGGER ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050730'), 'upgrade/03_05_0730_drop_disk_image_dynamic_fk.sql', '9f391723ab1a0779bdfabe9e5cbcab9f', 'engine', cast(trim('2016-07-12 18:23:52.940804-04') as timestamp), cast(trim('2016-07-12 18:23:53.057585-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '39e7babc1790e0e00170dab2ac439c31' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static s set min_allocated_mem = (select mem_size_mb from vm_static where vm_guid = s.vm_guid) where s.min_allocated_mem = 0 and entity_type = 'INSTANCE_TYPE'; ************************** UPDATE 5 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050740'), 'upgrade/03_05_0740_min_allocated_memory_on_instance_type.sql', '39e7babc1790e0e00170dab2ac439c31', 'engine', cast(trim('2016-07-12 18:23:53.099062-04') as timestamp), cast(trim('2016-07-12 18:23:53.157526-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c78e763da87f6bdfadb27d85fe49458e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM disk_image_dynamic WHERE image_id NOT IN (SELECT image_guid FROM images); ************************** DELETE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03050750'), 'upgrade/03_05_0750_delete_orphand_disk_image_dynamic_records.sql', 'c78e763da87f6bdfadb27d85fe49458e', 'engine', cast(trim('2016-07-12 18:23:53.19884-04') as timestamp), cast(trim('2016-07-12 18:23:53.22527-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e68282af5c0f20005eee9db013fa5d50' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vds_groups SET cpu_name = 'Intel Haswell Family' WHERE cpu_name = 'Intel Haswell'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060010'), 'upgrade/03_06_0010_update_haswell_vds_to_new_name.sql', 'e68282af5c0f20005eee9db013fa5d50', 'engine', cast(trim('2016-07-12 18:23:53.265999-04') as timestamp), cast(trim('2016-07-12 18:23:53.293422-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9b42cb74020184652b1cf9ca8521856d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'job_id', 'UUID DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'step_id', 'UUID DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060020'), 'upgrade/03_06_0020_add_job_step_ids_to_command_entities.sql', '9b42cb74020184652b1cf9ca8521856d', 'engine', cast(trim('2016-07-12 18:23:53.332427-04') as timestamp), cast(trim('2016-07-12 18:23:53.432676-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1db86a77ba72ce4a1e6374245a0a2e1b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update users set name = username where domain='internal'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060030'), 'upgrade/03_06_0030_set_name_for_internal_user.sql', '1db86a77ba72ce4a1e6374245a0a2e1b', 'engine', cast(trim('2016-07-12 18:23:53.473838-04') as timestamp), cast(trim('2016-07-12 18:23:53.500725-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'dfd3b1655956059ece95c610405ee25b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set numatune_mode ='interleave'; ************************** UPDATE 6 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060040'), 'upgrade/03_06_0040_modify_default_value_of_numa_tune_mode.sql', 'dfd3b1655956059ece95c610405ee25b', 'engine', cast(trim('2016-07-12 18:23:53.540469-04') as timestamp), cast(trim('2016-07-12 18:23:53.59041-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ed8dc29e8a271c9d1231f2948c0b724f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set origin= case when exists (select * from vdc_options where option_name = 'OriginType' and option_value = 'RHEV') then 0 else 3 end where vm_guid='00000000-0000-0000-0000-000000000000'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060050'), 'upgrade/03_06_0050_update_blank_template_origin_type.sql', 'ed8dc29e8a271c9d1231f2948c0b724f', 'engine', cast(trim('2016-07-12 18:23:53.632135-04') as timestamp), cast(trim('2016-07-12 18:23:53.690504-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ea234bcccebcf4ec5e3ada7fd325658d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'executed', 'boolean default false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060060'), 'upgrade/03_06_0060_add_executed_to_command_entities.sql', 'ea234bcccebcf4ec5e3ada7fd325658d', 'engine', cast(trim('2016-07-12 18:23:53.731958-04') as timestamp), cast(trim('2016-07-12 18:23:54.082971-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3eae5f0e42050fb4b35d8ff8acb33ec3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE base_disks SET sgio = NULL WHERE base_disks.disk_id IN (SELECT device_id FROM vm_device WHERE is_readonly = TRUE); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060070'), 'upgrade/03_06_0070_update_sgio_for_readonly_disks.sql', '3eae5f0e42050fb4b35d8ff8acb33ec3', 'engine', cast(trim('2016-07-12 18:23:54.123501-04') as timestamp), cast(trim('2016-07-12 18:23:54.150278-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4ea8dd52ef16801e80a8b9c785d6ab6e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vds_groups SET required_rng_sources = '' WHERE cast(compatibility_version as float) <= 3.5 AND cast (vds_group_id as text) = (select option_value from vdc_options where option_name = 'AutoRegistrationDefaultVdsGroupID'); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060080'), 'upgrade/03_06_0080_reset_rng_sources.sql', '4ea8dd52ef16801e80a8b9c785d6ab6e', 'engine', cast(trim('2016-07-12 18:23:54.19016-04') as timestamp), cast(trim('2016-07-12 18:23:54.217663-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'bd4c1547df0faf3f68bddfd0f072a4c1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE mac_pools ( id UUID NOT NULL PRIMARY KEY, name CHARACTER VARYING(255), description CHARACTER VARYING(4000), allow_duplicate_mac_addresses BOOLEAN NOT NULL DEFAULT FALSE, default_pool BOOLEAN NOT NULL DEFAULT FALSE ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE mac_pool_ranges ( mac_pool_id UUID NOT NULL REFERENCES mac_pools (id) ON DELETE CASCADE, from_mac CHARACTER VARYING(17) NOT NULL, to_mac CHARACTER VARYING(17) NOT NULL ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_add_column('storage_pool', 'mac_pool_id', 'UUID REFERENCES mac_pools (id)'); ************************** ********* QUERY ********** INSERT INTO mac_pools (id, name, allow_duplicate_mac_addresses, description, default_pool) SELECT uuid_generate_v1(), 'Default', (SELECT option_value :: BOOLEAN FROM vdc_options WHERE option_name = 'AllowDuplicateMacAddresses'), 'Default MAC pool', TRUE; ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO mac_pool_ranges (mac_pool_id, from_mac, to_mac) SELECT (SELECT id FROM mac_pools), mac_range[1], mac_range[2] FROM (SELECT string_to_array(unnest(string_to_array(option_value, ',')),'-') as mac_range FROM vdc_options WHERE option_name = 'MacPoolRanges') as mac_ranges; ************************** INSERT 18600 1 ********* QUERY ********** UPDATE storage_pool SET mac_pool_id = (SELECT id FROM mac_pools); ************************** UPDATE 1 ********* QUERY ********** ALTER TABLE storage_pool ALTER COLUMN mac_pool_id SET NOT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060090'), 'upgrade/03_06_0090_add_mac_pool_ranges_to_storage_pool.sql', 'bd4c1547df0faf3f68bddfd0f072a4c1', 'engine', cast(trim('2016-07-12 18:23:54.256734-04') as timestamp), cast(trim('2016-07-12 18:23:54.648943-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '62394f326e95b91f58761edcac1045dc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_static', 'host_provider_id', 'UUID'); ************************** ********* QUERY ********** ALTER TABLE vds_static ADD CONSTRAINT fk_vds_static_host_provider_id FOREIGN KEY (host_provider_id) REFERENCES providers(id) ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060100'), 'upgrade/03_06_0100_add_provider_host_id_vdsstatic.sql', '62394f326e95b91f58761edcac1045dc', 'engine', cast(trim('2016-07-12 18:23:54.690318-04') as timestamp), cast(trim('2016-07-12 18:23:54.782102-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1906f0fd8a94b4471c721886670c6bf0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_insert_mac_pool_roles_and_permissions() RETURNS VOID AS $procedure$ DECLARE v_EVERYONE UUID; v_MAC_POOL_ADMIN UUID; v_MAC_POOL_USER UUID; v_SUPER_USER_ID UUID; v_CREATE_MAC_POOL INTEGER; v_EDIT_MAC_POOL INTEGER; v_DELETE_MAC_POOL INTEGER; v_CONFIGURE_MAC_POOL INTEGER; v_LOGIN INTEGER; v_APP_MODE INTEGER; BEGIN v_EVERYONE := 'EEE00000-0000-0000-0000-123456789EEE'; v_MAC_POOL_ADMIN := 'DEF00013-0000-0000-0000-DEF000000013'; v_MAC_POOL_USER := 'DEF00014-0000-0000-0000-DEF000000014'; v_SUPER_USER_ID := '00000000-0000-0000-0000-000000000001'; v_CREATE_MAC_POOL := 1660; v_EDIT_MAC_POOL := 1661; v_DELETE_MAC_POOL := 1662; v_CONFIGURE_MAC_POOL := 1663; v_LOGIN := 1300; v_APP_MODE := 1; INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) SELECT v_MAC_POOL_ADMIN, 'MacPoolAdmin', 'MAC Pool Administrator Role, permission for manipulation with MAC pools', true, 1, true, v_APP_MODE; INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) SELECT v_MAC_POOL_USER, 'MacPoolUser', 'MAC Pool User Role, permission allowing using MAC pools', true, 1, true, v_APP_MODE; INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_ADMIN, v_CREATE_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_ADMIN, v_EDIT_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_ADMIN, v_DELETE_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_ADMIN, v_CONFIGURE_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_ADMIN, v_LOGIN); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_USER, v_CONFIGURE_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_MAC_POOL_USER, v_LOGIN); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_SUPER_USER_ID, v_CREATE_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_SUPER_USER_ID, v_EDIT_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_SUPER_USER_ID, v_DELETE_MAC_POOL); INSERT INTO roles_groups (role_id, action_group_id) VALUES (v_SUPER_USER_ID, v_CONFIGURE_MAC_POOL); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_insert_mac_pool_roles_and_permissions(); ************************** ********* QUERY ********** DROP FUNCTION __temp_insert_mac_pool_roles_and_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060110'), 'upgrade/03_06_0110_add_permissions_to_mac_pools.sql', '1906f0fd8a94b4471c721886670c6bf0', 'engine', cast(trim('2016-07-12 18:23:54.823855-04') as timestamp), cast(trim('2016-07-12 18:23:54.931998-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b10e7c5650faa51f51f70ec668b03104' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_groups', 'skip_fencing_if_sd_active', 'boolean DEFAULT false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060120'), 'upgrade/03_06_0120_skip_fencing_when_sd_is_alive.sql', 'b10e7c5650faa51f51f70ec668b03104', 'engine', cast(trim('2016-07-12 18:23:54.974104-04') as timestamp), cast(trim('2016-07-12 18:23:55.182912-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0786621ebc6849561782b3d783712863' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'is_live_merge_supported', 'boolean not null default true'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060130'), 'upgrade/03_06_0130_add_live_merge_supported.sql', '0786621ebc6849561782b3d783712863', 'engine', cast(trim('2016-07-12 18:23:55.223445-04') as timestamp), cast(trim('2016-07-12 18:23:55.441161-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7b0161f7d98392f6a7ee36746efb88f0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_rename_column('async_tasks', 'task_parameters', 'action_parameters'); ************************** ********* QUERY ********** select fn_db_rename_column('async_tasks', 'task_params_class', 'action_params_class'); ************************** ********* QUERY ********** select fn_db_rename_column('command_entities', 'action_parameters', 'command_parameters'); ************************** ********* QUERY ********** select fn_db_rename_column('command_entities', 'action_parameters_class', 'command_params_class'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060140'), 'upgrade/03_06_0140_rename_async_tasks_columns.sql', '7b0161f7d98392f6a7ee36746efb88f0', 'engine', cast(trim('2016-07-12 18:23:55.481804-04') as timestamp), cast(trim('2016-07-12 18:23:55.615275-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '437092e7be64e5fca4cbc56163929494' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vm_device SET address = '' WHERE is_managed AND device = 'disk' AND NOT is_plugged; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060150'), 'upgrade/03_06_0150_clear_address_for_unplugged_disks.sql', '437092e7be64e5fca4cbc56163929494', 'engine', cast(trim('2016-07-12 18:23:55.656826-04') as timestamp), cast(trim('2016-07-12 18:23:55.683994-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fb1715183db420fb3f3a897fe5e33691' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO dwh_history_timekeeping VALUES('dwhHostname', NULL, NULL); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO dwh_history_timekeeping VALUES('dwhUuid', NULL, NULL); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060160'), 'upgrade/03_06_0160_add_dwh_hostname_and_uuid.sql', 'fb1715183db420fb3f3a897fe5e33691', 'engine', cast(trim('2016-07-12 18:23:55.723471-04') as timestamp), cast(trim('2016-07-12 18:23:55.798446-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '025abccb8ef8aa33f4cda71a6607fdfe' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE qos ( id uuid NOT NULL, qos_type SMALLINT NOT NULL, name VARCHAR(50) NOT NULL, description TEXT, storage_pool_id uuid NOT NULL, max_throughput INTEGER, max_read_throughput INTEGER, max_write_throughput INTEGER, max_iops INTEGER, max_read_iops INTEGER, max_write_iops INTEGER, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE default NULL, CONSTRAINT PK_qos_id PRIMARY KEY (id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** ALTER TABLE qos ADD CONSTRAINT fk_qos_storage_pool FOREIGN KEY (storage_pool_id) REFERENCES storage_pool (id) ON UPDATE NO ACTION ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** CREATE INDEX IDX_qos_storage_pool_id ON qos (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060170'), 'upgrade/03_06_0170_add_qos_table.sql', '025abccb8ef8aa33f4cda71a6607fdfe', 'engine', cast(trim('2016-07-12 18:23:55.83996-04') as timestamp), cast(trim('2016-07-12 18:23:56.182414-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '45aad4361bb9e94625e0ff4f4b5dfac7' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE disk_profiles ( id UUID PRIMARY KEY, name VARCHAR(50) NOT NULL, storage_domain_id UUID NOT NULL, qos_id UUID, description TEXT, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE, FOREIGN KEY (storage_domain_id) REFERENCES storage_domain_static(id) ON DELETE CASCADE, FOREIGN KEY (qos_id) REFERENCES qos(id) ON DELETE SET NULL ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** DROP INDEX IF EXISTS IDX_disk_profiles_storage_domain_id; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_disk_profiles_storage_domain_id ON disk_profiles(storage_domain_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060180'), 'upgrade/03_06_0180_add_disk_profiles_table.sql', '45aad4361bb9e94625e0ff4f4b5dfac7', 'engine', cast(trim('2016-07-12 18:23:56.223519-04') as timestamp), cast(trim('2016-07-12 18:23:56.573674-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '52daebd94e928f8ae11ce5720b585f20' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) SELECT DISTINCT role_id, 1560 FROM roles_groups a WHERE NOT EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND b.action_group_id = 1560) AND EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND (b.action_group_id = 601 OR b.action_group_id = 603)); ************************** INSERT 0 3 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) SELECT DISTINCT role_id, 1561 FROM roles_groups a WHERE NOT EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND b.action_group_id = 1561) AND EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND b.action_group_id = 600); ************************** INSERT 0 3 ********* QUERY ********** INSERT INTO roles_groups (role_id, action_group_id) SELECT DISTINCT role_id, 1562 FROM roles_groups a WHERE NOT EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND b.action_group_id = 1562) AND EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND b.action_group_id = 602); ************************** INSERT 0 3 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060190'), 'upgrade/03_06_0190_add_disk_profile_action_groups.sql', '52daebd94e928f8ae11ce5720b585f20', 'engine', cast(trim('2016-07-12 18:23:56.615013-04') as timestamp), cast(trim('2016-07-12 18:23:56.715139-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7ff663d26c754e27b8562e884f30c79f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_drop_column ('ad_groups', 'active'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060200'), 'upgrade/03_06_0200_remove_active_column_from_groups.sql', '7ff663d26c754e27b8562e884f30c79f', 'engine', cast(trim('2016-07-12 18:23:56.756784-04') as timestamp), cast(trim('2016-07-12 18:23:56.815329-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3e7d1799e37609886e05c80b36d18893' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_groups', 'skip_fencing_if_connectivity_broken', 'boolean DEFAULT false'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_groups', 'hosts_with_broken_connectivity_threshold', 'smallint DEFAULT 50'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060210'), 'upgrade/03_06_0210_skip_fencing_when_connectivity_broken.sql', '3e7d1799e37609886e05c80b36d18893', 'engine', cast(trim('2016-07-12 18:23:56.856649-04') as timestamp), cast(trim('2016-07-12 18:23:57.357468-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3cfde79c9b9b559267dfe49cfb367f74' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_statistics', 'memory_usage_history', 'TEXT DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_statistics', 'cpu_usage_history', 'TEXT DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_statistics', 'network_usage_history', 'TEXT DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060220'), 'upgrade/03_06_0220_add_history_data_to_vm_statistics.sql', '3cfde79c9b9b559267dfe49cfb367f74', 'engine', cast(trim('2016-07-12 18:23:57.398233-04') as timestamp), cast(trim('2016-07-12 18:23:57.506755-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e7d5246a45d15d25715b055caf97e227' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_groups', 'fencing_enabled', 'boolean DEFAULT true'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060230'), 'upgrade/03_06_0230_disable_fencing_in_cluster.sql', 'e7d5246a45d15d25715b055caf97e227', 'engine', cast(trim('2016-07-12 18:23:57.548063-04') as timestamp), cast(trim('2016-07-12 18:23:57.790853-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1a34b3c5bcb75f883936011b0f65a31e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT 03060240; ************************** 3060240 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060240'), 'upgrade/03_06_0240_update_disk_bootable_shareable.sql', '1a34b3c5bcb75f883936011b0f65a31e', 'engine', cast(trim('2016-07-12 18:23:57.831648-04') as timestamp), cast(trim('2016-07-12 18:23:57.857583-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ede7d79adaed3de625e0e180b066a0c1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('image_storage_domain_map', 'disk_profile_id', 'UUID NULL'); ************************** ********* QUERY ********** DROP INDEX IF EXISTS IDX_image_storage_domain_map_profile_id; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_image_storage_domain_map_profile_id ON image_storage_domain_map(disk_profile_id); ************************** CREATE INDEX ********* QUERY ********** ALTER TABLE image_storage_domain_map ADD CONSTRAINT FK_image_storage_domain_map_disk_profile_id FOREIGN KEY(disk_profile_id) REFERENCES disk_profiles(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** INSERT INTO disk_profiles(id, name, storage_domain_id) SELECT uuid_generate_v1(), storage_domain_static.storage_name, storage_domain_static.id FROM storage_pool LEFT OUTER JOIN storage_pool_iso_map ON storage_pool.id = storage_pool_iso_map.storage_pool_id LEFT OUTER JOIN storage_domain_static ON storage_pool_iso_map.storage_id = storage_domain_static.id WHERE (storage_domain_static.storage_domain_type = 0 OR storage_domain_static.storage_domain_type = 1) AND cast(storage_pool.compatibility_version as float) >= 3.5; ************************** INSERT 0 0 ********* QUERY ********** UPDATE image_storage_domain_map SET disk_profile_id = disk_profiles.id FROM disk_profiles WHERE image_storage_domain_map.storage_domain_id = disk_profiles.storage_domain_id; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060250'), 'upgrade/03_06_0250_disk_profile_for_disk_image.sql', 'ede7d79adaed3de625e0e180b066a0c1', 'engine', cast(trim('2016-07-12 18:23:57.897971-04') as timestamp), cast(trim('2016-07-12 18:23:58.115403-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5ce4e9fade642e8b138edcb182b499ba' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE network SET label = NULL WHERE provider_network_external_id IS NOT NULL; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060260'), 'upgrade/03_06_0260_remove_external_network_labels.sql', '5ce4e9fade642e8b138edcb182b499ba', 'engine', cast(trim('2016-07-12 18:23:58.156627-04') as timestamp), cast(trim('2016-07-12 18:23:58.183571-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7309ccc0bbacc19bd3df6835f34544a8' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE images SET volume_type = 2 WHERE volume_type = 1 AND volume_format = 4; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060270'), 'upgrade/03_06_0270_convert_cow_preallocated_to_cow_sparse.sql', '7309ccc0bbacc19bd3df6835f34544a8', 'engine', cast(trim('2016-07-12 18:23:58.223097-04') as timestamp), cast(trim('2016-07-12 18:23:58.249105-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e02ea7f83ad872218441c4fcdc49d54c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'cpu_limit', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060280'), 'upgrade/03_06_0280_add_cpu_limit_to_qos_table.sql', 'e02ea7f83ad872218441c4fcdc49d54c', 'engine', cast(trim('2016-07-12 18:23:58.28963-04') as timestamp), cast(trim('2016-07-12 18:23:58.390112-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8b1e76c45a6855f65f07356ccaf4113e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE cpu_profiles ( id UUID PRIMARY KEY, name VARCHAR(50) NOT NULL, cluster_id UUID NOT NULL, qos_id UUID, description TEXT, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE, FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE, FOREIGN KEY (qos_id) REFERENCES qos(id) ON DELETE SET NULL ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** DROP INDEX IF EXISTS IDX_cpu_profiles_cluster_id; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_cpu_profiles_cluster_id ON cpu_profiles(cluster_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060290'), 'upgrade/03_06_0290_add_cpu_profiles_table.sql', '8b1e76c45a6855f65f07356ccaf4113e', 'engine', cast(trim('2016-07-12 18:23:58.531503-04') as timestamp), cast(trim('2016-07-12 18:23:58.864846-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a3cac957441328d0b01d78bc29d64656' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_static', 'cpu_profile_id', 'UUID NULL'); ************************** ********* QUERY ********** DROP INDEX IF EXISTS IDX_vm_static_cpu_profile_id; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_vm_static_cpu_profile_id ON vm_static(cpu_profile_id); ************************** CREATE INDEX ********* QUERY ********** ALTER TABLE vm_static ADD CONSTRAINT FK_vm_static_cpu_profile_id FOREIGN KEY(cpu_profile_id) REFERENCES cpu_profiles(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE SET NULL; ************************** ALTER TABLE ********* QUERY ********** INSERT INTO cpu_profiles(id, name, cluster_id) SELECT uuid_generate_v1(), vds_groups.name, vds_groups.vds_group_id FROM vds_groups WHERE cast(compatibility_version as float) >= 3.5; ************************** INSERT 18714 1 ********* QUERY ********** UPDATE vm_static SET cpu_profile_id = cpu_profiles.id FROM cpu_profiles WHERE vm_static.vds_group_id = cpu_profiles.cluster_id; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060300'), 'upgrade/03_06_0300_add_cpu_profile_id_to_vm_static.sql', 'a3cac957441328d0b01d78bc29d64656', 'engine', cast(trim('2016-07-12 18:23:58.906213-04') as timestamp), cast(trim('2016-07-12 18:23:59.14842-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '48164c72dd519fa9f786d04513ffd541' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_device set is_managed=true where device='virtio-serial'; ************************** UPDATE 0 ********* QUERY ********** Create or replace FUNCTION __temp_add_missing_virio_serial_devices() RETURNS VOID AS $procedure$ DECLARE v_vm_guid UUID; BEGIN FOR v_vm_guid in (select vm_guid from vm_static where entity_type!='INSTANCE_TYPE' and vm_guid not in (select vm_id from vm_device where device='virtio-serial')) LOOP INSERT INTO vm_device (device_id, vm_id, type, device, address, spec_params, is_managed, is_plugged, custom_properties, snapshot_id) VALUES ((SELECT uuid_generate_v1()), v_vm_guid, 'controller', 'virtio-serial', '', '', true, true, '', NULL); END LOOP; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_add_missing_virio_serial_devices(); ************************** ********* QUERY ********** DROP function __temp_add_missing_virio_serial_devices(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060310'), 'upgrade/03_06_0310_change_virtio_serial_to_managed_device.sql', '48164c72dd519fa9f786d04513ffd541', 'engine', cast(trim('2016-07-12 18:23:59.189791-04') as timestamp), cast(trim('2016-07-12 18:23:59.289965-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fc50a5ee598dbaf3d58c8f3e29f2fb88' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vm_static SET cpu_profile_id = NULL where vm_guid = '00000000-0000-0000-0000-000000000000'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060320'), 'upgrade/03_06_0320_remove_blank_template_cpu_profile.sql', 'fc50a5ee598dbaf3d58c8f3e29f2fb88', 'engine', cast(trim('2016-07-12 18:23:59.331202-04') as timestamp), cast(trim('2016-07-12 18:23:59.381427-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8db41131fd32d309451bf1a2ae367846' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'inbound_average', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'inbound_peak', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'inbound_burst', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'outbound_average', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'outbound_peak', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'outbound_burst', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** INSERT INTO qos( id, qos_type, name, description, storage_pool_id, inbound_average, inbound_peak, inbound_burst, outbound_average, outbound_peak, outbound_burst, _create_date, _update_date) SELECT id, 3, name, NULL, storage_pool_id, inbound_average, inbound_peak, inbound_burst, outbound_average, outbound_peak, outbound_burst, _create_date, _update_date FROM network_qos; ************************** INSERT 0 0 ********* QUERY ********** SELECT fn_db_drop_constraint('vnic_profiles', 'FK_vnic_profiles_network_qos_id'); ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('network', 'fk_network_qos_id'); ************************** ********* QUERY ********** DROP TABLE network_qos; ************************** DROP TABLE ********* QUERY ********** SELECT fn_db_create_constraint('vnic_profiles', 'fk_vnic_profiles_network_qos_id', 'FOREIGN KEY (network_qos_id) REFERENCES qos(id) ON DELETE SET NULL'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('network', 'fk_network_qos_id', 'FOREIGN KEY (qos_id) REFERENCES qos(id) ON DELETE SET NULL'); ************************** ********* QUERY ********** ALTER TABLE qos ALTER COLUMN name DROP NOT NULL, ALTER COLUMN storage_pool_id DROP NOT NULL; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060330'), 'upgrade/03_06_0330_refactor_network_qos.sql', '8db41131fd32d309451bf1a2ae367846', 'engine', cast(trim('2016-07-12 18:23:59.422996-04') as timestamp), cast(trim('2016-07-12 18:23:59.75668-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '643b3922c1aea042de49ddf94a3595ae' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into event_map (event_up_name, event_down_name) values ('VDS_ACTIVATE_MANUAL_HA', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** insert into event_map (event_up_name, event_down_name) values ('CLUSTER_ALERT_HA_RESERVATION_DOWN', 'UNASSIGNED'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060340'), 'upgrade/03_06_0340_add_vds_activate_manual_ha_to_event_map.sql', '643b3922c1aea042de49ddf94a3595ae', 'engine', cast(trim('2016-07-12 18:23:59.797927-04') as timestamp), cast(trim('2016-07-12 18:23:59.872818-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '57018b279c962805f034c6cea285ef9d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('async_tasks', 'root_command_id', 'UUID DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_drop_column ('async_tasks', 'action_parameters'); ************************** ********* QUERY ********** select fn_db_drop_column ('async_tasks', 'action_params_class'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060350'), 'upgrade/03_06_0350_async_tasks_add_root_command_id.sql', '57018b279c962805f034c6cea285ef9d', 'engine', cast(trim('2016-07-12 18:23:59.914557-04') as timestamp), cast(trim('2016-07-12 18:24:00.023209-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a9d4400bdcf1ceea3778d5523f11456b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_remove_install_vds_upgrade_node_action_group_03_06_0360() RETURNS VOID AS $procedure$ DECLARE v_SUPER_USER_ID_0001 UUID; v_DATA_CENTER_ADMIN_ID UUID; v_CLUSTER_ADMIN_ID UUID; BEGIN v_SUPER_USER_ID_0001 := '00000000-0000-0000-0000-000000000001'; v_DATA_CENTER_ADMIN_ID := 'DEF00002-0000-0000-0000-DEF000000002'; v_CLUSTER_ADMIN_ID := 'DEF00001-0000-0000-0000-DEF000000001'; ------------------------- --- Update SuperUser role ------------------------- DELETE FROM roles_groups WHERE role_id = v_SUPER_USER_ID_0001 AND action_group_id=130; DELETE FROM roles_groups WHERE role_id = v_SUPER_USER_ID_0001 AND action_group_id=131; -------------------------------- -- UPDATE DATA_CENTER_ADMIN role -------------------------------- DELETE FROM roles_groups WHERE role_id = v_DATA_CENTER_ADMIN_ID AND action_group_id=130; DELETE FROM roles_groups WHERE role_id = v_DATA_CENTER_ADMIN_ID AND action_group_id=131; -------------------------------- -- UPDATE CLUSTER_ADMIN role -------------------------------- DELETE FROM roles_groups WHERE role_id = v_CLUSTER_ADMIN_ID AND action_group_id=130; DELETE FROM roles_groups WHERE role_id = v_CLUSTER_ADMIN_ID AND action_group_id=131; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_remove_install_vds_upgrade_node_action_group_03_06_0360(); ************************** ********* QUERY ********** DROP function __temp_remove_install_vds_upgrade_node_action_group_03_06_0360(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060360'), 'upgrade/03_06_0360_remove_install_vds_upgrade_ovirt_node_action_group.sql', 'a9d4400bdcf1ceea3778d5523f11456b', 'engine', cast(trim('2016-07-12 18:24:00.064617-04') as timestamp), cast(trim('2016-07-12 18:24:00.164559-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f2d6a312845dec7928f219ba806c2860' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE gluster_georep_session ( session_id UUID NOT NULL, master_volume_id UUID NOT NULL, session_key VARCHAR(150) NOT NULL, slave_host_uuid UUID, slave_host_name VARCHAR(50), slave_volume_id UUID, slave_volume_name VARCHAR(50), status VARCHAR, _create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_gluster_georep_session PRIMARY KEY(session_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE UNIQUE INDEX IDX_gluster_georep_session_unique ON gluster_georep_session(master_volume_id, session_key); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE gluster_georep_config ( session_id UUID NOT NULL, config_key VARCHAR(50), config_value VARCHAR(50), _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_gluster_georep_config PRIMARY KEY(session_id, config_key) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE gluster_georep_session_details ( session_id UUID NOT NULL, master_brick_id UUID NOT NULL, slave_host_uuid UUID, slave_host_name VARCHAR(50) NOT NULL, status VARCHAR(20), checkpoint_status VARCHAR(20), crawl_status VARCHAR(20), files_synced BIGINT, files_pending BIGINT, bytes_pending BIGINT, deletes_pending BIGINT, files_skipped BIGINT, _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_gluster_georep_session_details PRIMARY KEY(session_id, master_brick_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_georep_config ADD CONSTRAINT fk_gluster_georep_config_session_id FOREIGN KEY (session_id) REFERENCES gluster_georep_session(session_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_georep_session_details ADD CONSTRAINT fk_gluster_georep_details_session_id FOREIGN KEY (session_id) REFERENCES gluster_georep_session(session_id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_georep_session_details ADD CONSTRAINT fk_gluster_georep_details_brick_id FOREIGN KEY (master_brick_id) REFERENCES gluster_volume_bricks(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_georep_session ADD CONSTRAINT fk_gluster_georep_session_vol_id FOREIGN KEY (master_volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060370'), 'upgrade/03_06_0370_gluster_georep_tables.sql', 'f2d6a312845dec7928f219ba806c2860', 'engine', cast(trim('2016-07-12 18:24:00.206226-04') as timestamp), cast(trim('2016-07-12 18:24:00.931403-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'abf83fbb84d3a0979085473e9a46a540' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_update_config_value('EnableHostTimeDrift', 'true', 'general'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060380'), 'upgrade/03_06_0380_set_time_drift_validation.sql', 'abf83fbb84d3a0979085473e9a46a540', 'engine', cast(trim('2016-07-12 18:24:00.964264-04') as timestamp), cast(trim('2016-07-12 18:24:01.014798-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'db06556a8f3d201885b443f62fa9db07' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_device', 'logical_name', 'VARCHAR(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060390'), 'upgrade/03_06_0390_add_logical_name_to_vm_device.sql', 'db06556a8f3d201885b443f62fa9db07', 'engine', cast(trim('2016-07-12 18:24:01.048032-04') as timestamp), cast(trim('2016-07-12 18:24:01.106533-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'eb71314f085fb955d15ee9de515f75a3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE numa_node SET distance = NULL; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060400'), 'upgrade/03_06_0400_clear_numa_node_distance.sql', 'eb71314f085fb955d15ee9de515f75a3', 'engine', cast(trim('2016-07-12 18:24:01.139546-04') as timestamp), cast(trim('2016-07-12 18:24:01.165882-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b6c65700d6a6ca357c3832ca82a10d43' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_statistics', 'cpu_over_commit_time_stamp', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** update vds_statistics set cpu_over_commit_time_stamp = (select cpu_over_commit_time_stamp from vds_dynamic where vds_dynamic.vds_id = vds_statistics.vds_id); ************************** UPDATE 0 ********* QUERY ********** SELECT fn_db_drop_column('vds_dynamic', 'cpu_over_commit_time_stamp'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060410'), 'upgrade/03_06_0410_move_cpu_over_commit_to_vds_stats.sql', 'b6c65700d6a6ca357c3832ca82a10d43', 'engine', cast(trim('2016-07-12 18:24:01.206234-04') as timestamp), cast(trim('2016-07-12 18:24:01.289809-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1a2fe7c0928af5b3186f82ee1687ebb9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set numatune_mode ='interleave'; ************************** UPDATE 6 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060420'), 'upgrade/03_06_0420_set_interleave_default_value_for_numa_tune_mode.sql', '1a2fe7c0928af5b3186f82ee1687ebb9', 'engine', cast(trim('2016-07-12 18:24:01.322852-04') as timestamp), cast(trim('2016-07-12 18:24:01.37271-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0389f5d1a981d6144e7c47ccffa6cdd2' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update event_map set event_up_name = 'VM_MIGRATION_TO_SERVER_FAILED' where event_up_name='VM_MIGRATION_FAILED_FROM_TO'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060430'), 'upgrade/03_06_0430_add_migrate_to_server_failed_event.sql', '0389f5d1a981d6144e7c47ccffa6cdd2', 'engine', cast(trim('2016-07-12 18:24:01.406105-04') as timestamp), cast(trim('2016-07-12 18:24:01.456204-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '51e93b1e2ded9240dadc88a861949d35' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_index('IDX_images_images_group_id', 'images', 'image_group_id', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060440'), 'upgrade/03_06_0440_create_index_on_images.sql', '51e93b1e2ded9240dadc88a861949d35', 'engine', cast(trim('2016-07-12 18:24:01.489362-04') as timestamp), cast(trim('2016-07-12 18:24:01.639557-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'adb3aed20fb161657a76f4ea4ef77616' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_index('IDX_vm_device_vm_id', 'vm_device', 'vm_id', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060450'), 'upgrade/03_06_0450_create_index_on_vm_device.sql', 'adb3aed20fb161657a76f4ea4ef77616', 'engine', cast(trim('2016-07-12 18:24:01.672598-04') as timestamp), cast(trim('2016-07-12 18:24:01.814631-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '685b92eaa95225121f4e38f0c566e1c5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM vm_init WHERE vm_id = '00000000-0000-0000-0000-000000000000'; ************************** DELETE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060460'), 'upgrade/03_06_0460_remove_vm_init_for_blank_template.sql', '685b92eaa95225121f4e38f0c566e1c5', 'engine', cast(trim('2016-07-12 18:24:01.847743-04') as timestamp), cast(trim('2016-07-12 18:24:01.897874-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '99d7eb0377d4a5cd068399f0893c9905' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set num_of_sockets = 2 where instance_type_id in ( select vm_guid from vm_static where entity_type = 'INSTANCE_TYPE' and vm_name = 'Medium' and description = 'Medium instance type' and mem_size_mb = 4096 and num_of_sockets = 1 and cpu_per_socket = 1 ) or vm_guid in ( select vm_guid from vm_static where entity_type = 'INSTANCE_TYPE' and vm_name = 'Medium' and description = 'Medium instance type' and mem_size_mb = 4096 and num_of_sockets = 1 and cpu_per_socket = 1 ); ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060470'), 'upgrade/03_06_0470_medium_instance_type_has_two_cpus.sql', '99d7eb0377d4a5cd068399f0893c9905', 'engine', cast(trim('2016-07-12 18:24:01.93107-04') as timestamp), cast(trim('2016-07-12 18:24:01.981122-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd524fc4f9376ebfc3b5bd4a3246b77a4' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DROP INDEX if exists IDX_georep_slave_volume_name; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_georep_slave_volume_name ON gluster_georep_session(slave_volume_name); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060480'), 'upgrade/03_06_0480_add_idx_gluster_georep_slavevolname.sql', 'd524fc4f9376ebfc3b5bd4a3246b77a4', 'engine', cast(trim('2016-07-12 18:24:02.014437-04') as timestamp), cast(trim('2016-07-12 18:24:02.164561-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '51f94ef8204fe60118dfa69a87bc13cc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION create_default_disk_profiles() RETURNS VOID AS $$ DECLARE sd_id uuid; BEGIN RAISE NOTICE 'Assigning defaults disk profiles for all storage domains...'; INSERT INTO disk_profiles (SELECT uuid_generate_v1(), storage_name, id, NULL, 'Default unlimited disk profile' FROM storage_domain_static WHERE storage_domain_type IN (0,1) -- 0 and 1 are data domains type AND id NOT IN (select storage_domain_id from disk_profiles)); RAISE NOTICE 'Done Assigning default disk profiles.'; RETURN ; END; $$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT create_default_disk_profiles(); ************************** ********* QUERY ********** DROP FUNCTION create_default_disk_profiles(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060490'), 'upgrade/03_06_0490_create_default_disk_profiles.sql', '51f94ef8204fe60118dfa69a87bc13cc', 'engine', cast(trim('2016-07-12 18:24:02.206198-04') as timestamp), cast(trim('2016-07-12 18:24:02.306297-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a69de2dfc17b3327febb171d5e761c35' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('async_tasks', 'user_id', 'UUID DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060500'), 'upgrade/03_06_0500_add_user_id_to_async_tasks.sql', 'a69de2dfc17b3327febb171d5e761c35', 'engine', cast(trim('2016-07-12 18:24:02.339542-04') as timestamp), cast(trim('2016-07-12 18:24:02.398163-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'bbeb797962b42e96e097bcc3c8141115' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'online_cpus', 'TEXT'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060510'), 'upgrade/03_06_0510_add_online_cpu_list.sql', 'bbeb797962b42e96e097bcc3c8141115', 'engine', cast(trim('2016-07-12 18:24:02.439502-04') as timestamp), cast(trim('2016-07-12 18:24:02.497843-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2c4f492a4e1788f0219f4dedf732b5d3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_static', 'is_auto_converge', 'BOOLEAN DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_static', 'is_migrate_compressed', 'BOOLEAN DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_groups', 'is_auto_converge', 'BOOLEAN DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_groups', 'is_migrate_compressed', 'BOOLEAN DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060520'), 'upgrade/03_06_0520_add_vm_auto_convergence.sql', '2c4f492a4e1788f0219f4dedf732b5d3', 'engine', cast(trim('2016-07-12 18:24:02.553253-04') as timestamp), cast(trim('2016-07-12 18:24:02.681327-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4e5c0a7c90df04f9e39c1ac5e627147e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_create_constraint('async_tasks', 'fk_async_tasks_command_entities_command_id', 'FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('async_tasks', 'fk_async_tasks_command_entities_root_command_id', 'FOREIGN KEY (root_command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060530'), 'upgrade/03_06_0530_add_foreign_keys_to_async_tasks_table.sql', '4e5c0a7c90df04f9e39c1ac5e627147e', 'engine', cast(trim('2016-07-12 18:24:02.714508-04') as timestamp), cast(trim('2016-07-12 18:24:02.789587-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2e612ab661240910a32884da1b46bf40' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'custom_emulated_machine', 'character varying(40)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'custom_cpu_name', 'character varying(40)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'emulated_machine', 'varchar(255)'); ************************** ********* QUERY ********** UPDATE vm_dynamic SET cpu_name=converted_query.new_cpu_name FROM (SELECT vm_guid, CASE cpu_name WHEN 'Intel Conroe Family' THEN 'Conroe' WHEN 'Intel Penryn Family' THEN 'Penryn' WHEN 'Intel Nehalem Family' THEN 'Nehalem' WHEN 'Intel Westmere Family' THEN 'Westmere' WHEN 'Intel SandyBridge Family' THEN 'Conroe' WHEN 'Intel Haswell Family' THEN 'Haswell' WHEN 'AMD Opteron G1' THEN 'Opteron_G1' WHEN 'AMD Opteron G2' THEN 'Opteron_G2' WHEN 'AMD Opteron G3' THEN 'Opteron_G3' WHEN 'AMD Opteron G4' THEN 'Opteron_G4' WHEN 'AMD Opteron G5' THEN 'Opteron_G5' WHEN 'IBM POWER 7 v2.0' THEN 'POWER7_v2.0' WHEN 'IBM POWER 7 v2.1' THEN 'POWER7_v2.1' WHEN 'IBM POWER 7 v2.3' THEN 'POWER7_v2.3' WHEN 'IBM POWER 7+ v2.1' THEN 'POWER7+_v2.1' WHEN 'IBM POWER 8 v1.0' THEN 'POWER8_v1.0' ELSE inner_dynamic.cpu_name END AS new_cpu_name FROM vm_dynamic AS inner_dynamic) AS converted_query WHERE vm_dynamic.vm_guid=converted_query.vm_guid; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060540'), 'upgrade/03_06_0540_add_cluster_parameters_override_to_vm.sql', '2e612ab661240910a32884da1b46bf40', 'engine', cast(trim('2016-07-12 18:24:02.822764-04') as timestamp), cast(trim('2016-07-12 18:24:02.932049-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '34eca578922a70851d17f251fac02f2e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE FUNCTION _createFilter(uuid, character varying(128), text) RETURNS void AS $$ INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ($1, $2, true, NULL, 0, true, $3); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', $1, 0, 0); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', $1, 0, 0); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', $1, 0, 0); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', $1, 0, 0); $$ LANGUAGE SQL; ************************** CREATE FUNCTION ********* QUERY ********** select _createFilter(uuid_generate_v1(), 'Emulated-Machine', 'Runs VMs only on hosts with a proper emulated machine support'); ************************** ********* QUERY ********** DROP FUNCTION _createFilter(uuid, character varying(128), text); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060550'), 'upgrade/03_06_0550_add_cluster_parameters_override_policy_unit.sql', '34eca578922a70851d17f251fac02f2e', 'engine', cast(trim('2016-07-12 18:24:02.972738-04') as timestamp), cast(trim('2016-07-12 18:24:03.07289-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '06361d90883237aa3458a7c2d3e7d5b6' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'out_average_linkshare', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'out_average_upperlimit', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('qos', 'out_average_realtime', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060560'), 'upgrade/03_06_0560_add_host_network_qos_columns.sql', '06361d90883237aa3458a7c2d3e7d5b6', 'engine', cast(trim('2016-07-12 18:24:03.106091-04') as timestamp), cast(trim('2016-07-12 18:24:03.214613-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '32a6c8749603541881800b2dfa23f3ea' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('async_tasks', 'fk_async_tasks_command_entities_command_id'); ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('async_tasks', 'fk_async_tasks_command_entities_root_command_id'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060570'), 'upgrade/03_06_0570_revert_async_tasks_fk.sql', '32a6c8749603541881800b2dfa23f3ea', 'engine', cast(trim('2016-07-12 18:24:03.256069-04') as timestamp), cast(trim('2016-07-12 18:24:03.331229-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6ab3b3eed7a04c64afd4693f5c008051' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_update_vm_basic_roles() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM roles_groups WHERE action_group_id = 4; -- 4=VM_BASIC_OPERATIONS v_record roles_groups%ROWTYPE; BEGIN OPEN v_cur; LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; insert into roles_groups (role_id, action_group_id) values (v_record.role_id, 17); -- 17=REBOOT_VM insert into roles_groups (role_id, action_group_id) values (v_record.role_id, 18); -- 18=STOP_VM insert into roles_groups (role_id, action_group_id) values (v_record.role_id, 19); -- 19=SHUT_DOWN_VM insert into roles_groups (role_id, action_group_id) values (v_record.role_id, 21); -- 21=HIBERNATE_VM insert into roles_groups (role_id, action_group_id) values (v_record.role_id, 22); -- 22=RUN_VM END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_update_vm_basic_roles(); ************************** ********* QUERY ********** DROP FUNCTION __temp_update_vm_basic_roles(); ************************** DROP FUNCTION ********* QUERY ********** DELETE FROM roles_groups WHERE action_group_id = 4; ************************** DELETE 6 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060580'), 'upgrade/03_06_0580_insert_granular_vm_roles.sql', '6ab3b3eed7a04c64afd4693f5c008051', 'engine', cast(trim('2016-07-12 18:24:03.415065-04') as timestamp), cast(trim('2016-07-12 18:24:03.539862-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '219e867f2a58eac9d5e40d45d1a91b52' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO vm_device(device_id, vm_id, type, device, address, boot_order, spec_params, is_managed, is_plugged, is_readonly, _create_date, _update_date, alias) SELECT uuid_generate_v1(), vm_guid, 'graphics', 'spice', '', NULL, '', true, true, false, 'now', NULL, NULL FROM vm_static WHERE default_display_type = 1 and not exists (select 1 from vm_device where vm_id = vm_guid and device = 'spice'); ************************** INSERT 0 6 ********* QUERY ********** INSERT INTO vm_device(device_id, vm_id, type, device, address, boot_order, spec_params, is_managed, is_plugged, is_readonly, _create_date, _update_date, alias) SELECT uuid_generate_v1(), vm_guid, 'graphics', 'vnc', '', NULL, '', true, true, false, 'now', NULL, NULL FROM vm_static WHERE default_display_type = 0 and not exists (select 1 from vm_device where vm_id = vm_guid and device = 'vnc'); ************************** INSERT 0 0 ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'spice_port', 'integer default NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'spice_tls_port', 'integer default NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'spice_ip', 'varchar(255) default NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'vnc_port', 'integer default NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'vnc_ip', 'varchar(255) default NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060590'), 'upgrade/03_06_0590_add_graphics_info_columns.sql', '219e867f2a58eac9d5e40d45d1a91b52', 'engine', cast(trim('2016-07-12 18:24:03.581232-04') as timestamp), cast(trim('2016-07-12 18:24:04.365775-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '255a586c56a2bcfe2142a5b8fbb73f3d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_fix_external_events_role_groups() RETURNS VOID AS $$ BEGIN UPDATE roles_groups set action_group_id = 1400 where role_id = 'def0000c-0000-0000-0000-def000000000' and action_group_id = 1500; IF not exists (select 1 from roles_groups where role_id = '00000000-0000-0000-0000-000000000001' and action_group_id = 1400) THEN insert into roles_groups(role_id, action_group_id) values ('00000000-0000-0000-0000-000000000001', 1400) ; END IF; END; $$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_fix_external_events_role_groups(); ************************** ********* QUERY ********** DROP FUNCTION __temp_fix_external_events_role_groups(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060600'), 'upgrade/03_06_0600_fix_external_events_role_groups.sql', '255a586c56a2bcfe2142a5b8fbb73f3d', 'engine', cast(trim('2016-07-12 18:24:04.406395-04') as timestamp), cast(trim('2016-07-12 18:24:04.506476-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e9a562e024e7730f1d3e183bd8f2d906' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update users set group_ids = regexp_replace(group_ids, '([,]*)00000000-0000-0000-0000-000000000000([,]*)', ''); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060610'), 'upgrade/03_06_0610_fix_admin_internal_constant_sync.sql', 'e9a562e024e7730f1d3e183bd8f2d906', 'engine', cast(trim('2016-07-12 18:24:04.547838-04') as timestamp), cast(trim('2016-07-12 18:24:04.597849-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0c53d41affb95cda1446092b1fc7f9c1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE fence_agents ( id UUID NOT NULL CONSTRAINT fence_agent_pk PRIMARY KEY, vds_id UUID NOT NULL CONSTRAINT fence_agent_host_id_fk REFERENCES vds_static(vds_id) ON DELETE CASCADE, agent_order INTEGER NOT NULL, ip VARCHAR(255) NOT NULL, type VARCHAR(255) NOT NULL, agent_user VARCHAR(255) NOT NULL, agent_password text NOT NULL, port INTEGER, options VARCHAR(255) NOT NULL DEFAULT '' ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX idx_fence_agents_vds_id ON fence_agents(vds_id); ************************** CREATE INDEX ********* QUERY ********** DROP TYPE IF EXISTS pm_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE pm_rs AS ( vds_id uuid, ip varchar(255), pm_type varchar(255), pm_user varchar(50), pm_password text, pm_port integer, pm_options varchar(4000), pm_secondary_ip varchar(255), pm_secondary_type varchar(255), pm_secondary_user varchar(50), pm_secondary_password text, pm_secondary_port integer, pm_secondary_options varchar(4000), pm_secondary_concurrent boolean); ************************** CREATE TYPE ********* QUERY ********** CREATE OR replace FUNCTION __temp_update_pm_settings() returns void AS $procedure$ DECLARE v_order integer; v_record pm_rs; v_pm_cursor CURSOR FOR select vds_id, ip, pm_type, pm_user, pm_password, pm_port, pm_options, pm_secondary_ip, pm_secondary_type, pm_secondary_user, pm_secondary_password, pm_secondary_port, pm_secondary_options, pm_secondary_concurrent from vds_static where ip IS NOT NULL; BEGIN OPEN v_pm_cursor; FETCH v_pm_cursor into v_record; WHILE FOUND LOOP INSERT INTO fence_agents (id, vds_id, agent_order, ip, type, agent_user, agent_password, port, options) VALUES(uuid_generate_v1(), v_record.vds_id, 1, v_record.ip, v_record.pm_type, v_record.pm_user, v_record.pm_password, v_record.pm_port, v_record.pm_options); IF (v_record.pm_secondary_ip IS NOT NULL) THEN IF ( v_record.pm_secondary_concurrent) THEN v_order:=1; ELSE v_order:=2; END IF; INSERT INTO fence_agents (id, vds_id, agent_order, ip, type, agent_user, agent_password, port, options) VALUES(uuid_generate_v1(), v_record.vds_id, v_order, v_record.pm_secondary_ip, v_record.pm_secondary_type, v_record.pm_secondary_user, v_record.pm_secondary_password, v_record.pm_secondary_port, v_record.pm_secondary_options); END IF; FETCH v_pm_cursor into v_record; END LOOP; CLOSE v_pm_cursor; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_update_pm_settings(); ************************** ********* QUERY ********** DROP FUNCTION __temp_update_pm_settings(); ************************** DROP FUNCTION ********* QUERY ********** select fn_db_drop_column ('vds_static', 'ip'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_type'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_user'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_password'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_port'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_options'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_ip'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_type'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_user'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_password'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_port'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_options'); ************************** ********* QUERY ********** select fn_db_drop_column ('vds_static', 'pm_secondary_concurrent'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060620'), 'upgrade/03_06_0620_create_fence_agents_table.sql', '0c53d41affb95cda1446092b1fc7f9c1', 'engine', cast(trim('2016-07-12 18:24:04.639654-04') as timestamp), cast(trim('2016-07-12 18:24:05.415199-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2732b7258e6a41bdfcc36072994d040e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('storage_domain_static', 'wipe_after_delete', 'boolean NOT NULL DEFAULT false'); ************************** ********* QUERY ********** UPDATE storage_domain_static SET wipe_after_delete = true FROM vdc_options WHERE vdc_options.option_name = 'SANWipeAfterDelete' AND vdc_options.version = 'general' AND vdc_options.option_value = 'true' AND storage_domain_static.storage_type IN (2, 3); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060630'), 'upgrade/03_06_0630_add_wipe_after_delete_to_storage_domain_static.sql', '2732b7258e6a41bdfcc36072994d040e', 'engine', cast(trim('2016-07-12 18:24:05.456685-04') as timestamp), cast(trim('2016-07-12 18:24:05.731586-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0f5c6d7086177459f8015ff065bab4f9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('e659c871-0bf1-4ccc-b748-f28f5d08ddda', 'Migration', true, NULL, 0, true, 'Prevent migration to the same host.'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 'e659c871-0bf1-4ccc-b748-f28f5d08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 'e659c871-0bf1-4ccc-b748-f28f5d08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 'e659c871-0bf1-4ccc-b748-f28f5d08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', 'e659c871-0bf1-4ccc-b748-f28f5d08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060640'), 'upgrade/03_06_0640_add_migration_policy_unit.sql', '0f5c6d7086177459f8015ff065bab4f9', 'engine', cast(trim('2016-07-12 18:24:05.773081-04') as timestamp), cast(trim('2016-07-12 18:24:05.923223-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '44efedf035da3cbdcc59a9a25e952a8d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('providers', 'auth_url', 'TEXT DEFAULT NULL'); ************************** ********* QUERY ********** UPDATE providers set auth_url = (select option_value from vdc_options where option_name = 'KeystoneAuthUrl') WHERE auth_required and provider_type in ('OPENSTACK_IMAGE','OPENSTACK_NETWORK'); ************************** UPDATE 0 ********* QUERY ********** select fn_db_delete_config_value('KeystoneAuthUrl','general'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060650'), 'upgrade/03_06_0650_add_authentication_url.sql', '44efedf035da3cbdcc59a9a25e952a8d', 'engine', cast(trim('2016-07-12 18:24:05.964955-04') as timestamp), cast(trim('2016-07-12 18:24:06.04817-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4cb8d1be08528b9aaf0f304b1585bb9f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_index('IDX_image_storage_domain_map_image_id', 'image_storage_domain_map', 'image_id', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060660'), 'upgrade/03_06_0660_add_index_image_storage_domain_map.sql', '4cb8d1be08528b9aaf0f304b1585bb9f', 'engine', cast(trim('2016-07-12 18:24:06.089731-04') as timestamp), cast(trim('2016-07-12 18:24:06.239728-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a9f4f784d47688f83fef688cb3e1fb12' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE SEQUENCE engine_session_seq INCREMENT BY 1 START WITH 1; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE engine_sessions ( id bigint DEFAULT nextval('engine_session_seq'::regclass) NOT NULL, engine_session_id text NOT NULL, user_id uuid NOT NULL, user_name character varying(255) NOT NULL, group_ids text, role_ids text, CONSTRAINT pk_engine_session PRIMARY KEY (id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX idx_engine_session_session_id ON engine_sessions USING btree (engine_session_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060670'), 'upgrade/03_06_0670_add_engine_sessions.sql', 'a9f4f784d47688f83fef688cb3e1fb12', 'engine', cast(trim('2016-07-12 18:24:06.281352-04') as timestamp), cast(trim('2016-07-12 18:24:06.706461-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '74b9cd7f2fb27aa7c2af6e3886734f9e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_drop_column('users', 'active'); ************************** ********* QUERY ********** select fn_db_drop_column('users', 'role'); ************************** ********* QUERY ********** select fn_db_drop_column('users', 'groups'); ************************** ********* QUERY ********** select fn_db_drop_column('users', 'group_ids'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060680'), 'upgrade/03_06_0680_remove_groups_roles_from_users.sql', '74b9cd7f2fb27aa7c2af6e3886734f9e', 'engine', cast(trim('2016-07-12 18:24:06.739782-04') as timestamp), cast(trim('2016-07-12 18:24:06.881386-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6cda0ef7e90bb3d12b86a909fcd63a40' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM event_map WHERE length(trim(event_down_name)) = 0 OR event_down_name = 'UNASSIGNED'; ************************** DELETE 94 ********* QUERY ********** ALTER TABLE event_subscriber DROP CONSTRAINT fk_event_subscriber_event_map; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060690'), 'upgrade/03_06_0690_render_event_map_optional.sql', '6cda0ef7e90bb3d12b86a909fcd63a40', 'engine', cast(trim('2016-07-12 18:24:06.914747-04') as timestamp), cast(trim('2016-07-12 18:24:07.014643-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'acd8dde9b6b470a784583a8ad7881d69' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE snapshots SET memory_volume = hibernation_vol_handle FROM vm_dynamic WHERE snapshot_type = 'ACTIVE' AND vm_guid = vm_id AND length(hibernation_vol_handle) != 0; ************************** UPDATE 0 ********* QUERY ********** SELECT fn_db_drop_column('vm_dynamic', 'hibernation_vol_handle'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060700'), 'upgrade/03_06_0700_move_hibernation_volumes_to_active_snapshots.sql', 'acd8dde9b6b470a784583a8ad7881d69', 'engine', cast(trim('2016-07-12 18:24:07.056234-04') as timestamp), cast(trim('2016-07-12 18:24:07.131348-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6ce0aa95eaab3f4ded96bb8696a81d86' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_drop_column('vm_dynamic', 'display'); ************************** ********* QUERY ********** select fn_db_drop_column('vm_dynamic', 'display_secure_port'); ************************** ********* QUERY ********** select fn_db_drop_column('vm_dynamic', 'display_ip'); ************************** ********* QUERY ********** select fn_db_drop_column('vm_dynamic', 'display_type'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060710'), 'upgrade/03_06_0710_remove_deprecated_display_columns.sql', '6ce0aa95eaab3f4ded96bb8696a81d86', 'engine', cast(trim('2016-07-12 18:24:07.164659-04') as timestamp), cast(trim('2016-07-12 18:24:07.298245-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4e1aeebcc3fac8e6ee25595d596697bc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set default_display_type = case when device = 'vga' then 0 when device = 'cirrus' then 1 else 2 end from vm_device where vm_device.vm_id = vm_static.vm_guid and vm_device.type = 'video'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060720'), 'upgrade/03_06_0720_adjust_default_display_type.sql', '4e1aeebcc3fac8e6ee25595d596697bc', 'engine', cast(trim('2016-07-12 18:24:07.339559-04') as timestamp), cast(trim('2016-07-12 18:24:07.397748-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7ec4e85e454ae2bc141df62efc0b63be' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set default_display_type = 2 where vm_guid = '00000000-0000-0000-0000-000000000000'; ************************** UPDATE 1 ********* QUERY ********** update vm_device set device = 'qxl' where vm_id = '00000000-0000-0000-0000-000000000000' and type = 'video'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060730'), 'upgrade/03_06_0730_adjust_blank_template_video_card.sql', '7ec4e85e454ae2bc141df62efc0b63be', 'engine', cast(trim('2016-07-12 18:24:07.439782-04') as timestamp), cast(trim('2016-07-12 18:24:07.514543-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7ef9f63e95dd696a406d01743adc6311' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_dynamic', 'guest_agent_status', 'int default 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060740'), 'upgrade/03_06_0740_add_guest_agent_status_to_vm_dynamic.sql', '7ef9f63e95dd696a406d01743adc6311', 'engine', cast(trim('2016-07-12 18:24:07.556299-04') as timestamp), cast(trim('2016-07-12 18:24:07.915833-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd281314793f55530e7bd91a642241828' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_set_disk_profiles_permissions() RETURNS VOID AS $procedure$ DECLARE v_DISK_PROFILE_USER_ID UUID; BEGIN v_DISK_PROFILE_USER_ID := 'DEF00020-0000-0000-0000-ABC000000010'; -- Add disk_profile_user role INSERT INTO roles(id,name,description,is_readonly,role_type, app_mode) SELECT v_DISK_PROFILE_USER_ID, 'DiskProfileUser', 'Disk Profile User', true, 2, 1 WHERE NOT EXISTS (SELECT id,name,description,is_readonly,role_type FROM roles WHERE id = v_DISK_PROFILE_USER_ID AND name='DiskProfileUser' AND description='Disk Profile User' AND is_readonly=true AND role_type=2 AND app_mode=1); -- Add 'Attach disk profile' action group to roles: -- newly created disk profile user PERFORM fn_db_add_action_group_to_role(v_DISK_PROFILE_USER_ID, 1563); -- Add action group to each role that contains CRUD action groups on disk profile -- 1560- CONFIGURE_STORAGE_DISK_PROFILE, 1561- CREATE_STORAGE_DISK_PROFILE, 1562- DELETE_STORAGE_DISK_PROFILE INSERT INTO roles_groups (role_id, action_group_id) SELECT DISTINCT role_id, 1563 FROM roles_groups a WHERE NOT EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND b.action_group_id = 1563) AND EXISTS (SELECT 1 FROM roles_groups b WHERE b.role_id = a.role_id AND (b.action_group_id = 1560 OR b.action_group_id = 1561 OR b.action_group_id = 1562)); -- Add permission EVERYONE on DiskProfileUser role on each disk profile. INSERT INTO permissions(id, role_id, ad_element_id, object_id, object_type_id) SELECT uuid_generate_v1(), v_DISK_PROFILE_USER_ID, 'EEE00000-0000-0000-0000-123456789EEE', -- Everyone disk_profiles.id, 29 -- disk profile object id FROM disk_profiles; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_set_disk_profiles_permissions(); ************************** ********* QUERY ********** DROP function __temp_set_disk_profiles_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060750'), 'upgrade/03_06_0750_attach_disk_profile_permission.sql', 'd281314793f55530e7bd91a642241828', 'engine', cast(trim('2016-07-12 18:24:07.964789-04') as timestamp), cast(trim('2016-07-12 18:24:08.089525-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '515cb598f093255153ce737f2ec1452c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE gluster_volume_snapshots ( snapshot_id UUID NOT NULL, volume_id UUID NOT NULL, snapshot_name VARCHAR(1000) NOT NULL, description VARCHAR(1024), status VARCHAR(32), _create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE, CONSTRAINT pk_snapshot_id PRIMARY KEY(snapshot_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE UNIQUE INDEX IDX_gluster_volume_snapshots_unique ON gluster_volume_snapshots(volume_id, snapshot_name); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE gluster_volume_snapshot_config ( cluster_id UUID NOT NULL, volume_id UUID, param_name VARCHAR(128) NOT NULL, param_value VARCHAR(128), _create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** CREATE UNIQUE INDEX IDX_gluster_volume_snapshot_config_unique ON gluster_volume_snapshot_config(cluster_id, volume_id, param_name); ************************** CREATE INDEX ********* QUERY ********** SELECT fn_db_create_constraint('gluster_volume_snapshots', 'fk_gluster_volume_snapshots_volume_id', 'FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('gluster_volume_snapshot_config', 'fk_gluster_volume_snapshot_config_cluster_id', 'FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('gluster_volume_snapshot_config', 'fk_gluster_volume_snapshot_config_volume_id', 'FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060760'), 'upgrade/03_06_0760_add_gluster_volume_snapshot_tables.sql', '515cb598f093255153ce737f2ec1452c', 'engine', cast(trim('2016-07-12 18:24:08.13105-04') as timestamp), cast(trim('2016-07-12 18:24:08.781295-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '38f32053a575d337d61aa221258b8722' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_set_vm_run_time_permissions() RETURNS VOID AS $procedure$ DECLARE v_VM_RUN_TIME_MANAGER_ID UUID; BEGIN v_VM_RUN_TIME_MANAGER_ID := 'DEF00006-0000-0000-0000-DEF000000011'; -- Add user role for vm run time manager INSERT INTO roles(id,name,description,is_readonly,role_type, app_mode) SELECT v_VM_RUN_TIME_MANAGER_ID, 'UserVmRunTimeManager', 'User Role, with permissions for any operations on VMs except snapshot manipulation', true, 2, 1; -- copy the properties of VM_OPERATOR role (role_id = def00006-0000-0000-0000-def000000006) without the vm snpashot manipulation (action group id = 12) to the new role of VM_RUN_TIME_MANAGER_ID. INSERT INTO roles_groups (role_id, action_group_id) SELECT v_VM_RUN_TIME_MANAGER_ID, action_group_id FROM roles_groups a WHERE role_id = 'def00006-0000-0000-0000-def000000006' AND action_group_id != 12; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_set_vm_run_time_permissions(); ************************** ********* QUERY ********** DROP function __temp_set_vm_run_time_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060770'), 'upgrade/03_06_0770_add_vm_run_time_permissions.sql', '38f32053a575d337d61aa221258b8722', 'engine', cast(trim('2016-07-12 18:24:08.822718-04') as timestamp), cast(trim('2016-07-12 18:24:08.947686-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd215becec2a5379ef616cd9fc3e3ee26' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_qos_name_uniqueness() RETURNS void AS $BODY$ DECLARE -- oredered cursor v_cur cursor for select * from qos order by qos_type, name, storage_pool_id; v_entry qos%ROWTYPE; v_qos_type smallint; v_name varchar(50); v_storage_pool_id uuid; BEGIN open v_cur; loop fetch v_cur into v_entry; -- since the cursor is ordered, check that 2 consecutive rows not match if (v_entry.qos_type = v_qos_type and v_entry.name = v_name and v_entry.storage_pool_id = v_storage_pool_id) then update qos set name = v_name || '_' || cast(uuid_generate_v1() as varchar) where id = v_entry.id; end if; exit when not found; v_qos_type := v_entry.qos_type; v_name := v_entry.name; v_storage_pool_id := v_entry.storage_pool_id; end loop; close v_cur; -- adding constaint for qos name uniqueness of same context alter table qos add unique (qos_type, name, storage_pool_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_qos_name_uniqueness(); ************************** ********* QUERY ********** drop function __temp_qos_name_uniqueness(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060780'), 'upgrade/03_06_0780_qos_name_uniqueness.sql', 'd215becec2a5379ef616cd9fc3e3ee26', 'engine', cast(trim('2016-07-12 18:24:08.989429-04') as timestamp), cast(trim('2016-07-12 18:24:09.205976-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4fa447c01aafb9a3e71775fa33307e19' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vm_dynamic set status = 1 where status = 17; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060790'), 'upgrade/03_06_0790_change_prepare_to_hibernate_to_up.sql', '4fa447c01aafb9a3e71775fa33307e19', 'engine', cast(trim('2016-07-12 18:24:09.247372-04') as timestamp), cast(trim('2016-07-12 18:24:09.306087-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0b2bbb2f484db4a588bba82149701ab8' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_add_LSM_permissions() RETURNS VOID AS $procedure$ DECLARE v_action_group_id INTEGER; BEGIN v_action_group_id := 1107; -- copy the action group id to all the roles which has permissions to CONFIGURE_DISK_STORAGE (1103) INSERT INTO roles_groups (role_id, action_group_id) SELECT role_id, v_action_group_id FROM roles_groups a WHERE action_group_id = 1103; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_add_LSM_permissions(); ************************** ********* QUERY ********** DROP function __temp_add_LSM_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060800'), 'upgrade/03_06_0800_add_LSM_action_group_id.sql', '0b2bbb2f484db4a588bba82149701ab8', 'engine', cast(trim('2016-07-12 18:24:09.347373-04') as timestamp), cast(trim('2016-07-12 18:24:09.472383-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '226c156949e87516246a368f58375e3b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE qrtz_job_details ( sched_name VARCHAR(120) NOT NULL, job_name VARCHAR(200) NOT NULL, job_group VARCHAR(200) NOT NULL, description TEXT NULL, job_class_name VARCHAR(250) NOT NULL, is_durable BOOL NOT NULL, is_nonconcurrent BOOL NOT NULL, is_update_data BOOL NOT NULL, requests_recovery BOOL NOT NULL, job_data BYTEA NULL, PRIMARY KEY (sched_name,job_name,job_group) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE qrtz_triggers ( sched_name VARCHAR(120) NOT NULL, trigger_name VARCHAR(200) NOT NULL, trigger_group VARCHAR(200) NOT NULL, job_name VARCHAR(200) NOT NULL, job_group VARCHAR(200) NOT NULL, description TEXT NULL, next_fire_time BIGINT NULL, prev_fire_time BIGINT NULL, priority INTEGER NULL, trigger_state VARCHAR(16) NOT NULL, trigger_type VARCHAR(8) NOT NULL, start_time BIGINT NOT NULL, end_time BIGINT NULL, calendar_name VARCHAR(200) NULL, misfire_instr SMALLINT NULL, job_data BYTEA NULL, PRIMARY KEY (sched_name,trigger_name,trigger_group), FOREIGN KEY (sched_name,job_name,job_group) REFERENCES qrtz_job_details(sched_name,job_name,job_group) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE qrtz_simple_triggers ( sched_name VARCHAR(120) NOT NULL, trigger_name VARCHAR(200) NOT NULL, trigger_group VARCHAR(200) NOT NULL, repeat_count BIGINT NOT NULL, repeat_interval BIGINT NOT NULL, times_triggered BIGINT NOT NULL, PRIMARY KEY (sched_name,trigger_name,trigger_group) ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('qrtz_simple_triggers', 'fk_qrtz_simple_triggers_sched_name', 'FOREIGN KEY (sched_name,trigger_name,trigger_group) REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE'); ************************** ********* QUERY ********** CREATE TABLE qrtz_cron_triggers ( sched_name VARCHAR(120) NOT NULL, trigger_name VARCHAR(200) NOT NULL, trigger_group VARCHAR(200) NOT NULL, cron_expression VARCHAR(120) NOT NULL, time_zone_id VARCHAR(80), PRIMARY KEY (sched_name,trigger_name,trigger_group) ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('qrtz_cron_triggers', 'fk_qrtz_cron_triggers_sched_name', 'FOREIGN KEY (sched_name,trigger_name,trigger_group) REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE'); ************************** ********* QUERY ********** CREATE TABLE qrtz_simprop_triggers ( sched_name VARCHAR(120) NOT NULL, trigger_name VARCHAR(200) NOT NULL, trigger_group VARCHAR(200) NOT NULL, str_prop_1 VARCHAR(512) NULL, str_prop_2 VARCHAR(512) NULL, str_prop_3 VARCHAR(512) NULL, int_prop_1 INT NULL, int_prop_2 INT NULL, long_prop_1 BIGINT NULL, long_prop_2 BIGINT NULL, dec_prop_1 NUMERIC(13,4) NULL, dec_prop_2 NUMERIC(13,4) NULL, bool_prop_1 BOOL NULL, bool_prop_2 BOOL NULL, PRIMARY KEY (sched_name,trigger_name,trigger_group) ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('qrtz_simprop_triggers', 'fk_qrtz_simprop_triggers_sched_name', 'FOREIGN KEY (sched_name,trigger_name,trigger_group) REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE'); ************************** ********* QUERY ********** CREATE TABLE qrtz_blob_triggers ( sched_name VARCHAR(120) NOT NULL, trigger_name VARCHAR(200) NOT NULL, trigger_group VARCHAR(200) NOT NULL, blob_data BYTEA NULL, PRIMARY KEY (sched_name,trigger_name,trigger_group) ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('qrtz_blob_triggers', 'fk_qrtz_blob_triggers_sched_name', 'FOREIGN KEY (sched_name,trigger_name,trigger_group) REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE'); ************************** ********* QUERY ********** CREATE TABLE qrtz_calendars ( sched_name VARCHAR(120) NOT NULL, calendar_name VARCHAR(200) NOT NULL, calendar BYTEA NOT NULL, PRIMARY KEY (sched_name,calendar_name) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE qrtz_paused_trigger_grps ( sched_name VARCHAR(120) NOT NULL, trigger_group VARCHAR(200) NOT NULL, PRIMARY KEY (sched_name,trigger_group) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE qrtz_fired_triggers ( sched_name VARCHAR(120) NOT NULL, entry_id VARCHAR(95) NOT NULL, trigger_name VARCHAR(200) NOT NULL, trigger_group VARCHAR(200) NOT NULL, instance_name VARCHAR(200) NOT NULL, fired_time BIGINT NOT NULL, sched_time BIGINT NULL, priority INTEGER NOT NULL, state VARCHAR(16) NOT NULL, job_name VARCHAR(200) NULL, job_group VARCHAR(200) NULL, is_nonconcurrent BOOL NULL, requests_recovery BOOL NULL, PRIMARY KEY (sched_name,entry_id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE qrtz_scheduler_state ( sched_name VARCHAR(120) NOT NULL, instance_name VARCHAR(200) NOT NULL, last_checkin_time BIGINT NOT NULL, checkin_interval BIGINT NOT NULL, PRIMARY KEY (sched_name,instance_name) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE qrtz_locks ( sched_name VARCHAR(120) NOT NULL, lock_name VARCHAR(40) NOT NULL, PRIMARY KEY (sched_name,lock_name) ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX IDX_qrtz_j_req_recovery on qrtz_job_details(sched_name,requests_recovery); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_j_grp on qrtz_job_details(sched_name,job_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_j on qrtz_triggers(sched_name,job_name,job_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_jg on qrtz_triggers(sched_name,job_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_c on qrtz_triggers(sched_name,calendar_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_g on qrtz_triggers(sched_name,trigger_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_state on qrtz_triggers(sched_name,trigger_state); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_n_state on qrtz_triggers(sched_name,trigger_name,trigger_group,trigger_state); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_n_g_state on qrtz_triggers(sched_name,trigger_group,trigger_state); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_next_fire_time on qrtz_triggers(sched_name,next_fire_time); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_nft_st on qrtz_triggers(sched_name,trigger_state,next_fire_time); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_nft_misfire on qrtz_triggers(sched_name,misfire_instr,next_fire_time); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_nft_st_misfire on qrtz_triggers(sched_name,misfire_instr,next_fire_time,trigger_state); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_t_nft_st_misfire_grp on qrtz_triggers(sched_name,misfire_instr,next_fire_time,trigger_group,trigger_state); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_ft_trig_inst_name on qrtz_fired_triggers(sched_name,instance_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers(sched_name,instance_name,requests_recovery); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_ft_j_g on qrtz_fired_triggers(sched_name,job_name,job_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_ft_jg on qrtz_fired_triggers(sched_name,job_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_ft_t_g on qrtz_fired_triggers(sched_name,trigger_name,trigger_group); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX IDX_qrtz_ft_tg on qrtz_fired_triggers(sched_name,trigger_group); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060810'), 'upgrade/03_06_0810_insert_quartz_tables.sql', '226c156949e87516246a368f58375e3b', 'engine', cast(trim('2016-07-12 18:24:09.514133-04') as timestamp), cast(trim('2016-07-12 18:24:14.52449-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c5622dd5d6c9465a0857a25138e58219' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('gluster_volumes', 'snapshot_count', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060820'), 'upgrade/03_06_0820_add_snapshot_count_to_gluster_volume.sql', 'c5622dd5d6c9465a0857a25138e58219', 'engine', cast(trim('2016-07-12 18:24:14.563799-04') as timestamp), cast(trim('2016-07-12 18:24:15.023301-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '99f0a38ed8b2b1647f5330454c6af3cc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE host_device ( host_id UUID NOT NULL, device_name VARCHAR(255) NOT NULL, parent_device_name VARCHAR(255) NOT NULL, capability VARCHAR(32) NOT NULL, iommu_group INTEGER, product_name VARCHAR(255), product_id VARCHAR(255), vendor_name VARCHAR(255), vendor_id VARCHAR(255), physfn VARCHAR(255), total_vfs INTEGER, vm_id UUID ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('host_device', 'host_device_pk', 'PRIMARY KEY (host_id, device_name)'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('host_device', 'fk_host_device_parent_name', 'FOREIGN KEY (host_id, parent_device_name) REFERENCES host_device(host_id, device_name) DEFERRABLE INITIALLY IMMEDIATE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('host_device', 'fk_host_device_physfn', 'FOREIGN KEY (host_id, physfn) REFERENCES host_device(host_id, device_name) DEFERRABLE INITIALLY IMMEDIATE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('host_device', 'fk_host_device_host_id', 'FOREIGN KEY (host_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('host_device', 'fk_host_device_vm_id', 'FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE SET NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060830'), 'upgrade/03_06_0830_add_host_device_table.sql', '99f0a38ed8b2b1647f5330454c6af3cc', 'engine', cast(trim('2016-07-12 18:24:15.063798-04') as timestamp), cast(trim('2016-07-12 18:24:15.430176-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6b4cbd96423350c4b4ad92d0599a38dc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('network_cluster', 'management', 'boolean NOT NULL DEFAULT false'); ************************** ********* QUERY ********** update network_cluster set management = true where network_id in (select id from network where name=(select COALESCE((select option_value from vdc_options where option_name='ManagementNetwork' and version='general'), 'ovirtmgmt'))); ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060840'), 'upgrade/03_06_0840_add_management_to_network_cluster.sql', '6b4cbd96423350c4b4ad92d0599a38dc', 'engine', cast(trim('2016-07-12 18:24:15.471967-04') as timestamp), cast(trim('2016-07-12 18:24:15.63884-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f14b8f448d412232f9fec3b5fa0355dc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select 3060850; ************************** 3060850 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060850'), 'upgrade/03_06_0850_update_management_network_vdc_option.sql', 'f14b8f448d412232f9fec3b5fa0355dc', 'engine', cast(trim('2016-07-12 18:24:15.680184-04') as timestamp), cast(trim('2016-07-12 18:24:15.708663-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '530b02b2d5a515c2d6ec304d61954e1a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface_statistics', 'rx_total', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface_statistics', 'rx_offset', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface_statistics', 'tx_total', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface_statistics', 'tx_offset', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_interface_statistics', 'sample_time', 'DOUBLE PRECISION DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_interface_statistics', 'rx_total', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_interface_statistics', 'rx_offset', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_interface_statistics', 'tx_total', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_interface_statistics', 'tx_offset', 'BIGINT DEFAULT NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_interface_statistics', 'sample_time', 'DOUBLE PRECISION DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060860'), 'upgrade/03_06_0860_add_total_rx_tx_statistics.sql', '530b02b2d5a515c2d6ec304d61954e1a', 'engine', cast(trim('2016-07-12 18:24:15.746939-04') as timestamp), cast(trim('2016-07-12 18:24:16.030359-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '023a255c64b5f0f04960250af27d0a0c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE gluster_volume_snapshot_schedules ( volume_id UUID NOT NULL, job_id VARCHAR(256) NOT NULL, snapshot_name_prefix VARCHAR(128), snapshot_description VARCHAR(1024), recurrence VARCHAR(128) NOT NULL, time_zone VARCHAR(128), interval INTEGER, start_date TIMESTAMP WITH TIME ZONE, execution_time TIME, days VARCHAR(256), end_by TIMESTAMP WITH TIME ZONE, _create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE, CONSTRAINT pk_volume_id PRIMARY KEY(volume_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('gluster_volume_snapshot_schedules', 'fk_gluster_volume_snapshot_schedules_volume_id', 'FOREIGN KEY (volume_id) REFERENCES gluster_volumes(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060870'), 'upgrade/03_06_0870_add_gluster_volume_snapshot_schedule_tables.sql', '023a255c64b5f0f04960250af27d0a0c', 'engine', cast(trim('2016-07-12 18:24:16.071953-04') as timestamp), cast(trim('2016-07-12 18:24:16.321815-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '871779aa424c5cd180bf8f85bbd2e2e0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('gluster_volumes', 'snapshot_scheduled', 'boolean DEFAULT false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060880'), 'upgrade/03_06_0880_add_snapshot_scheduled_flag_to_gluster_volume.sql', '871779aa424c5cd180bf8f85bbd2e2e0', 'engine', cast(trim('2016-07-12 18:24:16.363589-04') as timestamp), cast(trim('2016-07-12 18:24:16.797887-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '81f9ebb4177e2817a23f90ed28fb3577' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'user_id', 'UUID DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060890'), 'upgrade/03_06_0890_add_user_id_to_command_entities.sql', '81f9ebb4177e2817a23f90ed28fb3577', 'engine', cast(trim('2016-07-12 18:24:16.838466-04') as timestamp), cast(trim('2016-07-12 18:24:16.896658-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '978d2b5ca9aeaa6c5d1ae3f7aa04f85e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE gluster_config_master ( config_key VARCHAR(50), config_description VARCHAR(300), minimum_supported_cluster VARCHAR(50), config_possible_values VARCHAR(50), config_feature VARCHAR(50), CONSTRAINT pk_config_key PRIMARY KEY(config_key) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** ALTER TABLE ONLY gluster_georep_config ADD CONSTRAINT fk_config_key FOREIGN KEY(config_key) REFERENCES gluster_config_master(config_key); ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060900'), 'upgrade/03_06_0900_add_gluster_config_master_table.sql', '978d2b5ca9aeaa6c5d1ae3f7aa04f85e', 'engine', cast(trim('2016-07-12 18:24:16.938745-04') as timestamp), cast(trim('2016-07-12 18:24:17.213412-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ffc37e6c40b24bb149643814752fcb13' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('gluster-log-file', 'The path to the geo-replication glusterfs log file.', '3.5', '', 'geo_replication'); ************************** INSERT 19100 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('gluster-log-level', 'The log level for glusterfs processes.', '3.5', '', 'geo_replication'); ************************** INSERT 19101 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('log-file', 'The path to the geo-replication log file.', '3.5', '', 'geo_replication'); ************************** INSERT 19102 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('log-level', 'The log level for geo-replication.', '3.5', '', 'geo_replication'); ************************** INSERT 19103 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('ssh-command', 'The SSH command to connect to the remote machine', '3.5', '', 'geo_replication'); ************************** INSERT 19104 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('rsync-command', 'The rsync command to use for synchronizing the files', '3.5', '', 'geo_replication'); ************************** INSERT 19105 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('use-tarssh', 'The use-tarssh command allows tar over Secure Shell protocol. Use this option to handle workloads of files that have not undergone edits.', '3.5', '', 'geo_replication'); ************************** INSERT 19106 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('timeout', 'The timeout period in seconds.', '3.5', '', 'geo_replication'); ************************** INSERT 19107 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('sync-jobs', 'The number of simultaneous files/directories that can be synchronized.', '3.5', '', 'geo_replication'); ************************** INSERT 19108 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('ignore-deletes', 'If this option is set to 1, a file deleted on the master will not trigger a delete operation on the slave. As a result, the slave will remain as a superset of the master and can be used to recover the master in the event of a crash and/or accidental delete.', '3.5', '', 'geo_replication'); ************************** INSERT 19109 1 ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('checkpoint', 'Sets a checkpoint with the given option LABEL. If the option is set as now, then the current time will be used as the label.', '3.5', '', 'geo_replication'); ************************** INSERT 19110 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060910'), 'upgrade/03_06_0910_insert_config_description.sql', 'ffc37e6c40b24bb149643814752fcb13', 'engine', cast(trim('2016-07-12 18:24:17.254873-04') as timestamp), cast(trim('2016-07-12 18:24:17.555089-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a51430cf22fb21efba0b5c53149bdf88' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('gluster_georep_config', 'config_value', 'varchar', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060920'), 'upgrade/03_06_0920_gluster_geo_rep_alter_config_value_column.sql', 'a51430cf22fb21efba0b5c53149bdf88', 'engine', cast(trim('2016-07-12 18:24:17.596697-04') as timestamp), cast(trim('2016-07-12 18:24:17.930874-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'af703ba84e7cf8573d8b48e28c67b5a7' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM vm_interface_statistics WHERE id NOT IN (SELECT id from vm_interface); ************************** DELETE 0 ********* QUERY ********** SELECT fn_db_create_constraint('vm_interface_statistics', 'fk_vm_interface_statistics_vm_interface', 'FOREIGN KEY (id) REFERENCES vm_interface(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060930'), 'upgrade/03_06_0930_add_delete_contraint_vm_interface_statistics.sql', 'af703ba84e7cf8573d8b48e28c67b5a7', 'engine', cast(trim('2016-07-12 18:24:17.971749-04') as timestamp), cast(trim('2016-07-12 18:24:18.029955-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2bbed67add786cffd9f4307e051a417e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_drop_column('vm_dynamic', 'guest_last_login_time'); ************************** ********* QUERY ********** SELECT fn_db_drop_column('vm_dynamic', 'guest_last_logout_time'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060940'), 'upgrade/03_06_0940_drop_vm_dynamic_guest_last_logxxx_time_columns.sql', '2bbed67add786cffd9f4307e051a417e', 'engine', cast(trim('2016-07-12 18:24:18.071473-04') as timestamp), cast(trim('2016-07-12 18:24:18.154856-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ade002652e5bb7e64883a1a5ff39370a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DROP INDEX if exists IDX_georep_slave_host_name; ************************** DROP INDEX ********* QUERY ********** CREATE INDEX IDX_georep_slave_host_name ON gluster_georep_session(slave_host_name); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060950'), 'upgrade/03_06_0950_add_idx_gluster_georep_slavehostname.sql', 'ade002652e5bb7e64883a1a5ff39370a', 'engine', cast(trim('2016-07-12 18:24:18.196475-04') as timestamp), cast(trim('2016-07-12 18:24:18.37134-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3ae89e52b44b7ea8c71f74e967ddfd63' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE storage_device ( id UUID NOT NULL, name VARCHAR(1000) NOT NULL, device_uuid VARCHAR(38), filesystem_uuid VARCHAR(38), vds_id UUID NOT NULL, description VARCHAR(2000), device_type VARCHAR(50), device_path VARCHAR(4096), filesystem_type VARCHAR(50), mount_point VARCHAR(4096), size BIGINT, is_free BOOLEAN, _create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT LOCALTIMESTAMP, CONSTRAINT pk_storage_device PRIMARY KEY(id), FOREIGN KEY (vds_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** select fn_db_create_index('IDX_storage_device_vds_id', 'storage_device', 'vds_id', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060960'), 'upgrade/03_06_0960_add_storage_device_tables.sql', '3ae89e52b44b7ea8c71f74e967ddfd63', 'engine', cast(trim('2016-07-12 18:24:18.413125-04') as timestamp), cast(trim('2016-07-12 18:24:18.730174-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fe582f55e323cfe35d74a8342d1a8ded' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'maintenance_reason', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060970'), 'upgrade/03_06_0970_add_maintenance_reason_to_vds_dynamic.sql', 'fe582f55e323cfe35d74a8342d1a8ded', 'engine', cast(trim('2016-07-12 18:24:18.771611-04') as timestamp), cast(trim('2016-07-12 18:24:18.830088-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '87fe110003666216005120f882783d4d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'maintenance_reason_required', 'boolean not null default false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060980'), 'upgrade/03_06_0980_add_maintenance_reason_required_to_vds_groups.sql', '87fe110003666216005120f882783d4d', 'engine', cast(trim('2016-07-12 18:24:18.871486-04') as timestamp), cast(trim('2016-07-12 18:24:19.105583-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '90e088ada32319e9c2dbd5eabadfc05f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('gluster_georep_config','fk_config_key'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03060990'), 'upgrade/03_06_0990_georep_drop_constraint_config_key.sql', '90e088ada32319e9c2dbd5eabadfc05f', 'engine', cast(trim('2016-07-12 18:24:19.14654-04') as timestamp), cast(trim('2016-07-12 18:24:19.204796-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7bf7c8f17448a14fe89baaea68037ed3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('gluster_volumes', 'disperse_count', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** SELECT fn_db_add_column('gluster_volumes', 'redundancy_count', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061000'), 'upgrade/03_06_1000_add_disperse_and_redundancy_count_to_gluster_volume.sql', '7bf7c8f17448a14fe89baaea68037ed3', 'engine', cast(trim('2016-07-12 18:24:19.246523-04') as timestamp), cast(trim('2016-07-12 18:24:20.08075-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0a07af9668e9b8ca1324b667a464e40f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'incoming_migrations', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'outgoing_migrations', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061010'), 'upgrade/03_06_1010_add_in_out_migrations.sql', '0a07af9668e9b8ca1324b667a464e40f', 'engine', cast(trim('2016-07-12 18:24:20.129675-04') as timestamp), cast(trim('2016-07-12 18:24:20.60558-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2e49b2e2bafe50e62bbdd00fc84f4e97' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guest_mem_free', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guest_mem_buffered', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guest_mem_cached', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061020'), 'upgrade/03_06_1020_add_vm_dynamic_guest_mem_cached_buffered.sql', '2e49b2e2bafe50e62bbdd00fc84f4e97', 'engine', cast(trim('2016-07-12 18:24:20.646491-04') as timestamp), cast(trim('2016-07-12 18:24:20.779531-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b7e8bf5f627e15959641502fd041a466' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('fence_agents', 'encrypt_options', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('fence_agents', 'options', 'VARCHAR', 'TEXT'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061030'), 'upgrade/03_06_1030_change_options_to_text.sql', 'b7e8bf5f627e15959641502fd041a466', 'engine', cast(trim('2016-07-12 18:24:20.821255-04') as timestamp), cast(trim('2016-07-12 18:24:21.405752-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fdb9623fe610ef69be6a7c1c437eccd6' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('network_cluster', 'is_gluster', 'boolean NOT NULL DEFAULT false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061040'), 'upgrade/03_06_1040_add_gluster_to_network_cluster.sql', 'fdb9623fe610ef69be6a7c1c437eccd6', 'engine', cast(trim('2016-07-12 18:24:21.446303-04') as timestamp), cast(trim('2016-07-12 18:24:21.605136-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c57d2c88d6fe77f70d2194671ebb0154' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('gluster_volume_bricks', 'network_id', 'uuid NULL'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('gluster_volume_bricks', 'fk_gluster_volume_bricks_network_id', 'FOREIGN KEY (network_id) REFERENCES network(id)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061050'), 'upgrade/03_06_1050_add_network_gluster_bricks.sql', 'c57d2c88d6fe77f70d2194671ebb0154', 'engine', cast(trim('2016-07-12 18:24:21.646051-04') as timestamp), cast(trim('2016-07-12 18:24:21.746197-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9876d3ba238cbb2cb7eab17fb442e4eb' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE gluster_server add column known_addresses varchar(250) null; ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061060'), 'upgrade/03_06_1060_add_alternateprobed_gluster_server.sql', '9876d3ba238cbb2cb7eab17fb442e4eb', 'engine', cast(trim('2016-07-12 18:24:21.787773-04') as timestamp), cast(trim('2016-07-12 18:24:21.846244-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f2533c78d0b8eddc6e1197a23b199777' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('host_device', 'net_iface_name', 'VARCHAR(50)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061070'), 'upgrade/03_06_1070_add_iface_column_to_host_device_table.sql', 'f2533c78d0b8eddc6e1197a23b199777', 'engine', cast(trim('2016-07-12 18:24:21.887891-04') as timestamp), cast(trim('2016-07-12 18:24:21.954488-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '671e5ee03028c2b41a07e4ae51a5c64e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vnic_profiles', 'passthrough', 'boolean default FALSE NOT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061080'), 'upgrade/03_06_1080_add_passthrough_to_vnic_profiles.sql', '671e5ee03028c2b41a07e4ae51a5c64e', 'engine', cast(trim('2016-07-12 18:24:21.996268-04') as timestamp), cast(trim('2016-07-12 18:24:22.438989-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f2ef501eafbd8e97487dbfdf3c434227' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set vds_group_id = null where vm_guid='00000000-0000-0000-0000-000000000000'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061090'), 'upgrade/03_06_1090_decouple_blank_from_cluster.sql', 'f2ef501eafbd8e97487dbfdf3c434227', 'engine', cast(trim('2016-07-12 18:24:22.479298-04') as timestamp), cast(trim('2016-07-12 18:24:22.537809-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '29164ca2951b4d9440b4e210f3c98887' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM host_device; ************************** DELETE 0 ********* QUERY ********** CREATE TABLE host_nic_vfs_config ( id UUID NOT NULL, nic_id UUID NOT NULL, is_all_networks_allowed BOOLEAN NOT NULL, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE default NULL ); ************************** CREATE TABLE ********* QUERY ********** select fn_db_create_constraint('host_nic_vfs_config', 'vfs_config_id_pk', 'PRIMARY KEY(id)'); ************************** ********* QUERY ********** select fn_db_create_constraint('host_nic_vfs_config', 'vfs_config_nic_id_fk', 'FOREIGN KEY(nic_id) REFERENCES vds_interface(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** select fn_db_create_constraint('host_nic_vfs_config', 'vfs_config_nic_id_unique', 'unique (nic_id)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061100'), 'upgrade/03_06_1100_add_host_nic_vfs_config_table.sql', '29164ca2951b4d9440b4e210f3c98887', 'engine', cast(trim('2016-07-12 18:24:22.579304-04') as timestamp), cast(trim('2016-07-12 18:24:22.921154-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '938f6c27803c47ad264c7d46b829d1ea' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE vfs_config_networks ( vfs_config_id UUID NOT NULL, network_id UUID NOT NULL, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE default NULL ); ************************** CREATE TABLE ********* QUERY ********** select fn_db_create_constraint('vfs_config_networks', 'vfs_config_networks_pk', 'PRIMARY KEY(vfs_config_id, network_id)'); ************************** ********* QUERY ********** select fn_db_create_constraint('vfs_config_networks', 'vfs_config_networks_id_fk', 'FOREIGN KEY(vfs_config_id) REFERENCES host_nic_vfs_config(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** select fn_db_create_constraint('vfs_config_networks', 'vfs_config_networks_network_fk', 'FOREIGN KEY(network_id) REFERENCES network(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** select fn_db_create_index('IDX_vfs_config_networks_vfs_config_id', 'vfs_config_networks', 'vfs_config_id', ''); ************************** ********* QUERY ********** CREATE TABLE vfs_config_labels ( vfs_config_id UUID NOT NULL, label TEXT NOT NULL, _create_date TIMESTAMP WITH TIME ZONE default LOCALTIMESTAMP, _update_date TIMESTAMP WITH TIME ZONE default NULL ); ************************** CREATE TABLE ********* QUERY ********** select fn_db_create_constraint('vfs_config_labels', 'vfs_config_labels_pk', 'PRIMARY KEY(vfs_config_id, label)'); ************************** ********* QUERY ********** select fn_db_create_constraint('vfs_config_labels', 'vfs_config_labels_id_fk', 'FOREIGN KEY(vfs_config_id) REFERENCES host_nic_vfs_config(id) ON DELETE CASCADE'); ************************** ********* QUERY ********** select fn_db_create_index('IDX_vfs_config_labels_vfs_config_id', 'vfs_config_labels', 'vfs_config_id', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061110'), 'upgrade/03_06_1110_add_vfs_config_networks_and_labels_tables.sql', '938f6c27803c47ad264c7d46b829d1ea', 'engine', cast(trim('2016-07-12 18:24:22.962425-04') as timestamp), cast(trim('2016-07-12 18:24:23.762902-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'eb7d20e7f688fb9dd316f414f96907ed' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('permissions', 'creation_date', 'bigint default (extract (epoch from now()))'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061120'), 'upgrade/03_06_1120_add_creation_date_to_permissions.sql', 'eb7d20e7f688fb9dd316f414f96907ed', 'engine', cast(trim('2016-07-12 18:24:23.803704-04') as timestamp), cast(trim('2016-07-12 18:24:24.254999-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7c85a53989510d68623c33429c85a4f5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('base_disks', 'disk_storage_type', 'SMALLINT DEFAULT NULL'); ************************** ********* QUERY ********** UPDATE base_disks SET disk_storage_type = CASE WHEN EXISTS ( SELECT 1 FROM images WHERE images.image_group_id = base_disks.disk_id) THEN 0 WHEN EXISTS ( SELECT 1 FROM disk_lun_map WHERE disk_lun_map.disk_id = base_disks.disk_id) THEN 1 END; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061130'), 'upgrade/03_06_1130_add_disk_storage_type_column_to_base_disks.sql', '7c85a53989510d68623c33429c85a4f5', 'engine', cast(trim('2016-07-12 18:24:24.295632-04') as timestamp), cast(trim('2016-07-12 18:24:24.387262-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'b2eba4ecb8b78b8109231e23d0a929e2' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('base_disks', 'cinder_volume_type', 'VARCHAR(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061140'), 'upgrade/03_06_1140_add_cinder_volume_type_column_to_base_disks.sql', 'b2eba4ecb8b78b8109231e23d0a929e2', 'engine', cast(trim('2016-07-12 18:24:24.428704-04') as timestamp), cast(trim('2016-07-12 18:24:24.487193-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fdd8ecff2de3cf7f2a8b32b826dab6be' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('vds_dynamic', 'supported_emulated_machines', 'varchar', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061150'), 'upgrade/03_06_1150_change_supported_emulated_machines_to_text.sql', 'fdd8ecff2de3cf7f2a8b32b826dab6be', 'engine', cast(trim('2016-07-12 18:24:24.528806-04') as timestamp), cast(trim('2016-07-12 18:24:24.787863-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3e7ae8138b50902dbb4aa44b2d21f96f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061160'), 'upgrade/03_06_1160_rename_blank_to_default.sql', '3e7ae8138b50902dbb4aa44b2d21f96f', 'engine', cast(trim('2016-07-12 18:24:24.828848-04') as timestamp), cast(trim('2016-07-12 18:24:24.854529-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '17f6a03e2d514d3be4fed07dda692204' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session', 'user_name', 'VARCHAR(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061170'), 'upgrade/03_06_1170_add_username_column_to_georep_session.sql', '17f6a03e2d514d3be4fed07dda692204', 'engine', cast(trim('2016-07-12 18:24:24.895358-04') as timestamp), cast(trim('2016-07-12 18:24:24.954004-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0cead84cedfe7d5442be9e599eed0edd' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE user_profiles ( profile_id UUID NOT NULL, user_id UUID NOT NULL, ssh_public_key TEXT, CONSTRAINT PK_profile_id PRIMARY KEY (profile_id) ) WITH OIDS; ************************** CREATE TABLE ********* QUERY ********** ALTER TABLE user_profiles ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES users (user_id) ON UPDATE NO ACTION ON DELETE CASCADE; ************************** ALTER TABLE ********* QUERY ********** CREATE INDEX IDX_user_profiles_user_id ON user_profiles(user_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061180'), 'upgrade/03_06_1180_add_user_profiles.sql', '0cead84cedfe7d5442be9e599eed0edd', 'engine', cast(trim('2016-07-12 18:24:24.995412-04') as timestamp), cast(trim('2016-07-12 18:24:25.420519-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9e92507f3f2ae59e43aabd07222fe910' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER TABLE repo_file_meta_data ALTER COLUMN size SET DEFAULT NULL; ************************** ALTER TABLE ********* QUERY ********** UPDATE repo_file_meta_data SET size = NULL WHERE size = 0; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061190'), 'upgrade/03_06_1190_update_repo_file_metadata_size.sql', '9e92507f3f2ae59e43aabd07222fe910', 'engine', cast(trim('2016-07-12 18:24:25.461968-04') as timestamp), cast(trim('2016-07-12 18:24:25.553795-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '67f82876f62461a7889ce3afab4abe63' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE storage_domain_dynamic SET available_disk_size = NULL, used_disk_size = NULL FROM storage_domain_static, providers WHERE storage_domain_dynamic.id = storage_domain_static.id AND storage_domain_static.storage = CAST(providers.id AS VARCHAR) AND provider_type IN ('OPENSTACK_IMAGE', 'OPENSTACK_VOLUME'); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061200'), 'upgrade/03_06_1200_set_third_party_storage_size_to_NA.sql', '67f82876f62461a7889ce3afab4abe63', 'engine', cast(trim('2016-07-12 18:24:25.595434-04') as timestamp), cast(trim('2016-07-12 18:24:25.622932-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '700522c57cc1bdabb65431823a58b508' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO action_version_map VALUES (2350, '3.6', '*'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO action_version_map VALUES (2351, '3.6', '*'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061210'), 'upgrade/03_06_1210_add_vm_host_device_commands.sql', '700522c57cc1bdabb65431823a58b508', 'engine', cast(trim('2016-07-12 18:24:25.661877-04') as timestamp), cast(trim('2016-07-12 18:24:25.753737-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8d4b3ed4840480b2207a6cb150624ebe' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('storage_device', 'name', 'varchar', 'text'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('storage_device', 'description', 'varchar', 'text'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('storage_device', 'device_path', 'varchar', 'text'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('storage_device', 'mount_point', 'varchar', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061220'), 'upgrade/03_06_1220_change_lengthy_varchar_to_text_in_storage_device_table.sql', '8d4b3ed4840480b2207a6cb150624ebe', 'engine', cast(trim('2016-07-12 18:24:25.795274-04') as timestamp), cast(trim('2016-07-12 18:24:27.004866-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '20c8b8423bbfcb044b0ab1634868afb3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE engine_backup_log( db_name VARCHAR(64), done_at TIMESTAMP WITH TIME ZONE, is_passed BOOLEAN, output_message TEXT, PRIMARY KEY (db_name, done_at) ); ************************** CREATE TABLE ********* QUERY ********** CREATE UNIQUE INDEX IDX_engine_backup_log ON engine_backup_log(db_name, done_at DESC); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061230'), 'upgrade/03_06_1230_add_backup_awareness.sql', '20c8b8423bbfcb044b0ab1634868afb3', 'engine', cast(trim('2016-07-12 18:24:27.045238-04') as timestamp), cast(trim('2016-07-12 18:24:27.453675-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '53bd6bb94ddbbf7929cb8d03d5a55737' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** delete from action_version_map where action_type in (2350,2351); ************************** DELETE 2 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061240'), 'upgrade/03_06_1240_revert_03061210_add_vm_host_device_commands.sql', '53bd6bb94ddbbf7929cb8d03d5a55737', 'engine', cast(trim('2016-07-12 18:24:27.4952-04') as timestamp), cast(trim('2016-07-12 18:24:27.545179-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd60911cf442f67e8c4dc0b1e21a015df' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('storage_device', 'is_gluster_brick', 'BOOLEAN default FALSE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061250'), 'upgrade/03_06_1250_add_is_brick_flag-to_storage_device_table.sql', 'd60911cf442f67e8c4dc0b1e21a015df', 'engine', cast(trim('2016-07-12 18:24:27.586823-04') as timestamp), cast(trim('2016-07-12 18:24:27.962916-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c19ae40a3bc5383e6838badb9d8cc960' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'gluster_tuned_profile', 'VARCHAR(50)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061260'), 'upgrade/03_06_1260_add_tuned_profile_column_to_vds_groups.sql', 'c19ae40a3bc5383e6838badb9d8cc960', 'engine', cast(trim('2016-07-12 18:24:28.013337-04') as timestamp), cast(trim('2016-07-12 18:24:28.070328-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ee637d3ebfcfa424dc8572c77ac6d4da' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_device', 'is_using_scsi_reservation', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061270'), 'upgrade/03_06_1270_add_uses_scsi_reservation.sql', 'ee637d3ebfcfa424dc8572c77ac6d4da', 'engine', cast(trim('2016-07-12 18:24:28.111759-04') as timestamp), cast(trim('2016-07-12 18:24:28.513168-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0310391663fd885a26595c82ee1d7b6a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('gluster_volume_bricks', 'fk_gluster_volume_bricks_network_id'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('gluster_volume_bricks', 'fk_gluster_volume_bricks_network_id', 'FOREIGN KEY (network_id) REFERENCES network(id) ON DELETE RESTRICT'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061280'), 'upgrade/03_06_1280_fix_constraint_gluster_brick_network.sql', '0310391663fd885a26595c82ee1d7b6a', 'engine', cast(trim('2016-07-12 18:24:28.553877-04') as timestamp), cast(trim('2016-07-12 18:24:28.645352-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ad19b48de605a9477b5d90c19f2ec45b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_index('IDX_vds_dynamic_status', 'vds_dynamic', 'status', ''); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061290'), 'upgrade/03_06_1290_add_index_on_status_to_vds_dynamic.sql', 'ad19b48de605a9477b5d90c19f2ec45b', 'engine', cast(trim('2016-07-12 18:24:28.687034-04') as timestamp), cast(trim('2016-07-12 18:24:28.828989-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '700522c57cc1bdabb65431823a58b508' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061300'), 'upgrade/03_06_1300_again_add_vm_host_device_commands.sql', '700522c57cc1bdabb65431823a58b508', 'engine', cast(trim('2016-07-12 18:24:28.870631-04') as timestamp), cast(trim('2016-07-12 18:24:28.891606-04') as timestamp), 'SKIPPED', false, 'Installed already by 03061210' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e1fd4aad897fcad7d1457a9b062e8097' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE vm_icons ( id UUID NOT NULL, data_url VARCHAR(32768) NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('vm_icons', 'pk_vm_icons', 'PRIMARY KEY (id)'); ************************** ********* QUERY ********** CREATE UNIQUE INDEX vm_icons_data_url_unique_index ON vm_icons( md5(data_url) ); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE vm_icon_defaults ( id UUID NOT NULL, os_id INTEGER NOT NULL, small_icon_id UUID NOT NULL, large_icon_id UUID NOT NULL ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('vm_icon_defaults', 'pk_vm_icon_defaults', 'PRIMARY KEY (id)'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('vm_icon_defaults', 'fk_vm_icon_defaults_small_icon_id_vm_icons_id', 'FOREIGN KEY (small_icon_id) REFERENCES vm_icons(id) ON UPDATE RESTRICT ON DELETE RESTRICT'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('vm_icon_defaults', 'fk_vm_icon_defaults_large_icon_id_vm_icons_id', 'FOREIGN KEY (large_icon_id) REFERENCES vm_icons(id) ON UPDATE RESTRICT ON DELETE RESTRICT'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('vm_icon_defaults', 'unique_vm_icon_defaults_record', 'UNIQUE (os_id)'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_static', 'small_icon_id', 'UUID NULL'); ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_static', 'large_icon_id', 'UUID NULL'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('vm_static', 'fk_vm_static_small_icon_id_vm_icons_id', 'FOREIGN KEY (small_icon_id) REFERENCES vm_icons(id) ON UPDATE RESTRICT ON DELETE RESTRICT'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('vm_static', 'fk_vm_static_large_icon_id_vm_icons_id', 'FOREIGN KEY (large_icon_id) REFERENCES vm_icons(id) ON UPDATE RESTRICT ON DELETE RESTRICT'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061310'), 'upgrade/03_06_1310_add_vm_icons_vm_icon_defaults_tables.sql', 'e1fd4aad897fcad7d1457a9b062e8097', 'engine', cast(trim('2016-07-12 18:24:28.937143-04') as timestamp), cast(trim('2016-07-12 18:24:29.778921-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '446c6a30b1780d7b515e9de621dfec5e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_set_edit_profile_permissions() RETURNS VOID AS $procedure$ DECLARE v_USER_PROFILE_EDITOR_ID UUID; BEGIN v_USER_PROFILE_EDITOR_ID := 'DEF00021-0000-0000-0000-DEF000000015'; -- Add edit_profile_user role INSERT INTO roles(id,name,description,is_readonly,role_type, app_mode) SELECT v_USER_PROFILE_EDITOR_ID, 'UserProfileEditor', 'Role that allow users to edit the UserProfile', true, 2, 255 WHERE NOT EXISTS (SELECT id,name,description,is_readonly,role_type FROM roles WHERE id = v_USER_PROFILE_EDITOR_ID); PERFORM fn_db_add_action_group_to_role(v_USER_PROFILE_EDITOR_ID, 504); INSERT INTO permissions(id, role_id, ad_element_id, object_id, object_type_id) VALUES(uuid_generate_v1(), v_USER_PROFILE_EDITOR_ID, 'EEE00000-0000-0000-0000-123456789EEE', -- Everyone 'AAA00000-0000-0000-0000-123456789AAA', 1); -- System END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_set_edit_profile_permissions(); ************************** ********* QUERY ********** DROP function __temp_set_edit_profile_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061320'), 'upgrade/03_06_1320_attach_edit_userprofile_permission.sql', '446c6a30b1780d7b515e9de621dfec5e', 'engine', cast(trim('2016-07-12 18:24:29.820581-04') as timestamp), cast(trim('2016-07-12 18:24:29.945072-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'ad0592c3fe66fd7eb0b773fe321ba894' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('engine_backup_log', 'fqdn', 'varchar(255)'); ************************** ********* QUERY ********** select fn_db_add_column('engine_backup_log', 'log_path', 'text'); ************************** ********* QUERY ********** select fn_db_rename_column('engine_backup_log', 'db_name', 'scope'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061330'), 'upgrade/03_06_1330_backup_extensions.sql', 'ad0592c3fe66fd7eb0b773fe321ba894', 'engine', cast(trim('2016-07-12 18:24:29.987222-04') as timestamp), cast(trim('2016-07-12 18:24:30.112138-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7e074f412361baeefba1033f9a2886bc' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_change_column_type('vm_device', 'device', 'VARCHAR', 'VARCHAR(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061340'), 'upgrade/03_06_1340_change_vm_device_column_length.sql', '7e074f412361baeefba1033f9a2886bc', 'engine', cast(trim('2016-07-12 18:24:30.153672-04') as timestamp), cast(trim('2016-07-12 18:24:30.512981-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '17bd73774936f2403d25401bf30e2986' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE command_assoc_entities ( command_id uuid NOT NULL, entity_id uuid NOT NULL, entity_type character varying(128), PRIMARY KEY (command_id, entity_id) ); ************************** CREATE TABLE ********* QUERY ********** SELECT fn_db_create_constraint('command_assoc_entities', 'fk_coco_command_assoc_entity', 'FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061350'), 'upgrade/03_06_1350_add_cmd_associated_entities_table.sql', '17bd73774936f2403d25401bf30e2986', 'engine', cast(trim('2016-07-12 18:24:30.553605-04') as timestamp), cast(trim('2016-07-12 18:24:30.745303-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5b94db1f195cc47d4ea16c977f5f8ef6' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'is_update_available', 'BOOLEAN NOT NULL DEFAULT FALSE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061360'), 'upgrade/03_06_1360_add_updates_available_to_vds_dynamic.sql', '5b94db1f195cc47d4ea16c977f5f8ef6', 'engine', cast(trim('2016-07-12 18:24:30.786982-04') as timestamp), cast(trim('2016-07-12 18:24:31.154535-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '49f695a8b2083e7ae021b6537d91714b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('storage_domain_static', 'warning_low_space_indicator', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('storage_domain_static', 'critical_space_action_blocker', 'INTEGER DEFAULT NULL'); ************************** ********* QUERY ********** UPDATE storage_domain_static SET warning_low_space_indicator=cast(( SELECT option_value FROM vdc_options WHERE option_name='WarningLowSpaceIndicator' AND version='general') AS INTEGER), critical_space_action_blocker=cast(( SELECT option_value FROM vdc_options WHERE option_name='CriticalSpaceActionBlocker' AND version='general') AS INTEGER); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061370'), 'upgrade/03_06_1370_add_thresholds_to_storage_domain_static.sql', '49f695a8b2083e7ae021b6537d91714b', 'engine', cast(trim('2016-07-12 18:24:31.195145-04') as timestamp), cast(trim('2016-07-12 18:24:31.303347-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9286021bf1e83ae68df028b7181159a6' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_audit_log_gluster_volume_id ON audit_log(gluster_volume_id) WHERE gluster_volume_id IS NOT NULL; ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061380'), 'upgrade/03_06_1380_index_audit_log_by_gluster_volume_id.sql', '9286021bf1e83ae68df028b7181159a6', 'engine', cast(trim('2016-07-12 18:24:31.345132-04') as timestamp), cast(trim('2016-07-12 18:24:31.495224-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '7bf5e611990a3aaffce84159d9e08d2c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE cluster_features ( feature_id UUID NOT NULL, feature_name VARCHAR(256) NOT NULL, version VARCHAR(40), category INTEGER NOT NULL, description TEXT, CONSTRAINT PK_cluster_features PRIMARY KEY (feature_id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX IDX_cluster_features_version_and_category ON cluster_features(category, version); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE supported_cluster_features ( cluster_id UUID NOT NULL, feature_id UUID NOT NULL, is_enabled BOOLEAN, CONSTRAINT PK_supported_cluster_features PRIMARY KEY (cluster_id, feature_id), FOREIGN KEY (cluster_id) REFERENCES vds_groups(vds_group_id) ON DELETE CASCADE, FOREIGN KEY (feature_id) REFERENCES cluster_features(feature_id) ON DELETE CASCADE ) ; ************************** CREATE TABLE ********* QUERY ********** CREATE UNIQUE INDEX IDX_supported_cluster_features ON supported_cluster_features(cluster_id, feature_id); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE supported_host_features ( host_id UUID NOT NULL, feature_name VARCHAR(256) NOT NULL, CONSTRAINT PK_supported_host_features PRIMARY KEY (host_id, feature_name), FOREIGN KEY (host_id) REFERENCES vds_static(vds_id) ON DELETE CASCADE ) ; ************************** CREATE TABLE ********* QUERY ********** INSERT INTO cluster_features VALUES ('00000017-0017-0017-0017-000000000066', 'GLUSTER_GEO_REPLICATION', '3.5', 2, 'Gluster Geo-Replication'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_features VALUES ('00000018-0018-0018-0018-000000000093', 'GLUSTER_SNAPSHOT', '3.5', 2, 'Gluster Volume Snapshot Management'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_features VALUES ('00000019-0019-0019-0019-000000000300', 'GLUSTER_BRICK_MANAGEMENT', '3.5', 2, 'Gluster Brick Provisioning'); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061390'), 'upgrade/03_06_1390_add_cluster_features_table.sql', '7bf5e611990a3aaffce84159d9e08d2c', 'engine', cast(trim('2016-07-12 18:24:31.536855-04') as timestamp), cast(trim('2016-07-12 18:24:32.278789-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f2dee82a9d3e00b596b0a4a939c0acfa' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'provider_id', 'UUID'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('vm_static', 'fk_vm_static_provider_id', 'FOREIGN KEY (provider_id) REFERENCES providers(id) ON DELETE SET NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061400'), 'upgrade/03_06_1400_add_provider_id_to_vms.sql', 'f2dee82a9d3e00b596b0a4a939c0acfa', 'engine', cast(trim('2016-07-12 18:24:32.320047-04') as timestamp), cast(trim('2016-07-12 18:24:32.403319-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '708648af27612eb6682e8f90ed758f11' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_drop_column('gluster_georep_session_details', 'files_synced'); ************************** ********* QUERY ********** select fn_db_drop_column('gluster_georep_session_details', 'files_pending'); ************************** ********* QUERY ********** select fn_db_drop_column('gluster_georep_session_details', 'bytes_pending'); ************************** ********* QUERY ********** select fn_db_drop_column('gluster_georep_session_details', 'deletes_pending'); ************************** ********* QUERY ********** select fn_db_drop_column('gluster_georep_session_details', 'files_skipped'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'data_pending', 'BIGINT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'entry_pending', 'BIGINT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'meta_pending', 'BIGINT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'failures', 'BIGINT NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'last_synced_at', 'TIMESTAMP WITH TIME ZONE NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'checkpoint_time', 'TIMESTAMP WITH TIME ZONE NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'checkpoint_completed_time', 'TIMESTAMP WITH TIME ZONE NULL'); ************************** ********* QUERY ********** select fn_db_add_column('gluster_georep_session_details', 'is_checkpoint_completed', 'BOOLEAN DEFAULT FALSE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061410'), 'upgrade/03_06_1410_alter_georep_session_details.sql', '708648af27612eb6682e8f90ed758f11', 'engine', cast(trim('2016-07-12 18:24:32.445034-04') as timestamp), cast(trim('2016-07-12 18:24:32.895795-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '08db58fe7fd4fee6e671e6eacc524177' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE policy_units SET custom_properties_regex='{ "CpuOverCommitDurationMinutes" : "^([1-9][0-9]*)$", "HighUtilization" : "^([5-9][0-9])$", "MaxFreeMemoryForOverUtilized": "^[1-9][0-9]*$", "MinFreeMemoryForUnderUtilized": "^[1-9][0-9]*$" }' WHERE id='7db4ab05-81ab-42e8-868a-aee2df483ed2'; ************************** UPDATE 1 ********* QUERY ********** UPDATE policy_units SET custom_properties_regex='{ "CpuOverCommitDurationMinutes" : "^([1-9][0-9]*)$", "HighUtilization" : "^([5-9][0-9])$", "LowUtilization" : "^([0-9]|[1-4][0-9])$", "HostsInReserve": "^[0-9][0-9]*$", "EnableAutomaticHostPowerManagement": "^(true|false)$", "MaxFreeMemoryForOverUtilized": "^[1-9][0-9]*$", "MinFreeMemoryForUnderUtilized": "^[1-9][0-9]*$" }' WHERE id='736999d0-1023-46a4-9a75-1316ed50e151'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061420'), 'upgrade/03_06_1420_add_memory_balancing_vars.sql', '08db58fe7fd4fee6e671e6eacc524177', 'engine', cast(trim('2016-07-12 18:24:32.937323-04') as timestamp), cast(trim('2016-07-12 18:24:33.020074-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'dd4335538adcf0a4249064c6e9d9b69e' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'num_of_io_threads', 'INTEGER NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061430'), 'upgrade/03_06_1430_add_num_of_io_threads_to_vm_static.sql', 'dd4335538adcf0a4249064c6e9d9b69e', 'engine', cast(trim('2016-07-12 18:24:33.061415-04') as timestamp), cast(trim('2016-07-12 18:24:33.855237-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1e27a30ccb82c4f238a60bfa3d5e517b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_fix_bool_fence_agents_options() RETURNS VOID AS $procedure$ DECLARE v_agents varchar[] := array['inet4-only', 'inet6-only', 'lanplus', 'missing-as-off', 'notls', 'snmp-priv-passwd-script', 'ssh', 'ssl-insecure', 'ssl-secure', 'ssl', 'use-sudo', 'verbose', 'version']; v_temp_option_name varchar(50); v_option_true_val varchar(50); v_option_one_val varchar(50); BEGIN for i in 1 .. array_upper(v_agents, 1) loop v_temp_option_name := 'temp__' || upper(v_agents[i]) || '__expr'; v_option_true_val := v_agents[i] || '=' || 'true'; v_option_one_val := v_agents[i] || '=' || '1'; update fence_agents set options = replace(options, v_option_one_val, v_temp_option_name) where not encrypt_options; update fence_agents set options = replace(options, v_option_true_val, v_temp_option_name) where not encrypt_options; update fence_agents set options = replace(options, v_agents[i], v_option_one_val) where not encrypt_options; update fence_agents set options = replace(options, v_temp_option_name, v_option_one_val) where not encrypt_options; end loop; --fix options -- in case we have options that one is substring of the other we will get '=1-' expressions that -- should be replaced with '-' (for example 'ssl-insecure', 'ssl-secure', 'ssl') update fence_agents set options = replace(options,'=1-','-') where not encrypt_options; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_fix_bool_fence_agents_options(); ************************** ********* QUERY ********** DROP function __temp_fix_bool_fence_agents_options(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061440'), 'upgrade/03_06_1440_fix_bool_fence_agents_options.sql', '1e27a30ccb82c4f238a60bfa3d5e517b', 'engine', cast(trim('2016-07-12 18:24:33.911851-04') as timestamp), cast(trim('2016-07-12 18:24:34.037024-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a22110e4ac698abcc9a7ed34e8caaa76' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'console_disconnect_action', 'VARCHAR(64)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061450'), 'upgrade/03_06_1450_add_vm_static_console_disconnect_action.sql', 'a22110e4ac698abcc9a7ed34e8caaa76', 'engine', cast(trim('2016-07-12 18:24:34.078585-04') as timestamp), cast(trim('2016-07-12 18:24:34.137094-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8b50a7c93c46e2adcd44fb036a3f287f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM vds_interface WHERE id IN (SELECT id FROM (SELECT id, row_number() over (partition BY vds_id, name ORDER BY _update_date) AS rnum FROM vds_interface) t WHERE t.rnum > 1); ************************** DELETE 0 ********* QUERY ********** UPDATE vds_interface SET network_name = null WHERE id in ( SELECT vds_interface.id FROM vds_interface JOIN network on vds_interface.network_name = network.name WHERE network.vlan_id is not NULL AND vds_interface.vlan_id is NULL ); ************************** UPDATE 0 ********* QUERY ********** CREATE TABLE network_attachments ( id UUID NOT NULL CONSTRAINT pk_network_attachments_id PRIMARY KEY, network_id UUID NOT NULL, nic_id UUID NOT NULL, boot_protocol CHARACTER VARYING(20), address CHARACTER VARYING(20), netmask CHARACTER VARYING(20), gateway CHARACTER VARYING(20), custom_properties TEXT, _create_date TIMESTAMP WITH TIME ZONE DEFAULT ('now'::text)::timestamp without time zone, _update_date TIMESTAMP WITH TIME ZONE, FOREIGN KEY (network_id) REFERENCES network(id) ON DELETE CASCADE, FOREIGN KEY (nic_id) REFERENCES vds_interface (id) ON DELETE CASCADE, UNIQUE (network_id, nic_id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX IDX_network_attachments_nic_id ON network_attachments(nic_id); ************************** CREATE INDEX ********* QUERY ********** INSERT INTO network_attachments (id, network_id, nic_id, boot_protocol, address, netmask, gateway, custom_properties) SELECT uuid_generate_v1(), network.id AS network_id, coalesce(base_nics.id, vds_interface.id) AS nic_id, vds_interface.boot_protocol, vds_interface.addr AS address, vds_interface.subnet AS netmask, vds_interface.gateway, vds_interface.custom_properties FROM vds_interface JOIN vds_static ON vds_static.vds_id = vds_interface.vds_id LEFT JOIN vds_interface base_nics ON base_nics.name = vds_interface.base_interface AND vds_interface.vds_id = base_nics.vds_id JOIN network_cluster ON vds_static.vds_group_id = network_cluster.cluster_id JOIN network on network.id = network_cluster.network_id WHERE vds_interface.network_name is not null AND network.name = vds_interface.network_name; ************************** INSERT 0 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061460'), 'upgrade/03_06_1460_add_network_attachment.sql', '8b50a7c93c46e2adcd44fb036a3f287f', 'engine', cast(trim('2016-07-12 18:24:34.178468-04') as timestamp), cast(trim('2016-07-12 18:24:34.687134-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e1bd47bc5f55617f8d02fa38612c25ae' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guest_timezone_offset', 'integer'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guest_timezone_name', 'varchar(255)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guestos_arch', 'integer NOT NULL DEFAULT 0'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guestos_codename', 'varchar(255)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guestos_distribution', 'varchar(255)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guestos_kernel_version', 'varchar(255)'); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guestos_type', 'varchar(255) NOT NULL DEFAULT ''Other'''); ************************** ********* QUERY ********** select fn_db_add_column('vm_dynamic', 'guestos_version', 'varchar(255)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061470'), 'upgrade/03_06_1470_vmdynamic_add_timezone_and_guestosinfo.sql', 'e1bd47bc5f55617f8d02fa38612c25ae', 'engine', cast(trim('2016-07-12 18:24:34.728579-04') as timestamp), cast(trim('2016-07-12 18:24:35.520403-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2278b56e69f63c48ff940f5746b7ac65' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('vm_dynamic','guest_mem_free','integer','bigint'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('vm_dynamic','guest_mem_buffered','integer','bigint'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('vm_dynamic','guest_mem_cached','integer','bigint'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061480'), 'upgrade/03_06_1480_change_guest_mem_free_to_bigint.sql', '2278b56e69f63c48ff940f5746b7ac65', 'engine', cast(trim('2016-07-12 18:24:35.5619-04') as timestamp), cast(trim('2016-07-12 18:24:36.529212-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'eba1ae1c4c58b922ce3a99647b6d84bd' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE dwh_history_timekeeping SET var_datetime = '2005-01-01' WHERE var_name = 'lastSync'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061490'), 'upgrade/03_06_1490_update_lastSync_in_dwh_history_timekeeping.sql', 'eba1ae1c4c58b922ce3a99647b6d84bd', 'engine', cast(trim('2016-07-12 18:24:36.569865-04') as timestamp), cast(trim('2016-07-12 18:24:36.619764-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '13cc9992f912bf3dbb3ae87b43a5ef63' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('images', 'volume_classification', 'SMALLINT'); ************************** ********* QUERY ********** UPDATE images SET volume_classification = CASE WHEN active THEN 0 ELSE 1 END; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061500'), 'upgrade/03_06_1500_add_column_volume_classification.sql', '13cc9992f912bf3dbb3ae87b43a5ef63', 'engine', cast(trim('2016-07-12 18:24:36.653377-04') as timestamp), cast(trim('2016-07-12 18:24:36.736482-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4639cab5903277c79f517572317ce409' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'external_status', 'integer not null default 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061510'), 'upgrade/03_06_1510_add_host_external_status.sql', '4639cab5903277c79f517572317ce409', 'engine', cast(trim('2016-07-12 18:24:36.769722-04') as timestamp), cast(trim('2016-07-12 18:24:37.129242-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3d717f641d568c46894e14ab8982e13b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('audit_log','brick_id','uuid'); ************************** ********* QUERY ********** select fn_db_add_column('audit_log','brick_path','text DEFAULT ''''::text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061520'), 'upgrade/03_06_1520_add_brickInfo_audit_log_table.sql', '3d717f641d568c46894e14ab8982e13b', 'engine', cast(trim('2016-07-12 18:24:37.169686-04') as timestamp), cast(trim('2016-07-12 18:24:38.422219-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '01d81aab51c6d56a485609abe82f911b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vds_dynamic', 'is_hostdev_enabled', 'BOOLEAN NOT NULL DEFAULT FALSE') ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061530'), 'upgrade/03_06_1530_add_host_passthrough_flag.sql', '01d81aab51c6d56a485609abe82f911b', 'engine', cast(trim('2016-07-12 18:24:38.461197-04') as timestamp), cast(trim('2016-07-12 18:24:38.829227-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '459b81224c19e905fb6b96df1e528dbf' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE libvirt_secrets ( secret_id UUID NOT NULL, secret_value TEXT NOT NULL, secret_usage_type integer NOT NULL, secret_description TEXT, provider_id UUID NOT NULL, _create_date timestamp with time zone DEFAULT ('now'::text)::timestamp without time zone, _update_date timestamp with time zone, CONSTRAINT PK_secret_id PRIMARY KEY (secret_id), FOREIGN KEY (provider_id) REFERENCES providers(id) ON DELETE CASCADE ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX IDX_libvirt_secrets_provider_id ON libvirt_secrets(provider_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061540'), 'upgrade/03_06_1540_libvirt_secrets.sql', '459b81224c19e905fb6b96df1e528dbf', 'engine', cast(trim('2016-07-12 18:24:38.8781-04') as timestamp), cast(trim('2016-07-12 18:24:39.269828-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '55ad136b6652380b832cb389dce9650a' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO gluster_config_master(config_key, config_description, minimum_supported_cluster, config_possible_values, config_feature) values('use_meta_volume', 'Meta volume for the geo-replication session', '3.5', 'true;false', 'geo_replication'); ************************** INSERT 19602 1 ********* QUERY ********** UPDATE gluster_config_master SET config_key= (CASE config_key WHEN 'log-file' THEN 'log_file' WHEN 'gluster-log-file' THEN 'gluster_log_file' WHEN 'ignore-deletes' THEN 'ignore_deletes' WHEN 'ssh-command' THEN 'ssh_command' ELSE config_key END); ************************** UPDATE 12 ********* QUERY ********** UPDATE gluster_config_master SET config_possible_values='true;false' WHERE config_key='ignore_deletes'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061550'), 'upgrade/03_06_1550_insert_and_update_config_description.sql', '55ad136b6652380b832cb389dce9650a', 'engine', cast(trim('2016-07-12 18:24:39.311362-04') as timestamp), cast(trim('2016-07-12 18:24:39.436148-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '229f414be5eaf2db13f7e8995193f7e7' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_add_spec_param_to_console_devices() RETURNS VOID AS $procedure$ BEGIN update vm_device set spec_params = '{ "enableSocket" : "true" }' where device='console' and spec_params='{ }'; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_add_spec_param_to_console_devices(); ************************** ********* QUERY ********** DROP function __temp_add_spec_param_to_console_devices(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061560'), 'upgrade/03_06_1560_add_spec_param_to_console_devices.sql', '229f414be5eaf2db13f7e8995193f7e7', 'engine', cast(trim('2016-07-12 18:24:39.477585-04') as timestamp), cast(trim('2016-07-12 18:24:39.602882-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a898545531fe1602cf7e59d046b357d8' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('storage_domain_dynamic', 'external_status', 'integer not null default 0'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061570'), 'upgrade/03_06_1570_add_sd_external_status.sql', 'a898545531fe1602cf7e59d046b357d8', 'engine', cast(trim('2016-07-12 18:24:39.644785-04') as timestamp), cast(trim('2016-07-12 18:24:39.795283-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '2dffa011c804a5f4ab072a12b3cb0e42' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'gluster_cli_based_snapshot_scheduled', 'BOOLEAN NOT NULL DEFAULT TRUE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061580'), 'upgrade/03_06_1580_add_gluster_cli_based_snapshot_scheduled_column_to_vds_groups.sql', '2dffa011c804a5f4ab072a12b3cb0e42', 'engine', cast(trim('2016-07-12 18:24:39.844517-04') as timestamp), cast(trim('2016-07-12 18:24:40.078906-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9ca57e7156b6241f4fd8c642e19d6f29' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE FUNCTION _createFilter(uuid, character varying(128), text) RETURNS void AS $$ INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ($1, $2, true, NULL, 0, true, $3); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', $1, 0, 0); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', $1, 0, 0); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', $1, 0, 0); INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', $1, 0, 0); $$ LANGUAGE SQL; ************************** CREATE FUNCTION ********* QUERY ********** select _createFilter('728a21f1-f97e-4d32-bc3e-b3cc49756abb', 'HostDevice', 'Filters out hosts not supporting VM required host devices'); ************************** ********* QUERY ********** DROP FUNCTION _createFilter(uuid, character varying(128), text); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061590'), 'upgrade/03_06_1590_add_host_device_policy_unit.sql', '9ca57e7156b6241f4fd8c642e19d6f29', 'engine', cast(trim('2016-07-12 18:24:40.119417-04') as timestamp), cast(trim('2016-07-12 18:24:40.244684-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd71340f0b133ded268a732a7dd3c897b' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_groups', 'ksm_merge_across_nodes', 'boolean default TRUE NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061600'), 'upgrade/03_06_1600_add_ksm_with_numa_awareness.sql', 'd71340f0b133ded268a732a7dd3c897b', 'engine', cast(trim('2016-07-12 18:24:40.286238-04') as timestamp), cast(trim('2016-07-12 18:24:40.545625-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '412205db600488fd11dea6ddd22f69b3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_constraint('vds_interface', 'vds_interface_vds_id_name_unique', 'unique (vds_id, name)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061610'), 'upgrade/03_06_1610_unique_vds_id_name_vds_interface.sql', '412205db600488fd11dea6ddd22f69b3', 'engine', cast(trim('2016-07-12 18:24:40.586276-04') as timestamp), cast(trim('2016-07-12 18:24:40.728032-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'de28e64805ac2af61c70f3763c29a231' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** Create or replace FUNCTION __temp_insert_add_domain_import_export_permissions_for_admins() RETURNS VOID AS $procedure$ DECLARE v_VM_IMPORTER_EXPORTER_ID UUID; BEGIN v_VM_IMPORTER_EXPORTER_ID := 'def00030-0000-0000-0000-def000000011'; INSERT INTO roles (id, name, description, is_readonly, role_type, allows_viewing_children, app_mode) VALUES (v_VM_IMPORTER_EXPORTER_ID, 'VmImporterExporter', 'Administrator Role, with permission to import or export Vms', true, 1, true, 1); PERFORM fn_db_add_action_group_to_role(v_VM_IMPORTER_EXPORTER_ID,8); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_insert_add_domain_import_export_permissions_for_admins(); ************************** ********* QUERY ********** DROP function __temp_insert_add_domain_import_export_permissions_for_admins(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061620'), 'upgrade/03_06_1620_add_domain_import_export_permissions_for_admins.sql', 'de28e64805ac2af61c70f3763c29a231', 'engine', cast(trim('2016-07-12 18:24:40.769542-04') as timestamp), cast(trim('2016-07-12 18:24:40.894589-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4bd9c27ba102c132637eb07c43efe15c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE gluster_config_master SET config_possible_values='false;true' WHERE config_key='use_meta_volume'; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061630'), 'upgrade/03_06_1630_update_config_option.sql', '4bd9c27ba102c132637eb07c43efe15c', 'engine', cast(trim('2016-07-12 18:24:40.935899-04') as timestamp), cast(trim('2016-07-12 18:24:40.994443-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'a4aaafadd7a984949f67e75c818fce46' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('storage_server_connections','user_name','varchar','text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061640'), 'upgrade/03_06_1640_change_storage_connections_user_name_type.sql', 'a4aaafadd7a984949f67e75c818fce46', 'engine', cast(trim('2016-07-12 18:24:41.035849-04') as timestamp), cast(trim('2016-07-12 18:24:41.328747-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'db2cc93b27eaf20d2f1b58d60d2b9852' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('providers', 'additional_properties', 'text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061650'), 'upgrade/03_06_1650_add_additional_properties_to_providers.sql', 'db2cc93b27eaf20d2f1b58d60d2b9852', 'engine', cast(trim('2016-07-12 18:24:41.369377-04') as timestamp), cast(trim('2016-07-12 18:24:41.436896-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd11fd0beb7d62a1a86377e3470d13d52' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('vm_static', 'fk_vds_static_vm_static'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('vm_static','dedicated_vm_for_vds','uuid','text'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061660'), 'upgrade/03_06_1660_multiple_preferred_hosts_as_text.sql', 'd11fd0beb7d62a1a86377e3470d13d52', 'engine', cast(trim('2016-07-12 18:24:41.477622-04') as timestamp), cast(trim('2016-07-12 18:24:41.987274-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'fae9ba78ddc2ec7221342e467ff5f2d9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_create_constraint('vds_interface', 'vds_interface_vds_id_network_name_unique', 'unique (vds_id, network_name)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061670'), 'upgrade/03_06_1670_unique_vds_id_network_name_vds_interface.sql', 'fae9ba78ddc2ec7221342e467ff5f2d9', 'engine', cast(trim('2016-07-12 18:24:42.027586-04') as timestamp), cast(trim('2016-07-12 18:24:42.185813-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd4a2e4d09ed35e1d99733bf0ca4db87f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE network_attachments set boot_protocol = case boot_protocol when '0' then 'NONE' when '1' then 'DHCP' when '2' then 'STATIC_IP' when 'DHCP' then 'DHCP' when 'STATIC_IP' then 'STATIC_IP' else 'NONE' end; ************************** UPDATE 0 ********* QUERY ********** ALTER TABLE network_attachments ADD CONSTRAINT boot_protocol_enum_values CHECK (boot_protocol = 'DHCP' or boot_protocol = 'STATIC_IP' or boot_protocol = 'NONE'); ************************** ALTER TABLE ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061680'), 'upgrade/03_06_1680_do_not_reference_network_boot_protocol_enum_with_numbers.sql', 'd4a2e4d09ed35e1d99733bf0ca4db87f', 'engine', cast(trim('2016-07-12 18:24:42.227578-04') as timestamp), cast(trim('2016-07-12 18:24:42.310875-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8ded94515ade4f1853bb54bcf28bef5c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'librbd1_version', 'varchar(4000)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061690'), 'upgrade/03_06_1690_add_librbd1_version_to_vds_dynamic.sql', '8ded94515ade4f1853bb54bcf28bef5c', 'engine', cast(trim('2016-07-12 18:24:42.352517-04') as timestamp), cast(trim('2016-07-12 18:24:42.419338-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '50c151c214aa638d3950da7cb552adbf' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_create_constraint('async_tasks', 'fk_async_tasks_command_entities_command_id', 'FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('async_tasks', 'fk_async_tasks_command_entities_root_command_id', 'FOREIGN KEY (root_command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061700'), 'upgrade/03_06_1700_reintoduce_async_tasks_fk.sql', '50c151c214aa638d3950da7cb552adbf', 'engine', cast(trim('2016-07-12 18:24:42.460812-04') as timestamp), cast(trim('2016-07-12 18:24:42.552601-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f07a72307a931873ba0097d151cceabd' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_action_group_to_role('def00030-0000-0000-0000-def000000011',1300); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061710'), 'upgrade/03_06_1710_add_login_export_import_admin.sql', 'f07a72307a931873ba0097d151cceabd', 'engine', cast(trim('2016-07-12 18:24:42.594295-04') as timestamp), cast(trim('2016-07-12 18:24:42.652619-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1fd44297fb0c1588878da1480e762a09' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('vm_pools', 'is_being_destroyed', 'boolean NOT NULL DEFAULT false'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061720'), 'upgrade/03_06_1720_vm_pools_add_is_being_destroyed.sql', '1fd44297fb0c1588878da1480e762a09', 'engine', cast(trim('2016-07-12 18:24:42.694253-04') as timestamp), cast(trim('2016-07-12 18:24:42.953276-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5cffbfa267b7f0e3afb4737d2215ea0f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update command_entities set return_value = replace(return_value,'VdcFault','EngineFault'), return_value_class = replace(return_value_class,'VdcFault','EngineFault'); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061730'), 'upgrade/03_06_1730_rename_vdcfault_to_enginefault.sql', '5cffbfa267b7f0e3afb4737d2215ea0f', 'engine', cast(trim('2016-07-12 18:24:42.994067-04') as timestamp), cast(trim('2016-07-12 18:24:43.020565-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '4e6395ddc51cd689c686ba6ecf40856c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('async_tasks', 'fk_async_tasks_command_entities_command_id'); ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('async_tasks', 'fk_async_tasks_command_entities_root_command_id'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061740'), 'upgrade/03_06_1740_revert_async_tasks_fk.sql', '4e6395ddc51cd689c686ba6ecf40856c', 'engine', cast(trim('2016-07-12 18:24:43.060709-04') as timestamp), cast(trim('2016-07-12 18:24:43.152549-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f16d259af579b8efb25e0880d8ac42c5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE TABLE vm_host_pinning_map ( vm_id UUID NOT NULL, vds_id UUID NOT NULL, FOREIGN KEY (vm_id) REFERENCES vm_static(vm_guid) ON DELETE CASCADE, FOREIGN KEY (vds_id) REFERENCES vds_static (vds_id) ON DELETE CASCADE, UNIQUE (vm_id, vds_id) ); ************************** CREATE TABLE ********* QUERY ********** INSERT INTO vm_host_pinning_map(vm_id, vds_id) SELECT vm_guid, dedicated_vm_for_vds::uuid FROM vm_static WHERE dedicated_vm_for_vds IS NOT null; ************************** INSERT 0 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061750'), 'upgrade/03_06_1750_pinning_to_multiple_hosts_connection_table.sql', 'f16d259af579b8efb25e0880d8ac42c5', 'engine', cast(trim('2016-07-12 18:24:43.193984-04') as timestamp), cast(trim('2016-07-12 18:24:43.402747-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f27f134a023b269bc86006e1b4ed8f52' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_change_column_type('vds_static', 'sshkeyfingerprint', 'character varying', 'character varying(1024)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061760'), 'upgrade/03_06_1760_host_sshfingerprint.sql', 'f27f134a023b269bc86006e1b4ed8f52', 'engine', cast(trim('2016-07-12 18:24:43.444045-04') as timestamp), cast(trim('2016-07-12 18:24:43.878623-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '970b6d1c39cdf5129a5b343e07a44cc9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_change_column_type('vds_dynamic', 'hooks', 'VARCHAR', 'TEXT'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061770'), 'upgrade/03_06_1770_change_vds_dynamic_hooks_to_text.sql', '970b6d1c39cdf5129a5b343e07a44cc9', 'engine', cast(trim('2016-07-12 18:24:43.91888-04') as timestamp), cast(trim('2016-07-12 18:24:44.270173-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'def6b9935ec149c1a3e8bbb2dd0994a1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_create_storage_server_connection_extension_table() RETURNS void AS $FUNCTION$ BEGIN IF (NOT EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema = 'public' AND table_name ILIKE 'storage_server_connection_extension')) THEN CREATE TABLE storage_server_connection_extension ( id uuid NOT NULL, vds_id uuid NOT NULL, iqn character varying(128) NOT NULL, user_name text NOT NULL, password text NOT NULL ); ALTER TABLE storage_server_connection_extension ADD CONSTRAINT pk_storage_server_connection_extension PRIMARY KEY (id); ALTER TABLE storage_server_connection_extension ADD CONSTRAINT storage_server_connection_extension_vds_id_iqn UNIQUE(vds_id, iqn); END IF; END; $FUNCTION$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_create_storage_server_connection_extension_table(); ************************** ********* QUERY ********** DROP FUNCTION __temp_create_storage_server_connection_extension_table(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061780'), 'upgrade/03_06_1780_create_storage_server_connection_extension_table.sql', 'def6b9935ec149c1a3e8bbb2dd0994a1', 'engine', cast(trim('2016-07-12 18:24:44.310532-04') as timestamp), cast(trim('2016-07-12 18:24:44.744053-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'f1ace72c5bd17b5470c7f8fcb93b8717' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vds_dynamic', 'glusterfs_cli_version', 'varchar(4000)'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061790'), 'upgrade/03_06_1790_add_glusterfs_cli_version_to_vds_dynamic.sql', 'f1ace72c5bd17b5470c7f8fcb93b8717', 'engine', cast(trim('2016-07-12 18:24:44.785787-04') as timestamp), cast(trim('2016-07-12 18:24:44.844276-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '3088e299a024f5401726e234b36fe8d1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vds_groups set cpu_name='IBM POWER 8' where cpu_name='IBM POWER 8E'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061800'), 'upgrade/03_06_1800_remove_power8e_cpu_type.sql', '3088e299a024f5401726e234b36fe8d1', 'engine', cast(trim('2016-07-12 18:24:44.885687-04') as timestamp), cast(trim('2016-07-12 18:24:44.943774-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8c0abfe38d96747c6b9e177e755c2ab1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('user_profiles', 'ssh_public_key_id', 'uuid'); ************************** ********* QUERY ********** UPDATE user_profiles SET ssh_public_key_id = uuid_generate_v1() WHERE ssh_public_key_id = null; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061810'), 'upgrade/03_06_1810_add_ssh_public_key_id_to_user_profiles_table.sql', '8c0abfe38d96747c6b9e177e755c2ab1', 'engine', cast(trim('2016-07-12 18:24:44.985517-04') as timestamp), cast(trim('2016-07-12 18:24:45.044327-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0e403619a06c28df12196e78eb2d898f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_static set default_display_type = case default_display_type when 0 then 2 when 1 then 0 when 2 then 1 end; ************************** UPDATE 6 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061820'), 'upgrade/03_06_1820_fix_display_type_numbers.sql', '0e403619a06c28df12196e78eb2d898f', 'engine', cast(trim('2016-07-12 18:24:45.085619-04') as timestamp), cast(trim('2016-07-12 18:24:45.143863-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1f85d5acde47051945aa9484f1676551' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_action_group_to_role('DEF00002-0000-0000-0000-DEF000000002', 1663); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061830'), 'upgrade/03_06_1830_add_configure_mac_pool_role_to_data_center_admin.sql', '1f85d5acde47051945aa9484f1676551', 'engine', cast(trim('2016-07-12 18:24:45.185331-04') as timestamp), cast(trim('2016-07-12 18:24:45.243985-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0e55e69dc2cc7afa3a225d3b621f69e3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_delete_config_value('MacPoolRanges','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('MaxMacsCountInPool','general'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061840'), 'upgrade/03_06_1840_remove_deprecated_vdc_options.sql', '0e55e69dc2cc7afa3a225d3b621f69e3', 'engine', cast(trim('2016-07-12 18:24:45.285528-04') as timestamp), cast(trim('2016-07-12 18:24:45.377162-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '944e97093719a3afe83b3cae9e2740f9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_drop_column('vds_interface', 'custom_properties'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061850'), 'upgrade/03_06_1850_remove_custom_properties_from_vds_interface.sql', '944e97093719a3afe83b3cae9e2740f9', 'engine', cast(trim('2016-07-12 18:24:45.418731-04') as timestamp), cast(trim('2016-07-12 18:24:45.477302-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '44b78bd71e7b7ebd1edc35070ac451c1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update vm_device set spec_params = '{ "consoleType": "serial", "enableSocket" : "true" }' where device='console' and spec_params= '{ "enableSocket" : "true" }'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061860'), 'upgrade/03_06_1860_add_type_spec_param_to_console_devices.sql', '44b78bd71e7b7ebd1edc35070ac451c1', 'engine', cast(trim('2016-07-12 18:24:45.518722-04') as timestamp), cast(trim('2016-07-12 18:24:45.545678-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '9e3277a81d9fd262f300851acdb3bace' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** /************************************************************************************ deletes deprecated entries from the vdc_options configuration table. ************************************************************************************/ select fn_db_delete_config_value_all_versions('SupportedStorageFormats'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AdminPassword','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AdminUser','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AsyncPollingCyclesBeforeCallbackCleanup','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AsyncPollingCyclesBeforeRefreshSuspend','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AutoMode','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AutoSuspendTimeInMinutes','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CABaseDirectory','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CACertificatePath','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CAEngineKey','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CBCCertificateScriptName','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CBCCloseCertificateScriptName','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CbcCheckOnVdsChange','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CertAlias','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CertificateFileName','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CertificateFingerPrint','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CertificatePassword','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('CustomPublicConfig_AppsWebSite','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('DebugSearchLogging','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('DefaultWorkgroup','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailDomain','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailEnableSsl','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailHost','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailIsBodyHtml','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailPassword','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailPort','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailUseDefaultCredentials','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ENMailUser','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('FreeSpaceCriticalLow','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('GlusterRefreshRateGeoRepStatus', 'general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('GlusterRefreshRateGeoRepDiscovery', 'general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('FreeSpaceCriticalLowInGB','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('FreeSpaceLow','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('HotPlugUnsupportedOsList','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('HotPlugSupportedOsList','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ImagesSyncronizationTimeout','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LdapServers','3.0'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LicenseCertificateFingerPrint','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('keystorePass','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('keystoreUrl','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LocalAdminPassword','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LogDBCommands','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LogVdsRegistration','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LogXmlRpcData','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('NetConsolePort','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKey2003','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKey2003x64','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKey2008','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKey2008R2','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKey2008x64','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKey','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKeyWindow7','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKeyWindow7x64','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKeyWindows8','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKeyWindows8x64','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ProductKeyWindows2012x64','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VdsFenceOptionMapping','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('MountPointsToIgoreInGlusterStorageList','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('FileSystemTypesToIgoreInGlusterStorageList','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('DefaultGlusterBrickMountPoint','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('GlusterStorageDeviceListMountPointsToIgore','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('GlusterStorageDeviceListFileSystemTypesToIgore','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAllowUsingAsIRS','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientGUI','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAllowRunningGuestsWithoutTools','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemoryBaseOnAvailableMemory','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemory','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemoryGeneralReserve','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemoryLog','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemoryMaxMemory','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemoryModulus','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemorySpicePerMonitorReserve','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoAdjustMemorySpicePerSessionReserve','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoMigrateFromPowerClientToVdsWhenConnectingFromRegularClient','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientAutoMigrateToPowerClientOnConnect','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientDedicatedVmLaunchOnVdsWhilePowerClientStarts','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientLogDetection','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientMaxNumberOfConcurrentVMs','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientRunVmShouldVerifyPendingVMsAsWell','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PowerClientSpiceDynamicCompressionManagement','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PredefinedVMProperties','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('PublicURLPort','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('RDPLoginWithFQN','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('RedirectServletReportsPageError','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('RenewGuestIpOnVdsSubnetChange','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('RenewGuestIpOnVdsSubnetChangeOnParseError','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('RpmsRepositoryUrl','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SignLockFile','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SignScriptName','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SQLServerI18NPrefix','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SQLServerLikeSyntax','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SQLServerPagingSyntax','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SQLServerPagingType','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SQLServerSearchTemplate','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ScriptsPath','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SearchesRefreshRateInSeconds','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SelectCommandTimeout','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrep3.0Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('TruststorePass','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('TruststoreUrl','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('UseENGINERepositoryRPMs','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('UseVdsBrokerInProc','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('UseSecureConnectionWithServers','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VM64BitMaxMemorySizeInMB','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VdcBootStrapUrl','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VdsErrorsFileName','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VM64BitMaxMemorySizeInMB','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LogVdsRegistration','general'); ************************** ********* QUERY ********** select fn_db_delete_config_for_version('2.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('IsNeedSupportForOldVgAPI', '2.2,3.0'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LimitNumberOfNetworkInterfaces', '2.2,3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LocalStorageEnabled','2.2,3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SupportCustomProperties','2.2,3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SupportGetDevicesVisibility','2.2,3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SupportStorageFormat','2.2,3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('UseRtl8139_pv','2.2,3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VdsFenceOptions','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VirtualMachineDomainName','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AuditLogAgingThreashold','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('ClientConsoleModeDefault','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LiveStorageMigrationEnabled','3.0'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LiveStorageMigrationEnabled','3.1'); ************************** ********* QUERY ********** select fn_db_delete_config_value('LiveStorageMigrationEnabled','3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('DiskConfigurationList','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('DefaultTimeZone','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('NumberOfVmsForTopSizeVms','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value_all_versions('EmulatedMachine'); ************************** ********* QUERY ********** select fn_db_delete_config_value_all_versions('ENGINEEARLib'); ************************** ********* QUERY ********** SELECT fn_db_delete_config_value_all_versions('AdminDomain'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AverageToPeakRatio','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('AverageToBurstRatio','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('DocsURL','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VirtIoScsiUnsupportedOsList','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('EnableMACAntiSpoofingFilterRules', '3.0'); ************************** ********* QUERY ********** select fn_db_delete_config_value('EnableMACAntiSpoofingFilterRules', '3.1'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SSHInactivityTimoutSeconds','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SSHInactivityHardTimoutSeconds','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('StorageDomainFalureTimeoutInMinutes','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VdsLoadBalancingeIntervalInMinutes','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('VdsRecoveryTimeoutInMintues','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('UknownTaskPrePollingLapse','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('GlusterAysncTasksSupport','3.0,3.1,3.2,3.3'); ************************** ********* QUERY ********** select fn_db_delete_config_value('NormalizedMgmgNetworkEnabled','3.0,3.1,3.2'); ************************** ********* QUERY ********** select fn_db_delete_config_value('HotPlugCpuEnabled','3.0,3.1,3.2,3.3,3.4,3.5'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrepXPPath','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrep2K3Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrep2K8Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrep2K8R2Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrep2K8x64Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrepWindows7Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrepWindows7x64Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrepWindows8Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrepWindows8x64Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('SysPrepWindows2012x64Path','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('UserRefreshRate','general'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061870'), 'upgrade/03_06_1870_delete_deprecated_config_values.sql', '9e3277a81d9fd262f300851acdb3bace', 'engine', cast(trim('2016-07-12 18:24:45.585403-04') as timestamp), cast(trim('2016-07-12 18:24:46.015176-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e6f5316685f6a3eb4e1c2b86a1a51e83' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_repo_file_meta_data_repo_domain_id ON repo_file_meta_data (repo_domain_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_large_icon_id ON vm_static (large_icon_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_spm_id_map_vds_id ON vds_spm_id_map (vds_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_host_pinning_map_vds_id ON vm_host_pinning_map (vds_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_georep_session_master_volume_id ON gluster_georep_session (master_volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_vm_map_vm_id ON tags_vm_map (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_event_subscriber_subscriber_id ON event_subscriber (subscriber_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_attachments_network_id ON network_attachments (network_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_interface_vmt_guid ON vm_interface (vmt_guid); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_async_tasks_entities_async_task_id ON async_tasks_entities (async_task_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_provider_id ON vm_static (provider_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_dynamic_migrating_to_vds ON vm_dynamic (migrating_to_vds); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_cpu_profiles_qos_id ON cpu_profiles (qos_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_host_device_vm_id ON host_device (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_groups_storage_pool_id ON vds_groups (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_snapshot_config_cluster_id ON gluster_volume_snapshot_config (cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_snapshot_config_volume_id ON gluster_volume_snapshot_config (volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_cluster_cluster_id ON network_cluster (cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_host_device_host_id_parent_device_name ON host_device (host_id, parent_device_name); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_event_notification_hist_audit_log_id ON event_notification_hist (audit_log_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_affinity_group_members_affinity_group_id ON affinity_group_members (affinity_group_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_georep_config_session_id ON gluster_georep_config (session_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_supported_cluster_features_cluster_id ON supported_cluster_features (cluster_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_vds_group_id ON vm_static (vds_group_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_icon_defaults_small_icon_id ON vm_icon_defaults (small_icon_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_storage_pool_iso_map_storage_pool_id ON storage_pool_iso_map (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_host_device_host_id ON host_device (host_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_quota_id ON vm_static (quota_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_iscsi_bonds_networks_map_iscsi_bond_id ON iscsi_bonds_networks_map (iscsi_bond_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_cluster_policy_units_policy_unit_id ON cluster_policy_units (policy_unit_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_services_service_type ON gluster_services (service_type); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_static_vds_group_id ON vds_static (vds_group_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_supported_host_features_host_id ON supported_host_features (host_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_interface_statistics_vm_id ON vm_interface_statistics (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_static_host_provider_id ON vds_static (host_provider_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_iscsi_bonds_storage_connections_map_iscsi_bond_id ON iscsi_bonds_storage_connections_map (iscsi_bond_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_vds_map_tag_id ON tags_vds_map (tag_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_job_subject_entity_job_id ON job_subject_entity (job_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_server_services_service_id ON gluster_server_services (service_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_interface_statistics_vds_id ON vds_interface_statistics (vds_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_lun_storage_server_connection_map_lun_id ON lun_storage_server_connection_map (lun_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_affinity_group_members_vm_id ON affinity_group_members (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_qos_id ON network (qos_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_storage_domains_ovf_info_storage_domain_id ON storage_domains_ovf_info (storage_domain_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_user_map_tag_id ON tags_user_map (tag_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_vds_map_vds_id ON tags_vds_map (vds_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_iscsi_bonds_storage_connections_map_connection_id ON iscsi_bonds_storage_connections_map (connection_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_vmt_guid ON vm_static (vmt_guid); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_roles_groups_role_id ON roles_groups (role_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_icon_defaults_large_icon_id ON vm_icon_defaults (large_icon_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_cluster_policy_units_cluster_policy_id ON cluster_policy_units (cluster_policy_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_disk_lun_map_lun_id ON disk_lun_map (lun_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_iscsi_bonds_storage_pool_id ON iscsi_bonds (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_pool_map_vm_pool_id ON vm_pool_map (vm_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_command_assoc_entities_command_id ON command_assoc_entities (command_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_cluster_services_service_type ON gluster_cluster_services (service_type); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_user_map_user_id ON tags_user_map (user_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_vm_pool_map_tag_id ON tags_vm_pool_map (tag_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_server_hooks_hook_id ON gluster_server_hooks (hook_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_iscsi_bonds_networks_map_network_id ON iscsi_bonds_networks_map (network_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_disk_profiles_qos_id ON disk_profiles (qos_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_provider_network_provider_id ON network (provider_network_provider_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_georep_session_details_master_brick_id ON gluster_georep_session_details (master_brick_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_vm_pool_map_vm_pool_id ON tags_vm_pool_map (vm_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_mac_pool_ranges_mac_pool_id ON mac_pool_ranges (mac_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_image_storage_domain_map_quota_id ON image_storage_domain_map (quota_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vfs_config_networks_network_id ON vfs_config_networks (network_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_disk_lun_map_disk_id ON disk_lun_map (disk_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_host_pinning_map_vm_id ON vm_host_pinning_map (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_georep_session_details_session_id ON gluster_georep_session_details (session_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_bricks_server_id ON gluster_volume_bricks (server_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_host_device_host_id_physfn ON host_device (host_id, physfn); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_user_group_map_tag_id ON tags_user_group_map (tag_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_snapshots_vm_id ON snapshots (vm_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_network_cluster_network_id ON network_cluster (network_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_groups_cluster_policy_id ON vds_groups (cluster_policy_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vds_spm_id_map_storage_pool_id ON vds_spm_id_map (storage_pool_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_snapshots_volume_id ON gluster_volume_snapshots (volume_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_image_storage_domain_map_storage_domain_id ON image_storage_domain_map (storage_domain_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_device_snapshot_id ON vm_device (snapshot_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_vm_map_tag_id ON tags_vm_map (tag_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_tags_user_group_map_group_id ON tags_user_group_map (group_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_server_hooks_server_id ON gluster_server_hooks (server_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_pools_vds_group_id ON vm_pools (vds_group_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_storage_pool_iso_map_storage_id ON storage_pool_iso_map (storage_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_gluster_volume_bricks_network_id ON gluster_volume_bricks (network_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_interface_vm_guid ON vm_interface (vm_guid); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_lun_storage_server_connection_map_storage_server_connection ON lun_storage_server_connection_map (storage_server_connection); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_vm_static_small_icon_id ON vm_static (small_icon_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_supported_cluster_features_feature_id ON supported_cluster_features (feature_id); ************************** CREATE INDEX ********* QUERY ********** CREATE INDEX idx_storage_pool_mac_pool_id ON storage_pool (mac_pool_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061880'), 'upgrade/03_06_1880_add_index_to_fk_columns.sql', 'e6f5316685f6a3eb4e1c2b86a1a51e83', 'engine', cast(trim('2016-07-12 18:24:46.060137-04') as timestamp), cast(trim('2016-07-12 18:24:57.442959-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'efc4eab1b188ec9a873252f07e614bdd' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vds_groups SET emulated_machine = 'pc-i440fx-rhel7.2.0' WHERE emulated_machine = 'pc-i440fx-rhel7.1.0'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061890'), 'upgrade/03_06_1890_bump_cluster_machine_type_to_72.sql', 'efc4eab1b188ec9a873252f07e614bdd', 'engine', cast(trim('2016-07-12 18:24:57.484241-04') as timestamp), cast(trim('2016-07-12 18:24:57.511525-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd4e3c667424e33f494aacaf0cf2302fe' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_action_group_to_role('00000000-0000-0000-0000-000000000001', 1664); ************************** ********* QUERY ********** select fn_db_add_action_group_to_role('DEF00006-0000-0000-0000-DEF000000006', 1664); ************************** ********* QUERY ********** select fn_db_add_action_group_to_role('DEF00012-0000-0000-0000-DEF000000012', 1664); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061900'), 'upgrade/03_06_1900_add_connect_to_serial_console_action_group.sql', 'd4e3c667424e33f494aacaf0cf2302fe', 'engine', cast(trim('2016-07-12 18:24:57.550761-04') as timestamp), cast(trim('2016-07-12 18:24:57.667432-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0ab93d98ce23cfcf8717fb8651e87cbb' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_delete_config_value('AllowDuplicateMacAddresses','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('MacPoolRanges','general'); ************************** ********* QUERY ********** select fn_db_delete_config_value('MaxMacsCountInPool','general'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061910'), 'upgrade/03_06_1910_remove_deprecated_config_value.sql', '0ab93d98ce23cfcf8717fb8651e87cbb', 'engine', cast(trim('2016-07-12 18:24:57.709143-04') as timestamp), cast(trim('2016-07-12 18:24:57.801794-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '0769c9bf42087c902d173467d3f9b812' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE network_cluster nc1 SET management = TRUE WHERE network_id IN (SELECT id FROM network WHERE name = (SELECT COALESCE((SELECT option_value FROM vdc_options WHERE option_name = 'DefaultManagementNetwork' AND version = 'general'), 'ovirtmgmt'))) AND NOT exists(SELECT 1 FROM network_cluster nc2 WHERE nc1.cluster_id = nc2.cluster_id AND nc2.management = TRUE); ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061920'), 'upgrade/03_06_1920_set_mgmt_network_in_network_cluster.sql', '0769c9bf42087c902d173467d3f9b812', 'engine', cast(trim('2016-07-12 18:24:57.842398-04') as timestamp), cast(trim('2016-07-12 18:24:57.870753-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5f53e0ca5a9912596dca7881aecbe994' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vds_groups SET cpu_name='IBM POWER8' WHERE cpu_name='IBM POWER 8'; ************************** UPDATE 0 ********* QUERY ********** UPDATE vds_groups SET cpu_name='IBM POWER8 v1.0' WHERE cpu_name='IBM POWER 8 v1.0'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061930'), 'upgrade/03_06_1930_change_cpu_name_ibm_power_8.sql', '5f53e0ca5a9912596dca7881aecbe994', 'engine', cast(trim('2016-07-12 18:24:57.908922-04') as timestamp), cast(trim('2016-07-12 18:24:57.936053-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8fdc9f8dd82fce90bacd745953d41a68' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_base_disks_disk_alias ON base_disks (disk_alias); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061940'), 'upgrade/03_06_1940_index_base_disks.sql', '8fdc9f8dd82fce90bacd745953d41a68', 'engine', cast(trim('2016-07-12 18:24:57.983955-04') as timestamp), cast(trim('2016-07-12 18:24:58.125595-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'df6639fc66d1fe6a198f1ea5d2c9eca0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_add_balloon_to_blank_if_not_present () RETURNS void AS $FUNCTION$ BEGIN IF NOT EXISTS ( SELECT 1 FROM vm_device WHERE vm_id = '00000000-0000-0000-0000-000000000000' AND type = 'balloon' AND device = 'memballoon' LIMIT 1 ) THEN INSERT INTO vm_device ( device_id, vm_id, type, device, address, boot_order, spec_params, is_managed, is_plugged, is_readonly, _create_date, _update_date, alias ) SELECT uuid_generate_v1(), '00000000-0000-0000-0000-000000000000', 'balloon', 'memballoon', '', 0, '{"model" : "virtio"}', true, true, true, 'now', NULL, NULL; END IF; END;$FUNCTION$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_add_balloon_to_blank_if_not_present(); ************************** ********* QUERY ********** DROP FUNCTION __temp_add_balloon_to_blank_if_not_present(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061950'), 'upgrade/03_06_1950_enable_ballon_for_blank_template.sql', 'df6639fc66d1fe6a198f1ea5d2c9eca0', 'engine', cast(trim('2016-07-12 18:24:58.167087-04') as timestamp), cast(trim('2016-07-12 18:24:58.284508-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5a0627f22599415ad6960c5fe43d39f3' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('vm_static', 'threads_per_cpu', 'integer NOT NULL DEFAULT 1'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061960'), 'upgrade/03_06_1960_add_vm_static_threads_per_cpu.sql', '5a0627f22599415ad6960c5fe43d39f3', 'engine', cast(trim('2016-07-12 18:24:58.32556-04') as timestamp), cast(trim('2016-07-12 18:24:59.302678-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'bbc809c76056598a4d1aee940473f709' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** select fn_db_add_column('command_entities', 'parent_command_id', 'UUID DEFAULT NULL'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061970'), 'upgrade/03_06_1970_add_cmd_entity_parent_command_id.sql', 'bbc809c76056598a4d1aee940473f709', 'engine', cast(trim('2016-07-12 18:24:59.342182-04') as timestamp), cast(trim('2016-07-12 18:24:59.40887-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '24012afa69881c84fea4428b004d94ad' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE mac_pool_ranges SET from_mac = ( SELECT substr( regexp_replace( lpad(replace(from_mac, ':', ''), 12, '0'), '(..)', E'\\1:', 'g'), 1, 17) ), to_mac = (SELECT substr( regexp_replace( lpad(replace(to_mac, ':', ''), 12, '0'), '(..)', E'\\1:', 'g'), 1, 17) ) ; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061980'), 'upgrade/03_06_1980_fix_invalid_macs.sql', '24012afa69881c84fea4428b004d94ad', 'engine', cast(trim('2016-07-12 18:24:59.450574-04') as timestamp), cast(trim('2016-07-12 18:24:59.508708-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c58813bfb78a355002c2dd0689788fa9' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vm_static SET min_allocated_mem = mem_size_mb WHERE vm_guid = '00000000-0000-0000-0000-000000000000' AND min_allocated_mem = 0; ************************** UPDATE 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03061990'), 'upgrade/03_06_1990_chance_min_allocated_mem_of_blank.sql', 'c58813bfb78a355002c2dd0689788fa9', 'engine', cast(trim('2016-07-12 18:24:59.550551-04') as timestamp), cast(trim('2016-07-12 18:24:59.60879-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '8a3c3f427e78a16c092d3599a1d4341d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** DELETE FROM vdc_options WHERE option_name = 'MigrateDowntime'; ************************** DELETE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062000'), 'upgrade/03_06_2000_fix_migratedowntime_option.sql', '8a3c3f427e78a16c092d3599a1d4341d', 'engine', cast(trim('2016-07-12 18:24:59.65039-04') as timestamp), cast(trim('2016-07-12 18:24:59.677517-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '319f59d2501d7d7fb0059471fb0fcbd5' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_action_group_to_role(r.role_id, 1563) FROM roles_groups r WHERE action_group_id=8; ************************** ********* QUERY ********** SELECT fn_db_add_action_group_to_role(r.role_id, 1668) FROM roles_groups r WHERE action_group_id=8; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062010'), 'upgrade/03_06_2010_add_profile_perms_to_import_export.sql', '319f59d2501d7d7fb0059471fb0fcbd5', 'engine', cast(trim('2016-07-12 18:24:59.717059-04') as timestamp), cast(trim('2016-07-12 18:24:59.808724-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '30f19cc51f8e1c7829b241b8800f7d4d' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, type, enabled, description) VALUES ('e659c871-0bf1-4ccc-b748-f28fab08ddda', 'CpuPinning', true, NULL, 0, true, 'Filter out hosts which do not satisfy the cpu pinning definition'); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 'e659c871-0bf1-4ccc-b748-f28fab08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 'e659c871-0bf1-4ccc-b748-f28fab08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 'e659c871-0bf1-4ccc-b748-f28fab08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', 'e659c871-0bf1-4ccc-b748-f28fab08ddda', 0, 0); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062020'), 'upgrade/03_06_2020_add_cpu_pinning_filter.sql', '30f19cc51f8e1c7829b241b8800f7d4d', 'engine', cast(trim('2016-07-12 18:24:59.850156-04') as timestamp), cast(trim('2016-07-12 18:25:00.033601-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '1d69fbf00edcda198054e5ca547e967c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_vm_static_origin ON vm_static (origin); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062030'), 'upgrade/03_06_2030-add-index-on-origin-in-vm-static.sql', '1d69fbf00edcda198054e5ca547e967c', 'engine', cast(trim('2016-07-12 18:25:00.075194-04') as timestamp), cast(trim('2016-07-12 18:25:00.233562-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'e392640d8bf2ce4908ba8155bbee1c97' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_set_cpu_profiles_permissions () RETURNS VOID AS $PROCEDURE$ DECLARE -- role ids declarations v_CPU_PROFILE_CREATOR_ID UUID; v_CPU_PROFILE_OPERATOR_ID UUID; v_SUPER_USER_ROLE_ID UUID; v_POWER_USER_ROLE_ID UUID; v_CLUSTER_ADMIN_ROLE_ID UUID; v_DATA_CENTER_ADMIN_ROLE_ID UUID; v_USER_VM_MANAGER_ROLE_ID UUID; v_VM_POOL_ADMIN_ROLE_ID UUID; v_VM_CREATOR_ROLE_ID UUID; v_USER_TEMPLATE_BASED_VM_ROLE_ID UUID; v_USER_VM_RUNTIME_MANAGER_ROLE_ID UUID; v_EVERYONE_ROLE_ID UUID; -- action groups declarations v_delete_cpu_profile_action_group INT; v_update_cpu_profile_action_group INT; v_create_cpu_profile_action_group INT; v_assign_cpu_profile_action_group INT; BEGIN -- role ids v_CPU_PROFILE_CREATOR_ID := 'DEF00016-0000-0000-0000-DEF000000016'; v_CPU_PROFILE_OPERATOR_ID := 'DEF00017-0000-0000-0000-DEF000000017'; v_SUPER_USER_ROLE_ID := '00000000-0000-0000-0000-000000000001'; v_POWER_USER_ROLE_ID := '00000000-0000-0000-0001-000000000002'; v_CLUSTER_ADMIN_ROLE_ID := 'DEF00001-0000-0000-0000-DEF000000001'; v_DATA_CENTER_ADMIN_ROLE_ID := 'DEF00002-0000-0000-0000-DEF000000002'; v_USER_VM_MANAGER_ROLE_ID := 'DEF00006-0000-0000-0000-DEF000000006'; v_VM_POOL_ADMIN_ROLE_ID := 'DEF00007-0000-0000-0000-DEF000000007'; v_VM_CREATOR_ROLE_ID := 'DEF0000A-0000-0000-0000-DEF00000000D'; v_USER_TEMPLATE_BASED_VM_ROLE_ID := 'DEF00009-0000-0000-0000-DEF000000009'; v_USER_VM_RUNTIME_MANAGER_ROLE_ID := 'DEF00006-0000-0000-0000-DEF000000011'; v_EVERYONE_ROLE_ID := 'EEE00000-0000-0000-0000-123456789EEE'; -- action groups declarations v_delete_cpu_profile_action_group := 1665; v_update_cpu_profile_action_group := 1666; v_create_cpu_profile_action_group := 1667; v_assign_cpu_profile_action_group := 1668; -- Add cpu_profile_creator role INSERT INTO roles ( id, name, description, is_readonly, role_type, app_mode ) VALUES ( v_CPU_PROFILE_CREATOR_ID, 'CpuProfileCreator', 'Cpu Profile Creation/Deletion/Updating and Operation', true, 1, 1); -- Add cpu_profile_operator role INSERT INTO roles ( id, name, description, is_readonly, role_type, app_mode ) VALUES ( v_CPU_PROFILE_OPERATOR_ID, 'CpuProfileOperator', 'Cpu Profile Operation', true, 2, 1); -- Adding Create/Update/Delete permissions to roles: PERFORM fn_db_add_action_group_to_role(v_CPU_PROFILE_CREATOR_ID, v_update_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CPU_PROFILE_CREATOR_ID, v_delete_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CPU_PROFILE_CREATOR_ID, v_create_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ROLE_ID, v_update_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ROLE_ID , v_delete_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ROLE_ID , v_create_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_POWER_USER_ROLE_ID, v_update_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_POWER_USER_ROLE_ID, v_delete_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_POWER_USER_ROLE_ID, v_create_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CLUSTER_ADMIN_ROLE_ID, v_delete_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CLUSTER_ADMIN_ROLE_ID, v_update_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CLUSTER_ADMIN_ROLE_ID, v_create_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ROLE_ID, v_delete_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ROLE_ID, v_update_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ROLE_ID, v_create_cpu_profile_action_group); -- Adding use permissions to roles: PERFORM fn_db_add_action_group_to_role(v_CPU_PROFILE_OPERATOR_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CPU_PROFILE_CREATOR_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_SUPER_USER_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_POWER_USER_ROLE_ID , v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_CLUSTER_ADMIN_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_DATA_CENTER_ADMIN_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_USER_VM_MANAGER_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_VM_POOL_ADMIN_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_VM_CREATOR_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_USER_TEMPLATE_BASED_VM_ROLE_ID, v_assign_cpu_profile_action_group); PERFORM fn_db_add_action_group_to_role(v_USER_VM_RUNTIME_MANAGER_ROLE_ID, v_assign_cpu_profile_action_group); -- Add role CpuProfileOperator to Everyone on all the cpu profiles that exist -- in the system at start(That means that everyone can use the default cpu -- profiles in the system). INSERT INTO permissions ( id, role_id, ad_element_id, object_id, object_type_id ) SELECT uuid_generate_v1(), v_CPU_PROFILE_OPERATOR_ID, v_EVERYONE_ROLE_ID, -- Everyone cpu_profiles.id, 30 -- cpu profile object id FROM cpu_profiles order by _create_date LIMIT 1; END; $PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT __temp_set_cpu_profiles_permissions(); ************************** ********* QUERY ********** DROP FUNCTION __temp_set_cpu_profiles_permissions(); ************************** DROP FUNCTION ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062040'), 'upgrade/03_06_2040_attach_cpu_profile_permissions.sql', 'e392640d8bf2ce4908ba8155bbee1c97', 'engine', cast(trim('2016-07-12 18:25:00.275241-04') as timestamp), cast(trim('2016-07-12 18:25:00.400365-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '6459a5f748d02bd1a2b41519f5e9f128' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_cpu_profiles_create_date ON cpu_profiles (_create_date); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062050'), 'upgrade/03_06_2050_create_index_cpu_profiles.sql', '6459a5f748d02bd1a2b41519f5e9f128', 'engine', cast(trim('2016-07-12 18:25:00.441751-04') as timestamp), cast(trim('2016-07-12 18:25:00.600117-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '5dc1c3e9cfb2d83c2b4b1f7c09e4b66f' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** UPDATE vm_static SET priority = 1 WHERE priority < 1 AND origin = 6; ************************** UPDATE 0 ********* QUERY ********** UPDATE vm_static SET time_zone = 'Etc/GMT' WHERE time_zone is null AND origin = 6; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062060'), 'upgrade/03_06_2060_set_timezone_priority_for_he.sql', '5dc1c3e9cfb2d83c2b4b1f7c09e4b66f', 'engine', cast(trim('2016-07-12 18:25:00.641725-04') as timestamp), cast(trim('2016-07-12 18:25:00.669079-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'c3e1ec2f58809ae7ea7364e8986161c0' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO policy_units ( id, name, is_internal, custom_properties_regex, type, enabled, description ) VALUES ( '84e6ddee-ab0d-42dd-82f0-c298889db567', 'InClusterUpgrade', TRUE, NULL, 0, true, 'Filter out all hosts which run an older OS version than the vm is currently running on.' ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO policy_units ( id, name, is_internal, custom_properties_regex, type, enabled, description ) VALUES ( '84e6ddee-ab0d-42dd-82f0-c298889db568', 'InClusterUpgrade', TRUE, NULL, 1, true, 'Penalize hosts with older OS version more than hosts with the sam OS version where a vm is currently running on. Newer OS versions are not penalized' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062070'), 'upgrade/03_06_2070_add_in_cluster_upgrade_policy_units.sql', 'c3e1ec2f58809ae7ea7364e8986161c0', 'engine', cast(trim('2016-07-12 18:25:00.708522-04') as timestamp), cast(trim('2016-07-12 18:25:00.799993-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '637ca6009d68e658d38a6c1324830ea8' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO cluster_policies ( id, name, description, is_locked, is_default ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', 'InClusterUpgrade', 'Allow upgrade hosts to newer major OS versions', true, false ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', '84e6ddee-ab0d-42dd-82f0-c298889db568', 0, 1 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', '84e6ddee-ab0d-42dd-82f0-c298889db567', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', ( SELECT id FROM policy_units WHERE name = 'Emulated-Machine' limit 1 ), 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', '72163d1c-9468-4480-99d9-0888664eb143', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', 'e659c871-0bf1-4ccc-b748-f28f5d08ddda', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', 'c9ddbb34-0e1d-4061-a8d7-b0893fa80932', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', '6d636bf6-a35c-4f9d-b68d-0731f720cddc', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', '438b052c-90ab-40e8-9be0-a22560202ea6', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** INSERT INTO cluster_policy_units ( cluster_policy_id, policy_unit_id, filter_sequence, factor ) VALUES ( '8d5d7bec-68de-4a67-b53e-0ac54686d586', '38440000-8cf0-14bd-c43e-10b96e4ef00a', 0, 0 ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062080'), 'upgrade/03_06_2080_add_in_cluster_upgrade_policy.sql', '637ca6009d68e658d38a6c1324830ea8', 'engine', cast(trim('2016-07-12 18:25:00.841813-04') as timestamp), cast(trim('2016-07-12 18:25:01.17514-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'bd7a44c62259b8299952461272a7d5f1' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** INSERT INTO roles_groups VALUES('00000000-0000-0000-0001-000000000002', 1563); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062090'), 'upgrade/03_06_2090_add_attach_disk_profile_permissions_to_power_user_role.sql', 'bd7a44c62259b8299952461272a7d5f1', 'engine', cast(trim('2016-07-12 18:25:01.216645-04') as timestamp), cast(trim('2016-07-12 18:25:01.274928-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = '347a32967e2b2547e9a1d7283ef4af23' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE INDEX idx_event_notification_hist ON event_notification_hist(audit_log_id); ************************** CREATE INDEX ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062100'), 'upgrade/03_06_2100_add_index_event_notification_hist.sql', '347a32967e2b2547e9a1d7283ef4af23', 'engine', cast(trim('2016-07-12 18:25:01.316755-04') as timestamp), cast(trim('2016-07-12 18:25:01.466788-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from schema_version where checksum = 'd736785fe6d3fe31c1d2c4d6d30def67' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SELECT fn_db_add_column('host_device', 'is_assignable', 'BOOLEAN NOT NULL DEFAULT TRUE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('03062110'), 'upgrade/03_06_2110_add_host_device_is_assignable.sql', 'd736785fe6d3fe31c1d2c4d6d30def67', 'engine', cast(trim('2016-07-12 18:25:01.508393-04') as timestamp), cast(trim('2016-07-12 18:25:02.109818-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy ( select max(id) from schema_version where state in ('INSTALLED','SKIPPED') ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update schema_version set current=(id=351); ************************** UPDATE 351 ********* QUERY ********** CREATE OR REPLACE VIEW domains_with_unregistered_entities_view AS SELECT DISTINCT storage_domain_id FROM unregistered_ovf_of_entities; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vms_for_disk_view AS SELECT array_agg ( vm_name ) AS array_vm_names, device_id, entity_type FROM vm_static JOIN vm_device ON vm_static.vm_guid = vm_device.vm_id WHERE device = 'disk' GROUP BY device_id, entity_type; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW images_storage_domain_view AS SELECT images.image_guid AS image_guid, storage_domain_static.storage_name AS storage_name, storage_domain_static.storage AS storage_path, storage_pool_iso_map.storage_pool_id AS storage_pool_id, storage_domain_static.storage_type AS storage_type, images.creation_date AS creation_date, images.size AS SIZE, images.it_guid AS it_guid, snapshots.description AS description, images.ParentId AS ParentId, images.lastModified AS lastModified, snapshots.app_list AS app_list, image_storage_domain_map.storage_domain_id AS storage_id, images.vm_snapshot_id AS vm_snapshot_id, images.volume_type AS volume_type, images.volume_format AS volume_format, images.imageStatus AS imageStatus, images.image_group_id AS image_group_id, images.active, images.volume_classification, vms_for_disk_view.entity_type AS entity_type, array_to_string ( vms_for_disk_view.array_vm_names, ',' ) AS vm_names, COALESCE ( array_upper ( vms_for_disk_view.array_vm_names, 1 ) , 0 ) AS number_of_vms, base_disks.disk_id, base_disks.disk_alias AS disk_alias, base_disks.disk_description AS disk_description, base_disks.shareable AS shareable, base_disks.disk_interface, base_disks.wipe_after_delete AS wipe_after_delete, base_disks.propagate_errors, base_disks.boot AS boot, base_disks.sgio AS sgio, image_storage_domain_map.quota_id AS quota_id, quota.quota_name AS quota_name, storage_pool.quota_enforcement_type, image_storage_domain_map.disk_profile_id AS disk_profile_id, disk_profiles.name AS disk_profile_name, disk_image_dynamic.actual_size AS actual_size, disk_image_dynamic.read_rate AS read_rate, disk_image_dynamic.write_rate AS write_rate, disk_image_dynamic.read_latency_seconds AS read_latency_seconds, disk_image_dynamic.write_latency_seconds AS write_latency_seconds, disk_image_dynamic.flush_latency_seconds AS flush_latency_seconds, base_disks.alignment AS alignment, base_disks.disk_storage_type as disk_storage_type, base_disks.cinder_volume_type as cinder_volume_type, base_disks.last_alignment_scan AS last_alignment_scan, EXISTS ( SELECT 1 FROM storage_domains_ovf_info WHERE images.image_group_id = storage_domains_ovf_info.ovf_disk_id ) AS ovf_store FROM images LEFT OUTER JOIN disk_image_dynamic ON images.image_guid = disk_image_dynamic.image_id LEFT OUTER JOIN base_disks ON images.image_group_id = base_disks.disk_id LEFT OUTER JOIN vms_for_disk_view ON vms_for_disk_view.device_id = images.image_group_id LEFT JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid LEFT OUTER JOIN storage_domain_static ON image_storage_domain_map.storage_domain_id = storage_domain_static.id LEFT OUTER JOIN snapshots ON images.vm_snapshot_id = snapshots.snapshot_id LEFT OUTER JOIN quota ON image_storage_domain_map.quota_id = quota.id LEFT OUTER JOIN disk_profiles ON image_storage_domain_map.disk_profile_id = disk_profiles.id LEFT OUTER JOIN storage_pool_iso_map ON storage_pool_iso_map.storage_id = storage_domain_static.id LEFT OUTER JOIN storage_pool ON storage_pool.id = storage_pool_iso_map.storage_pool_id WHERE images.image_guid != '00000000-0000-0000-0000-000000000000'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_domain_file_repos AS SELECT storage_domain_static.id AS storage_domain_id, storage_domain_static.storage_domain_type AS storage_domain_type, storage_pool_iso_map.storage_pool_id AS storage_pool_id, storage_pool_iso_map.status AS storage_domain_status, repo_file_meta_data.repo_image_id AS repo_image_id, repo_file_meta_data.size AS SIZE, repo_file_meta_data.date_created AS date_created, repo_file_meta_data.last_refreshed AS last_refreshed, repo_file_meta_data.file_type AS file_type, vds_dynamic.status AS vds_status, storage_pool.status AS storage_pool_status FROM storage_domain_static INNER JOIN storage_pool_iso_map ON storage_domain_static.id = storage_pool_iso_map.storage_id INNER JOIN storage_pool ON storage_pool.id = storage_pool_iso_map.storage_pool_id INNER JOIN vds_dynamic ON vds_dynamic.vds_id = storage_pool.spm_vds_id LEFT OUTER JOIN repo_file_meta_data ON storage_pool_iso_map.storage_id = repo_file_meta_data.repo_domain_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_for_image_view AS SELECT images.image_guid AS image_id, array_to_string ( array_agg ( storage_domain_static.storage ) , ',' ) AS storage_path, array_to_string ( array_agg ( storage_domain_static.id ) , ',' ) storage_id, array_to_string ( array_agg ( storage_domain_static.storage_type ) , ',' ) storage_type, array_to_string ( array_agg ( storage_domain_static.storage_name ) , ',' ) AS storage_name, array_to_string ( array_agg ( COALESCE ( CAST ( quota.id AS VARCHAR ) , '' ) ) , ',' ) AS quota_id, array_to_string ( array_agg ( COALESCE ( quota.quota_name, '' ) ) , ',' ) AS quota_name, array_to_string ( array_agg ( COALESCE ( CAST ( disk_profiles.id AS VARCHAR ) , '' ) ) , ',' ) AS disk_profile_id, array_to_string ( array_agg ( COALESCE ( disk_profiles.name, '' ) ) , ',' ) AS disk_profile_name FROM images LEFT JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid LEFT OUTER JOIN storage_domain_static ON image_storage_domain_map.storage_domain_id = storage_domain_static.id LEFT OUTER JOIN quota ON image_storage_domain_map.quota_id = quota.id LEFT OUTER JOIN disk_profiles ON image_storage_domain_map.disk_profile_id = disk_profiles.id GROUP BY images.image_guid; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_images_view AS SELECT storage_for_image_view.storage_id AS storage_id, storage_for_image_view.storage_path AS storage_path, storage_for_image_view.storage_name AS storage_name, storage_for_image_view.storage_type, images_storage_domain_view.storage_pool_id AS storage_pool_id, images_storage_domain_view.image_guid AS image_guid, images_storage_domain_view.creation_date AS creation_date, disk_image_dynamic.actual_size AS actual_size, disk_image_dynamic.read_rate AS read_rate, disk_image_dynamic.read_latency_seconds AS read_latency_seconds, disk_image_dynamic.write_latency_seconds AS write_latency_seconds, disk_image_dynamic.flush_latency_seconds AS flush_latency_seconds, disk_image_dynamic.write_rate AS write_rate, images_storage_domain_view.size AS SIZE, images_storage_domain_view.it_guid AS it_guid, images_storage_domain_view.description AS description, images_storage_domain_view.ParentId AS ParentId, images_storage_domain_view.imageStatus AS imageStatus, images_storage_domain_view.lastModified AS lastModified, images_storage_domain_view.app_list AS app_list, images_storage_domain_view.vm_snapshot_id AS vm_snapshot_id, images_storage_domain_view.volume_type AS volume_type, images_storage_domain_view.image_group_id AS image_group_id, images_storage_domain_view.active AS active, images_storage_domain_view.volume_classification AS volume_classification, images_storage_domain_view.volume_format AS volume_format, images_storage_domain_view.disk_interface AS disk_interface, images_storage_domain_view.boot AS boot, images_storage_domain_view.wipe_after_delete AS wipe_after_delete, images_storage_domain_view.propagate_errors AS propagate_errors, images_storage_domain_view.sgio AS sgio, images_storage_domain_view.entity_type AS entity_type, images_storage_domain_view.number_of_vms AS number_of_vms, images_storage_domain_view.vm_names AS vm_names, storage_for_image_view.quota_id AS quota_id, storage_for_image_view.quota_name AS quota_name, images_storage_domain_view.quota_enforcement_type, storage_for_image_view.disk_profile_id AS disk_profile_id, storage_for_image_view.disk_profile_name AS disk_profile_name, images_storage_domain_view.disk_id, images_storage_domain_view.disk_alias AS disk_alias, images_storage_domain_view.disk_description AS disk_description, images_storage_domain_view.shareable AS shareable, images_storage_domain_view.alignment AS alignment, images_storage_domain_view.last_alignment_scan AS last_alignment_scan, images_storage_domain_view.ovf_store AS ovf_store, images_storage_domain_view.disk_storage_type as disk_storage_type, images_storage_domain_view.cinder_volume_type as cinder_volume_type FROM images_storage_domain_view INNER JOIN disk_image_dynamic ON images_storage_domain_view.image_guid = disk_image_dynamic.image_id INNER JOIN storage_for_image_view ON images_storage_domain_view.image_guid = storage_for_image_view.image_id WHERE images_storage_domain_view.active = TRUE; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW all_disks_including_snapshots AS SELECT storage_impl.*, bd.disk_id, bd.disk_interface, bd.wipe_after_delete, bd.propagate_errors, bd.disk_alias, bd.disk_description, bd.shareable, bd.boot, bd.sgio, bd.alignment, bd.last_alignment_scan, bd.disk_storage_type, bd.cinder_volume_type FROM ( SELECT storage_for_image_view.storage_id AS storage_id, storage_for_image_view.storage_path AS storage_path, storage_for_image_view.storage_name AS storage_name, storage_for_image_view.storage_type AS storage_type, storage_pool_id, image_guid, creation_date, actual_size, read_rate, write_rate, read_latency_seconds, write_latency_seconds, flush_latency_seconds, SIZE, it_guid, imageStatus, lastModified, volume_type, volume_format, image_group_id, description, ParentId, app_list, vm_snapshot_id, active, volume_classification, entity_type, number_of_vms, vm_names, storage_for_image_view.quota_id AS quota_id, storage_for_image_view.quota_name AS quota_name, quota_enforcement_type, ovf_store, storage_for_image_view.disk_profile_id AS disk_profile_id, storage_for_image_view.disk_profile_name AS disk_profile_name, NULL AS lun_id, NULL AS physical_volume_id, NULL AS volume_group_id, NULL AS serial, NULL AS lun_mapping, NULL AS vendor_id, NULL AS product_id, NULL AS device_size FROM images_storage_domain_view INNER JOIN storage_for_image_view ON images_storage_domain_view.image_guid = storage_for_image_view.image_id GROUP BY storage_for_image_view.storage_id, storage_for_image_view.storage_path, storage_for_image_view.storage_name, storage_for_image_view.storage_type, storage_pool_id, image_guid, creation_date, actual_size, read_rate, write_rate, read_latency_seconds, write_latency_seconds, flush_latency_seconds, SIZE, it_guid, imageStatus, lastModified, volume_type, volume_format, image_group_id, description, ParentId, app_list, vm_snapshot_id, active, volume_classification, entity_type, number_of_vms, vm_names, storage_for_image_view.quota_id, storage_for_image_view.quota_name, quota_enforcement_type, ovf_store, storage_for_image_view.disk_profile_id, storage_for_image_view.disk_profile_name UNION ALL SELECT NULL AS storage_id, NULL AS storage_path, NULL AS storage_name, NULL AS storage_type, NULL AS storage_pool_id, NULL AS image_guid, NULL AS creation_date, NULL AS actual_size, NULL AS read_rate, NULL AS write_rate, NULL AS read_latency_seconds, NULL AS write_latency_seconds, NULL AS flush_latency_seconds, NULL AS SIZE, NULL AS it_guid, NULL AS imageStatus, NULL AS lastModified, NULL AS volume_type, NULL AS volume_format, dlm.disk_id AS image_group_id, NULL AS description, NULL AS ParentId, NULL AS app_list, NULL AS vm_snapshot_id, NULL AS active, NULL AS volume_classification, vms_for_disk_view.entity_type, COALESCE ( array_upper ( vms_for_disk_view.array_vm_names, 1 ) , 0 ) AS number_of_vms, array_to_string ( vms_for_disk_view.array_vm_names, ',' ) AS vm_names, NULL AS quota_id, NULL AS quota_name, NULL AS quota_enforcement_type, FALSE AS ovf_store, NULL AS disk_profile_id, NULL AS disk_profile_name, l.lun_id, l.physical_volume_id, l.volume_group_id, l.serial, l.lun_mapping, l.vendor_id, l.product_id, l.device_size FROM disk_lun_map dlm JOIN luns l ON l.lun_id = dlm.lun_id LEFT JOIN vms_for_disk_view ON vms_for_disk_view.device_id = dlm.disk_id ) AS storage_impl JOIN base_disks bd ON bd.disk_id = storage_impl.image_group_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW all_disks AS SELECT * FROM all_disks_including_snapshots WHERE active IS NULL OR active = TRUE; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW all_disks_for_vms AS SELECT all_disks_including_snapshots.*, vm_device.is_plugged, vm_device.is_readonly, vm_device.logical_name, vm_device.vm_id, vm_device.is_using_scsi_reservation FROM all_disks_including_snapshots JOIN vm_device ON vm_device.device_id = all_disks_including_snapshots.image_group_id WHERE ( ( vm_device.snapshot_id IS NULL AND all_disks_including_snapshots.active IS NOT FALSE ) OR vm_device.snapshot_id = all_disks_including_snapshots.vm_snapshot_id ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_domains AS SELECT storage_domain_static.id AS id, storage_domain_static.storage AS storage, storage_domain_static.storage_name AS storage_name, storage_domain_static.storage_description AS storage_description, storage_domain_static.storage_comment AS storage_comment, storage_pool_iso_map.storage_pool_id AS storage_pool_id, storage_domain_dynamic.available_disk_size AS available_disk_size, storage_domain_dynamic.used_disk_size AS used_disk_size, fn_get_disk_commited_value_by_storage ( storage_domain_static.id ) AS commited_disk_size, fn_get_actual_images_size_by_storage ( storage_domain_static.id ) AS actual_images_size, storage_pool_iso_map.status AS status, storage_pool.name AS storage_pool_name, storage_domain_static.storage_type AS storage_type, storage_domain_static.storage_domain_type AS storage_domain_type, storage_domain_static.storage_domain_format_type AS storage_domain_format_type, storage_domain_static.last_time_used_as_master AS last_time_used_as_master, storage_domain_static.wipe_after_delete AS wipe_after_delete, fn_get_storage_domain_shared_status_by_domain_id ( storage_domain_static.id, storage_pool_iso_map.status, storage_domain_static.storage_domain_type ) AS storage_domain_shared_status, storage_domain_static.recoverable AS recoverable, domains_with_unregistered_entities_view.storage_domain_id IS NOT NULL AS contains_unregistered_entities, storage_domain_static.warning_low_space_indicator as warning_low_space_indicator, storage_domain_static.critical_space_action_blocker as critical_space_action_blocker, storage_domain_dynamic.external_status as external_status FROM storage_domain_static INNER JOIN storage_domain_dynamic ON storage_domain_static.id = storage_domain_dynamic.id LEFT OUTER JOIN storage_pool_iso_map ON storage_domain_static.id = storage_pool_iso_map.storage_id LEFT OUTER JOIN storage_pool ON storage_pool_iso_map.storage_pool_id = storage_pool.id LEFT OUTER JOIN domains_with_unregistered_entities_view ON domains_with_unregistered_entities_view.storage_domain_id = storage_domain_static.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_domains_without_storage_pools AS SELECT DISTINCT storage_domain_static.id AS id, storage_domain_static.storage AS storage, storage_domain_static.storage_name AS storage_name, storage_domain_static.storage_description AS storage_description, storage_domain_static.storage_comment AS storage_comment, storage_domain_static.storage_type AS storage_type, storage_domain_static.storage_domain_type AS storage_domain_type, storage_domain_static.storage_domain_format_type AS storage_domain_format_type, storage_domain_static.last_time_used_as_master AS last_time_used_as_master, storage_domain_static.wipe_after_delete AS wipe_after_delete, NULL AS storage_pool_id, NULL AS storage_pool_name, storage_domain_dynamic.available_disk_size AS available_disk_size, storage_domain_dynamic.used_disk_size AS used_disk_size, fn_get_disk_commited_value_by_storage ( storage_domain_static.id ) AS commited_disk_size, fn_get_actual_images_size_by_storage ( storage_domain_static.id ) AS actual_images_size, NULL AS status, fn_get_storage_domain_shared_status_by_domain_id ( storage_domain_static.id, storage_pool_iso_map.status, storage_domain_static.storage_domain_type ) AS storage_domain_shared_status, storage_domain_static.recoverable AS recoverable, domains_with_unregistered_entities_view.storage_domain_id IS NOT NULL AS contains_unregistered_entities, storage_domain_static.warning_low_space_indicator as warning_low_space_indicator, storage_domain_static.critical_space_action_blocker as critical_space_action_blocker, storage_domain_dynamic.external_status as external_status FROM storage_domain_static INNER JOIN storage_domain_dynamic ON storage_domain_static.id = storage_domain_dynamic.id LEFT OUTER JOIN storage_pool_iso_map ON storage_domain_static.id = storage_pool_iso_map.storage_id LEFT OUTER JOIN domains_with_unregistered_entities_view ON domains_with_unregistered_entities_view.storage_domain_id = storage_domain_static.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_domains_for_search AS SELECT storage_domain_static.id AS id, storage_domain_static.storage AS storage, storage_domain_static.storage_name AS storage_name, storage_domain_static.storage_description AS storage_description, storage_domain_static.storage_comment AS storage_comment, storage_domain_static.storage_type AS storage_type, storage_domain_static.storage_domain_type AS storage_domain_type, storage_domain_static.storage_domain_format_type AS storage_domain_format_type, storage_domain_static.last_time_used_as_master AS last_time_used_as_master, storage_domain_static.wipe_after_delete AS wipe_after_delete, CASE WHEN status_table.is_multi_domain THEN NULL WHEN status_table.status IS NULL THEN 2 ELSE status_table.status END AS status, status_table.storage_pool_ids [ 1 ] AS storage_pool_id, status_table.pool_names AS storage_pool_name, storage_domain_dynamic.available_disk_size AS available_disk_size, storage_domain_dynamic.used_disk_size AS used_disk_size, fn_get_disk_commited_value_by_storage ( storage_domain_static.id ) AS commited_disk_size, fn_get_actual_images_size_by_storage ( storage_domain_static.id ) AS actual_images_size, fn_get_storage_domain_shared_status_by_domain_id ( storage_domain_static.id, status_table.status, storage_domain_static.storage_domain_type ) AS storage_domain_shared_status, storage_domain_static.recoverable AS recoverable, domains_with_unregistered_entities_view.storage_domain_id IS NOT NULL AS contains_unregistered_entities, storage_domain_static.warning_low_space_indicator as warning_low_space_indicator, storage_domain_static.critical_space_action_blocker as critical_space_action_blocker, storage_domain_dynamic.external_status as external_status FROM storage_domain_static INNER JOIN storage_domain_dynamic ON storage_domain_static.id = storage_domain_dynamic.id LEFT OUTER JOIN ( SELECT storage_id, COUNT ( storage_id ) > 1 AS is_multi_domain, MAX ( storage_pool_iso_map.status ) AS status, array_to_string ( array_agg ( storage_pool.name ) , ',' ) AS pool_names, CASE WHEN COUNT ( DISTINCT storage_pool.id ) = 1 THEN array_agg ( storage_pool.id ) ELSE NULL END AS storage_pool_ids FROM storage_pool_iso_map JOIN storage_pool ON storage_pool_iso_map.storage_pool_id = storage_pool.id GROUP BY storage_id ) AS status_table ON storage_domain_static.id = status_table.storage_id LEFT OUTER JOIN domains_with_unregistered_entities_view ON domains_with_unregistered_entities_view.storage_domain_id = storage_domain_static.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW luns_view AS SELECT luns.*, storage_domain_static.id AS storage_id, storage_domain_static.storage_name AS storage_name, disk_lun_map.disk_id AS disk_id, all_disks.disk_alias AS disk_alias FROM luns LEFT OUTER JOIN storage_domain_static ON luns.volume_group_id = storage_domain_static.storage LEFT OUTER JOIN disk_lun_map ON luns.lun_id = disk_lun_map.lun_id LEFT OUTER JOIN all_disks ON disk_lun_map.disk_id = all_disks.disk_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_templates_view AS SELECT vm_templates.vm_guid AS vmt_guid, vm_templates.vm_name AS name, vm_templates.mem_size_mb AS mem_size_mb, vm_templates.num_of_io_threads as num_of_io_threads, vm_templates.os AS os, vm_templates.creation_date AS creation_date, vm_templates.child_count AS child_count, vm_templates.num_of_sockets AS num_of_sockets, vm_templates.cpu_per_socket AS cpu_per_socket, vm_templates.threads_per_cpu AS threads_per_cpu, vm_templates.num_of_sockets * vm_templates.cpu_per_socket * vm_templates.threads_per_cpu AS num_of_cpus, vm_templates.description AS description, vm_templates.free_text_comment AS free_text_comment, vm_templates.vds_group_id AS vds_group_id, vm_templates.num_of_monitors AS num_of_monitors, vm_templates.single_qxl_pci AS single_qxl_pci, vm_templates.allow_console_reconnect AS allow_console_reconnect, vm_templates.template_status AS status, vm_templates.usb_policy AS usb_policy, vm_templates.time_zone AS time_zone, vm_templates.fail_back AS fail_back, vds_groups.name AS vds_group_name, vds_groups.trusted_service AS trusted_service, vm_templates.vm_type AS vm_type, vm_templates.nice_level AS nice_level, vm_templates.cpu_shares AS cpu_shares, storage_pool.id AS storage_pool_id, storage_pool.name AS storage_pool_name, storage_pool.quota_enforcement_type AS quota_enforcement_type, vm_templates.default_boot_sequence AS default_boot_sequence, vm_templates.default_display_type AS default_display_type, vm_templates.priority AS priority, vm_templates.auto_startup AS auto_startup, vm_templates.is_stateless AS is_stateless, vm_templates.is_smartcard_enabled AS is_smartcard_enabled, vm_templates.is_delete_protected AS is_delete_protected, vm_templates.sso_method AS sso_method, vm_templates.iso_path AS iso_path, vm_templates.origin AS origin, vm_templates.initrd_url AS initrd_url, vm_templates.kernel_url AS kernel_url, vm_templates.kernel_params AS kernel_params, vm_templates.quota_id AS quota_id, quota.quota_name AS quota_name, vm_templates.db_generation AS db_generation, vm_templates.migration_support, fn_get_dedicated_hosts_ids_by_vm_id(vm_templates.vm_guid) AS dedicated_vm_for_vds, vm_templates.is_disabled, vm_templates.tunnel_migration, vm_templates.vnc_keyboard_layout AS vnc_keyboard_layout, vm_templates.min_allocated_mem AS min_allocated_mem, vm_templates.is_run_and_pause AS is_run_and_pause, vm_templates.created_by_user_id AS created_by_user_id, vm_templates.entity_type, vm_templates.migration_downtime AS migration_downtime, vds_groups.architecture AS architecture, vm_templates.template_version_number AS template_version_number, vm_templates.vmt_guid AS base_template_id, vm_templates.template_version_name AS template_version_name, vm_templates.serial_number_policy AS serial_number_policy, vm_templates.custom_serial_number AS custom_serial_number, vm_templates.is_boot_menu_enabled AS is_boot_menu_enabled, vm_templates.is_spice_file_transfer_enabled AS is_spice_file_transfer_enabled, vm_templates.is_spice_copy_paste_enabled AS is_spice_copy_paste_enabled, vm_templates.cpu_profile_id AS cpu_profile_id, vm_templates.numatune_mode AS numatune_mode, vm_templates.is_auto_converge AS is_auto_converge, vm_templates.is_migrate_compressed AS is_migrate_compressed, vm_templates.predefined_properties AS predefined_properties, vm_templates.userdefined_properties AS userdefined_properties, vm_templates.custom_emulated_machine AS custom_emulated_machine, vm_templates.custom_cpu_name AS custom_cpu_name, vm_templates.small_icon_id AS small_icon_id, vm_templates.large_icon_id AS large_icon_id, vm_templates.console_disconnect_action as console_disconnect_action FROM vm_static AS vm_templates LEFT OUTER JOIN vds_groups ON vm_templates.vds_group_id = vds_groups.vds_group_id LEFT OUTER JOIN storage_pool ON storage_pool.id = vds_groups.storage_pool_id LEFT OUTER JOIN quota ON vm_templates.quota_id = quota.id WHERE entity_type = 'TEMPLATE' OR entity_type = 'INSTANCE_TYPE' OR entity_type = 'IMAGE_TYPE'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_templates_with_plug_info AS SELECT vm_templates_view.*, image_guid, image_group_id, is_plugged FROM vm_templates_view INNER JOIN vm_device vd ON vd.vm_id = vm_templates_view.vmt_guid INNER JOIN images ON images.image_group_id = vd.device_id AND images.active = TRUE; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_templates_storage_domain AS SELECT vm_templates.vm_guid AS vmt_guid, vm_templates.vm_name AS name, vm_templates.mem_size_mb, vm_templates.num_of_io_threads, vm_templates.os, vm_templates.creation_date, vm_templates.child_count, vm_templates.num_of_sockets, vm_templates.cpu_per_socket, vm_templates.threads_per_cpu, vm_templates.num_of_sockets * vm_templates.cpu_per_socket * vm_templates.threads_per_cpu AS num_of_cpus, vm_templates.description, vm_templates.free_text_comment, vm_templates.vds_group_id, vm_templates.num_of_monitors, vm_templates.single_qxl_pci, vm_templates.allow_console_reconnect, vm_templates.template_status AS status, vm_templates.usb_policy, vm_templates.time_zone, vm_templates.fail_back, vds_groups.name AS vds_group_name, vm_templates.vm_type, vm_templates.nice_level, vm_templates.cpu_shares, storage_pool.id AS storage_pool_id, storage_pool.name AS storage_pool_name, vm_templates.default_boot_sequence, vm_templates.default_display_type, vm_templates.priority, vm_templates.auto_startup, vm_templates.is_stateless, vm_templates.iso_path, vm_templates.origin, vm_templates.initrd_url, vm_templates.kernel_url, vm_templates.kernel_params, image_storage_domain_map.storage_domain_id AS storage_id, quota.quota_name AS quota_name, vm_templates.is_disabled, vm_templates.min_allocated_mem, vm_templates.is_run_and_pause, vm_templates.created_by_user_id, vm_templates.migration_downtime, vm_templates.entity_type, vds_groups.architecture, vm_templates.template_version_number AS template_version_number, vm_templates.vmt_guid AS base_template_id, vm_templates.template_version_name AS template_version_name, vm_templates.serial_number_policy AS serial_number_policy, vm_templates.custom_serial_number AS custom_serial_number, vm_templates.is_boot_menu_enabled AS is_boot_menu_enabled, vm_templates.is_spice_file_transfer_enabled AS is_spice_file_transfer_enabled, vm_templates.is_spice_copy_paste_enabled AS is_spice_copy_paste_enabled, vm_templates.cpu_profile_id AS cpu_profile_id, vm_templates.numatune_mode AS numatune_mode, vm_templates.is_auto_converge AS is_auto_converge, vm_templates.is_migrate_compressed AS is_migrate_compressed, vm_templates.predefined_properties AS predefined_properties, vm_templates.userdefined_properties AS userdefined_properties FROM vm_static AS vm_templates LEFT OUTER JOIN vds_groups ON vm_templates.vds_group_id = vds_groups.vds_group_id LEFT OUTER JOIN storage_pool ON storage_pool.id = vds_groups.storage_pool_id INNER JOIN vm_device ON vm_device.vm_id = vm_templates.vm_guid LEFT JOIN images ON images.image_group_id = vm_device.device_id LEFT JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid LEFT OUTER JOIN quota quota ON quota.id = vm_templates.quota_id WHERE entity_type = 'TEMPLATE' OR entity_type = 'INSTANCE_TYPE' OR entity_type = 'IMAGE_TYPE' UNION SELECT vm_templates_1.vm_guid AS vmt_guid, vm_templates_1.vm_name AS name, vm_templates_1.mem_size_mb, vm_templates_1.num_of_io_threads, vm_templates_1.os, vm_templates_1.creation_date, vm_templates_1.child_count, vm_templates_1.num_of_sockets, vm_templates_1.cpu_per_socket, vm_templates_1.threads_per_cpu, vm_templates_1.num_of_sockets * vm_templates_1.cpu_per_socket * vm_templates_1.threads_per_cpu AS num_of_cpus, vm_templates_1.description, vm_templates_1.free_text_comment, vm_templates_1.vds_group_id, vm_templates_1.num_of_monitors, vm_templates_1.single_qxl_pci, vm_templates_1.allow_console_reconnect, vm_templates_1.template_status AS status, vm_templates_1.usb_policy, vm_templates_1.time_zone, vm_templates_1.fail_back, vds_groups_1.name AS vds_group_name, vm_templates_1.vm_type, vm_templates_1.nice_level, vm_templates_1.cpu_shares, storage_pool_1.id AS storage_pool_id, storage_pool_1.name AS storage_pool_name, vm_templates_1.default_boot_sequence, vm_templates_1.default_display_type, vm_templates_1.priority, vm_templates_1.auto_startup, vm_templates_1.is_stateless, vm_templates_1.iso_path, vm_templates_1.origin, vm_templates_1.initrd_url, vm_templates_1.kernel_url, vm_templates_1.kernel_params, image_storage_domain_map.storage_domain_id AS storage_id, quota.quota_name AS quota_name, vm_templates_1.is_disabled, vm_templates_1.min_allocated_mem, vm_templates_1.is_run_and_pause, vm_templates_1.created_by_user_id, vm_templates_1.migration_downtime, vm_templates_1.entity_type, vds_groups_1.architecture, vm_templates_1.template_version_number AS template_version_number, vm_templates_1.vmt_guid AS base_template_id, vm_templates_1.template_version_name AS template_version_name, vm_templates_1.serial_number_policy AS serial_number_policy, vm_templates_1.custom_serial_number AS custom_serial_number, vm_templates_1.is_boot_menu_enabled AS is_boot_menu_enabled, vm_templates_1.is_spice_file_transfer_enabled AS is_spice_file_transfer_enabled, vm_templates_1.is_spice_copy_paste_enabled AS is_spice_copy_paste_enabled, vm_templates_1.cpu_profile_id AS cpu_profile_id, vm_templates_1.numatune_mode AS numatune_mode, vm_templates_1.is_auto_converge AS is_auto_converge, vm_templates_1.is_migrate_compressed AS is_migrate_compressed, vm_templates_1.predefined_properties AS predefined_properties, vm_templates_1.userdefined_properties AS userdefined_properties FROM vm_static AS vm_templates_1 LEFT OUTER JOIN vds_groups AS vds_groups_1 ON vm_templates_1.vds_group_id = vds_groups_1.vds_group_id LEFT OUTER JOIN storage_pool AS storage_pool_1 ON storage_pool_1.id = vds_groups_1.storage_pool_id INNER JOIN vm_device AS vm_device_1 ON vm_device_1.vm_id = vm_templates_1.vm_guid INNER JOIN images AS images_1 ON images_1.image_group_id = vm_device_1.device_id INNER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images_1.image_guid LEFT OUTER JOIN quota quota ON quota.id = vm_templates_1.quota_id WHERE entity_type = 'TEMPLATE' OR entity_type = 'INSTANCE_TYPE' OR entity_type = 'IMAGE_TYPE'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW instance_types_view AS SELECT * FROM vm_templates_view WHERE entity_type = 'INSTANCE_TYPE'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW instance_types_storage_domain AS SELECT * FROM vm_templates_storage_domain WHERE entity_type = 'INSTANCE_TYPE'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW image_types_view AS SELECT * FROM vm_templates_view WHERE entity_type = 'IMAGE_TYPE'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW image_types_storage_domain AS SELECT * FROM vm_templates_storage_domain WHERE entity_type = 'IMAGE_TYPE'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_pool_map_view AS SELECT vm_pool_map.vm_guid AS vm_guid, vm_pool_map.vm_pool_id AS vm_pool_id, vm_pools.vm_pool_name AS vm_pool_name, vm_pools.spice_proxy AS vm_pool_spice_proxy FROM vm_pool_map INNER JOIN vm_pools ON vm_pool_map.vm_pool_id = vm_pools.vm_pool_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW tags_vm_pool_map_view AS SELECT tags.tag_id AS tag_id, tags.tag_name AS tag_name, tags.parent_id AS parent_id, tags.readonly AS readonly, tags.type AS type, tags_vm_pool_map.vm_pool_id AS vm_pool_id FROM tags INNER JOIN tags_vm_pool_map ON tags.tag_id = tags_vm_pool_map.tag_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW tags_vm_map_view AS SELECT tags.tag_id AS tag_id, tags.tag_name AS tag_name, tags.parent_id AS parent_id, tags.readonly AS readonly, tags.type AS type, tags_vm_map.vm_id AS vm_id FROM tags INNER JOIN tags_vm_map ON tags.tag_id = tags_vm_map.tag_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW tags_vds_map_view AS SELECT tags.tag_id AS tag_id, tags.tag_name AS tag_name, tags.parent_id AS parent_id, tags.readonly AS readonly, tags.type AS type, tags_vds_map.vds_id AS vds_id FROM tags INNER JOIN tags_vds_map ON tags.tag_id = tags_vds_map.tag_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW tags_user_map_view AS SELECT tags.tag_id AS tag_id, tags.tag_name AS tag_name, tags.parent_id AS parent_id, tags.readonly AS readonly, tags.type AS type, tags_user_map.user_id AS user_id FROM tags INNER JOIN tags_user_map ON tags.tag_id = tags_user_map.tag_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW tags_user_group_map_view AS SELECT tags.tag_id AS tag_id, tags.tag_name AS tag_name, tags.parent_id AS parent_id, tags.readonly AS readonly, tags.type AS type, tags_user_group_map.group_id AS group_id FROM tags_user_group_map INNER JOIN tags ON tags_user_group_map.tag_id = tags.tag_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vms AS SELECT vm_static.vm_name AS vm_name, vm_static.mem_size_mb AS mem_size_mb, vm_static.num_of_io_threads as num_of_io_threads, vm_static.nice_level AS nice_level, vm_static.cpu_shares AS cpu_shares, vm_static.vmt_guid AS vmt_guid, vm_static.os AS os, vm_static.description AS description, vm_static.free_text_comment AS free_text_comment, vm_static.vds_group_id AS vds_group_id, vm_static.creation_date AS creation_date, vm_static.auto_startup AS auto_startup, vm_static.is_stateless AS is_stateless, vm_static.is_smartcard_enabled AS is_smartcard_enabled, vm_static.is_delete_protected AS is_delete_protected, vm_static.sso_method AS sso_method, fn_get_dedicated_hosts_ids_by_vm_id(vm_static.vm_guid) AS dedicated_vm_for_vds, vm_static.fail_back AS fail_back, vm_static.default_boot_sequence AS default_boot_sequence, vm_static.vm_type AS vm_type, vm_pool_map_view.vm_pool_spice_proxy AS vm_pool_spice_proxy, vds_groups.name AS vds_group_name, vds_groups.transparent_hugepages AS transparent_hugepages, vds_groups.trusted_service AS trusted_service, storage_pool.id AS storage_pool_id, storage_pool.name AS storage_pool_name, vds_groups.description AS vds_group_description, vds_groups.spice_proxy AS vds_group_spice_proxy, vm_templates.vm_name AS vmt_name, vm_templates.mem_size_mb AS vmt_mem_size_mb, vm_templates.os AS vmt_os, vm_templates.creation_date AS vmt_creation_date, vm_templates.child_count AS vmt_child_count, vm_templates.num_of_sockets AS vmt_num_of_sockets, vm_templates.cpu_per_socket AS vmt_cpu_per_socket, vm_templates.threads_per_cpu AS vmt_threads_per_cpu, vm_templates.num_of_sockets * vm_templates.cpu_per_socket * vm_templates.threads_per_cpu AS vmt_num_of_cpus, vm_templates.description AS vmt_description, vm_dynamic.status AS status, vm_dynamic.vm_ip AS vm_ip, fn_get_comparable_ip_list(vm_ip) as vm_ip_inet_array, vm_dynamic.vm_host AS vm_host, vm_dynamic.vm_pid AS vm_pid, vm_dynamic.last_start_time AS last_start_time, vm_dynamic.guest_cur_user_name AS guest_cur_user_name, vm_dynamic.console_cur_user_name AS console_cur_user_name, vm_dynamic.guest_os AS guest_os, vm_dynamic.console_user_id AS console_user_id, vm_dynamic.guest_agent_nics_hash AS guest_agent_nics_hash, vm_dynamic.run_on_vds AS run_on_vds, vm_dynamic.migrating_to_vds AS migrating_to_vds, vm_dynamic.app_list AS app_list, vm_pool_map_view.vm_pool_name AS vm_pool_name, vm_pool_map_view.vm_pool_id AS vm_pool_id, vm_static.vm_guid AS vm_guid, vm_static.num_of_monitors AS num_of_monitors, vm_static.single_qxl_pci AS single_qxl_pci, vm_static.allow_console_reconnect AS allow_console_reconnect, vm_static.is_initialized AS is_initialized, vm_static.num_of_sockets AS num_of_sockets, vm_static.cpu_per_socket AS cpu_per_socket, vm_static.threads_per_cpu AS threads_per_cpu, vm_static.usb_policy AS usb_policy, vm_dynamic.acpi_enable AS acpi_enable, vm_dynamic.session AS SESSION, vm_static.num_of_sockets * vm_static.cpu_per_socket * vm_static.threads_per_cpu AS num_of_cpus, vm_static.quota_id AS quota_id, quota.quota_name AS quota_name, storage_pool.quota_enforcement_type AS quota_enforcement_type, vm_dynamic.kvm_enable AS kvm_enable, vm_dynamic.boot_sequence AS boot_sequence, vm_dynamic.utc_diff AS utc_diff, vm_dynamic.last_vds_run_on AS last_vds_run_on, vm_dynamic.client_ip AS client_ip, vm_dynamic.guest_requested_memory AS guest_requested_memory, vm_static.time_zone AS time_zone, vm_statistics.cpu_user AS cpu_user, vm_statistics.cpu_sys AS cpu_sys, vm_statistics.memory_usage_history AS memory_usage_history, vm_statistics.cpu_usage_history AS cpu_usage_history, vm_statistics.network_usage_history AS network_usage_history, vm_statistics.elapsed_time AS elapsed_time, vm_statistics.usage_network_percent AS usage_network_percent, vm_statistics.disks_usage AS disks_usage, vm_statistics.usage_mem_percent AS usage_mem_percent, vm_statistics.migration_progress_percent AS migration_progress_percent, vm_statistics.usage_cpu_percent AS usage_cpu_percent, vds_static.vds_name AS run_on_vds_name, vds_groups.cpu_name AS vds_group_cpu_name, vm_static.default_display_type AS default_display_type, vm_static.priority AS priority, vm_static.iso_path AS iso_path, vm_static.origin AS origin, vds_groups.compatibility_version AS vds_group_compatibility_version, vm_static.initrd_url AS initrd_url, vm_static.kernel_url AS kernel_url, vm_static.kernel_params AS kernel_params, vm_dynamic.pause_status AS pause_status, vm_dynamic.exit_message AS exit_message, vm_dynamic.exit_status AS exit_status, vm_static.migration_support AS migration_support, vm_static.predefined_properties AS predefined_properties, vm_static.userdefined_properties AS userdefined_properties, vm_static.min_allocated_mem AS min_allocated_mem, vm_dynamic.hash AS hash, vm_static.cpu_pinning AS cpu_pinning, vm_static.db_generation AS db_generation, vm_static.host_cpu_flags AS host_cpu_flags, vm_static.tunnel_migration AS tunnel_migration, vm_static.vnc_keyboard_layout AS vnc_keyboard_layout, vm_static.is_run_and_pause AS is_run_and_pause, vm_static.created_by_user_id AS created_by_user_id, vm_dynamic.last_watchdog_event AS last_watchdog_event, vm_dynamic.last_watchdog_action AS last_watchdog_action, vm_dynamic.is_run_once AS is_run_once, vm_dynamic.vm_fqdn AS vm_fqdn, vm_dynamic.cpu_name AS cpu_name, vm_dynamic.emulated_machine AS emulated_machine, vm_dynamic.current_cd AS current_cd, vm_dynamic.reason AS reason, vm_dynamic.exit_reason AS exit_reason, vm_static.instance_type_id AS instance_type_id, vm_static.image_type_id AS image_type_id, vds_groups.architecture AS architecture, vm_static.original_template_id AS original_template_id, vm_static.original_template_name AS original_template_name, vm_dynamic.last_stop_time AS last_stop_time, vm_static.migration_downtime AS migration_downtime, vm_static.template_version_number AS template_version_number, vm_static.serial_number_policy AS serial_number_policy, vm_static.custom_serial_number AS custom_serial_number, vm_static.is_boot_menu_enabled AS is_boot_menu_enabled, vm_dynamic.guest_cpu_count AS guest_cpu_count, ( snapshots.snapshot_id IS NOT NULL ) AS next_run_config_exists, vm_static.numatune_mode AS numatune_mode, vm_static.is_spice_file_transfer_enabled AS is_spice_file_transfer_enabled, vm_static.is_spice_copy_paste_enabled AS is_spice_copy_paste_enabled, vm_static.cpu_profile_id AS cpu_profile_id, vm_static.is_auto_converge AS is_auto_converge, vm_static.is_migrate_compressed AS is_migrate_compressed, vm_static.custom_emulated_machine AS custom_emulated_machine, vm_static.custom_cpu_name AS custom_cpu_name, vm_dynamic.spice_port AS spice_port, vm_dynamic.spice_tls_port AS spice_tls_port, vm_dynamic.spice_ip AS spice_ip, vm_dynamic.vnc_port AS vnc_port, vm_dynamic.vnc_ip AS vnc_ip, vm_dynamic.guest_agent_status AS guest_agent_status, vm_dynamic.guest_mem_buffered as guest_mem_buffered, vm_dynamic.guest_mem_cached as guest_mem_cached, vm_dynamic.guest_mem_free as guest_mem_free, vm_static.small_icon_id as small_icon_id, vm_static.large_icon_id as large_icon_id, vm_static.provider_id as provider_id, vm_static.console_disconnect_action as console_disconnect_action, vm_dynamic.guest_timezone_offset as guest_timezone_offset, vm_dynamic.guest_timezone_name as guest_timezone_name, vm_dynamic.guestos_arch as guestos_arch, vm_dynamic.guestos_codename as guestos_codename, vm_dynamic.guestos_distribution as guestos_distribution, vm_dynamic.guestos_kernel_version as guestos_kernel_version, vm_dynamic.guestos_type as guestos_type, vm_dynamic.guestos_version as guestos_version FROM vm_static INNER JOIN vm_dynamic ON vm_static.vm_guid = vm_dynamic.vm_guid INNER JOIN vm_static AS vm_templates ON vm_static.vmt_guid = vm_templates.vm_guid INNER JOIN vm_statistics ON vm_static.vm_guid = vm_statistics.vm_guid INNER JOIN vds_groups ON vm_static.vds_group_id = vds_groups.vds_group_id LEFT OUTER JOIN storage_pool ON vm_static.vds_group_id = vds_groups.vds_group_id AND vds_groups.storage_pool_id = storage_pool.id LEFT OUTER JOIN quota ON vm_static.quota_id = quota.id LEFT OUTER JOIN vds_static ON vm_dynamic.run_on_vds = vds_static.vds_id LEFT OUTER JOIN vm_pool_map_view ON vm_static.vm_guid = vm_pool_map_view.vm_guid LEFT OUTER JOIN snapshots ON vm_static.vm_guid = snapshots.vm_id AND snapshot_type = 'NEXT_RUN' WHERE vm_static.entity_type = 'VM'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vms_with_tags AS SELECT vms.vm_name, vms.mem_size_mb, vms.num_of_io_threads, vms.nice_level, vms.cpu_shares, vms.vmt_guid, vms.os, vms.description, vms.free_text_comment, vms.vds_group_id, vms.creation_date, vms.auto_startup, vms.is_stateless, vms.is_smartcard_enabled, vms.is_delete_protected, vms.sso_method, fn_get_dedicated_hosts_ids_by_vm_id(vms.vm_guid) AS dedicated_vm_for_vds, vms.fail_back, vms.default_boot_sequence, vms.vm_type, vms.vds_group_name, vms.storage_pool_id, vms.storage_pool_name, vms.vds_group_description, vms.vmt_name, vms.vmt_mem_size_mb, vms.vmt_os, vms.vmt_creation_date, vms.vmt_child_count, vms.vmt_num_of_sockets, vms.vmt_cpu_per_socket, vms.vmt_description, vms.status, vms.vm_ip, vms.vm_ip_inet_array, vms.vm_host, vms.vmt_num_of_sockets * vms.vmt_cpu_per_socket * vms.vmt_threads_per_cpu AS vmt_num_of_cpus, vms.vm_pid, vms.last_start_time, vms.last_stop_time, vms.guest_cur_user_name, vms.console_cur_user_name, vms.console_user_id, vms.guest_os, vms.run_on_vds, vms.migrating_to_vds, vms.app_list, vms.vm_pool_name, vms.vm_pool_id, vms.vm_guid, vms.num_of_monitors, vms.single_qxl_pci, vms.allow_console_reconnect, vms.is_initialized, vms.num_of_sockets, vms.cpu_per_socket, vms.threads_per_cpu, vms.usb_policy, vms.acpi_enable, vms.session, vms.num_of_sockets * vms.cpu_per_socket * vms.threads_per_cpu AS num_of_cpus, vms.kvm_enable, vms.boot_sequence, vms.utc_diff, vms.last_vds_run_on, vms.client_ip, vms.guest_requested_memory, vms.time_zone, vms.cpu_user, vms.cpu_sys, vms.elapsed_time, vms.usage_network_percent, vms.disks_usage, vms.usage_mem_percent, vms.migration_progress_percent, vms.usage_cpu_percent, vms.run_on_vds_name, vms.vds_group_cpu_name, tags_vm_map_view.tag_name, tags_vm_map_view.tag_id, vms.default_display_type, vms.priority, vms.vds_group_compatibility_version, vms.initrd_url, vms.kernel_url, vms.kernel_params, vms.pause_status, vms.exit_status, vms.exit_message, vms.min_allocated_mem, storage_domain_static.id AS storage_id, vms.quota_id AS quota_id, vms.quota_name AS quota_name, vms.tunnel_migration AS tunnel_migration, vms.vnc_keyboard_layout AS vnc_keyboard_layout, vms.is_run_and_pause AS is_run_and_pause, vms.created_by_user_id AS created_by_user_id, vms.vm_fqdn, vms.cpu_name AS cpu_name, vms.emulated_machine AS emulated_machine, vms.custom_emulated_machine AS custom_emulated_machine, vms.custom_cpu_name AS custom_cpu_name, vms.vm_pool_spice_proxy AS vm_pool_spice_proxy, vms.vds_group_spice_proxy AS vds_group_spice_proxy, vms.instance_type_id AS instance_type_id, vms.image_type_id AS image_type_id, vms.architecture AS architecture, vms.original_template_id AS original_template_id, vms.original_template_name AS original_template_name, vms.migration_downtime AS migration_downtime, vms.template_version_number AS template_version_number, vms.current_cd AS current_cd, vms.reason AS reason, vms.serial_number_policy AS serial_number_policy, vms.custom_serial_number AS custom_serial_number, vms.exit_reason AS exit_reason, vms.is_boot_menu_enabled AS is_boot_menu_enabled, vms.guest_cpu_count AS guest_cpu_count, ( snapshots.snapshot_id IS NOT NULL ) AS next_run_config_exists, vms.numatune_mode, vms.is_spice_file_transfer_enabled, vms.is_spice_copy_paste_enabled, vms.cpu_profile_id, vms.is_auto_converge, vms.is_migrate_compressed, vms.spice_port, vms.spice_tls_port, vms.spice_ip, vms.vnc_port, vms.vnc_ip, vms.guest_agent_status, vms.guest_mem_buffered as guest_mem_buffered, vms.guest_mem_cached as guest_mem_cached, vms.guest_mem_free as guest_mem_free, vms.small_icon_id as small_icon_id, vms.large_icon_id as large_icon_id, vms.console_disconnect_action, vms.guest_timezone_offset as guest_timezone_offset, vms.guest_timezone_name as guest_timezone_name, vms.guestos_arch as guestos_arch, vms.guestos_codename as guestos_codename, vms.guestos_distribution as guestos_distribution, vms.guestos_kernel_version as guestos_kernel_version, vms.guestos_type as guestos_type, vms.guestos_version as guestos_version FROM vms LEFT OUTER JOIN tags_vm_map_view ON vms.vm_guid = tags_vm_map_view.vm_id LEFT OUTER JOIN vm_device ON vm_device.vm_id = vms.vm_guid LEFT OUTER JOIN images ON images.image_group_id = vm_device.device_id LEFT OUTER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid LEFT OUTER JOIN storage_domain_static ON storage_domain_static.id = image_storage_domain_map.storage_domain_id LEFT OUTER JOIN snapshots ON vms.vm_guid = snapshots.vm_id AND snapshot_type = 'NEXT_RUN' WHERE images.active IS NULL OR images.active = TRUE; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW server_vms AS SELECT * FROM vms WHERE vm_type = '1'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vms_with_plug_info AS SELECT * FROM vms INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW desktop_vms AS SELECT * FROM vms WHERE vm_type = '0'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vds AS SELECT vds_groups.vds_group_id AS vds_group_id, vds_groups.name AS vds_group_name, vds_groups.description AS vds_group_description, vds_groups.architecture AS architecture, vds_groups.enable_balloon AS enable_balloon, vds_static.vds_id AS vds_id, vds_static.vds_name AS vds_name, vds_static.vds_unique_id AS vds_unique_id, vds_static.host_name AS host_name, vds_static.free_text_comment AS free_text_comment, vds_static.port AS port, vds_static.vds_strength AS vds_strength, vds_static.server_SSL_enabled AS server_SSL_enabled, vds_static.vds_type AS vds_type, vds_static.pm_enabled AS pm_enabled, vds_static.pm_proxy_preferences AS pm_proxy_preferences, vds_static.pm_detect_kdump AS pm_detect_kdump, vds_static.vds_spm_priority AS vds_spm_priority, vds_dynamic.hooks AS hooks, vds_dynamic.status AS status, vds_dynamic.external_status AS external_status, vds_dynamic.cpu_cores AS cpu_cores, vds_dynamic.cpu_threads AS cpu_threads, vds_dynamic.cpu_model AS cpu_model, vds_dynamic.cpu_speed_mh AS cpu_speed_mh, vds_dynamic.if_total_speed AS if_total_speed, vds_dynamic.kvm_enabled AS kvm_enabled, vds_dynamic.physical_mem_mb AS physical_mem_mb, vds_dynamic.pending_vcpus_count AS pending_vcpus_count, vds_dynamic.pending_vmem_size AS pending_vmem_size, vds_dynamic.mem_commited AS mem_commited, vds_dynamic.vm_active AS vm_active, vds_dynamic.vm_count AS vm_count, vds_dynamic.vm_migrating AS vm_migrating, vds_dynamic.incoming_migrations AS incoming_migrations, vds_dynamic.outgoing_migrations AS outgoing_migrations, vds_dynamic.vms_cores_count AS vms_cores_count, vds_statistics.cpu_over_commit_time_stamp AS cpu_over_commit_time_stamp, vds_groups.max_vds_memory_over_commit AS max_vds_memory_over_commit, vds_dynamic.net_config_dirty AS net_config_dirty, vds_groups.count_threads_as_cores AS count_threads_as_cores, storage_pool.id AS storage_pool_id, storage_pool.name AS storage_pool_name, vds_dynamic.reserved_mem AS reserved_mem, vds_dynamic.guest_overhead AS guest_overhead, vds_dynamic.rpm_version AS rpm_version, vds_dynamic.software_version AS software_version, vds_dynamic.version_name AS version_name, vds_dynamic.build_name AS build_name, vds_dynamic.previous_status AS previous_status, vds_statistics.cpu_idle AS cpu_idle, vds_statistics.cpu_load AS cpu_load, vds_statistics.cpu_sys AS cpu_sys, vds_statistics.cpu_user AS cpu_user, vds_statistics.usage_mem_percent AS usage_mem_percent, vds_statistics.usage_cpu_percent AS usage_cpu_percent, vds_statistics.usage_network_percent AS usage_network_percent, vds_statistics.mem_available AS mem_available, vds_statistics.mem_free AS mem_free, vds_statistics.mem_shared AS mem_shared, vds_statistics.swap_free AS swap_free, vds_statistics.swap_total AS swap_total, vds_statistics.ksm_cpu_percent AS ksm_cpu_percent, vds_statistics.ksm_pages AS ksm_pages, vds_statistics.ksm_state AS ksm_state, vds_dynamic.cpu_flags AS cpu_flags, vds_groups.cpu_name AS vds_group_cpu_name, vds_dynamic.cpu_sockets AS cpu_sockets, vds_spm_id_map.vds_spm_id AS vds_spm_id, vds_static.otp_validity AS otp_validity, CASE WHEN storage_pool.spm_vds_id = vds_static.vds_id THEN CASE WHEN storage_pool.status = 5 THEN 1 ELSE 2 END ELSE 0 END AS spm_status, vds_dynamic.supported_cluster_levels AS supported_cluster_levels, vds_dynamic.supported_engines AS supported_engines, vds_groups.compatibility_version AS vds_group_compatibility_version, vds_groups.virt_service AS vds_group_virt_service, vds_groups.gluster_service AS vds_group_gluster_service, vds_dynamic.host_os AS host_os, vds_dynamic.kvm_version AS kvm_version, vds_dynamic.libvirt_version AS libvirt_version, vds_dynamic.spice_version AS spice_version, vds_dynamic.gluster_version AS gluster_version, vds_dynamic.librbd1_version AS librbd1_version, vds_dynamic.glusterfs_cli_version AS glusterfs_cli_version, vds_dynamic.kernel_version AS kernel_version, vds_dynamic.iscsi_initiator_name AS iscsi_initiator_name, vds_dynamic.transparent_hugepages_state AS transparent_hugepages_state, vds_statistics.anonymous_hugepages AS anonymous_hugepages, vds_dynamic.non_operational_reason AS non_operational_reason, vds_static.recoverable AS recoverable, vds_static.sshKeyFingerprint AS sshKeyFingerprint, vds_static.host_provider_id AS host_provider_id, vds_dynamic.hw_manufacturer AS hw_manufacturer, vds_dynamic.hw_product_name AS hw_product_name, vds_dynamic.hw_version AS hw_version, vds_dynamic.hw_serial_number AS hw_serial_number, vds_dynamic.hw_uuid AS hw_uuid, vds_dynamic.hw_family AS hw_family, vds_static.console_address AS console_address, vds_dynamic.hbas AS hbas, vds_dynamic.supported_emulated_machines AS supported_emulated_machines, vds_dynamic.supported_rng_sources AS supported_rng_sources, vds_static.ssh_port AS ssh_port, vds_static.ssh_username AS ssh_username, vds_statistics.ha_score AS ha_score, vds_statistics.ha_configured AS ha_configured, vds_statistics.ha_active AS ha_active, vds_statistics.ha_global_maintenance AS ha_global_maintenance, vds_statistics.ha_local_maintenance AS ha_local_maintenance, vds_static.disable_auto_pm AS disable_auto_pm, vds_dynamic.controlled_by_pm_policy AS controlled_by_pm_policy, vds_statistics.boot_time AS boot_time, vds_dynamic.kdump_status AS kdump_status, vds_dynamic.selinux_enforce_mode AS selinux_enforce_mode, vds_dynamic.auto_numa_balancing AS auto_numa_balancing, vds_dynamic.is_numa_supported AS is_numa_supported, vds_dynamic.is_live_snapshot_supported AS is_live_snapshot_supported, vds_static.protocol AS protocol, vds_dynamic.is_live_merge_supported AS is_live_merge_supported, vds_dynamic.online_cpus AS online_cpus, fence_agents.id AS agent_id, fence_agents.agent_order AS agent_order, fence_agents.ip AS agent_ip, fence_agents.type AS agent_type, fence_agents.agent_user AS agent_user, fence_agents.agent_password AS agent_password, fence_agents.port AS agent_port, fence_agents.options AS agent_options, vds_dynamic.maintenance_reason AS maintenance_reason, fence_agents.encrypt_options AS agent_encrypt_options, vds_dynamic.is_update_available AS is_update_available, vds_dynamic.is_hostdev_enabled AS is_hostdev_enabled FROM vds_groups INNER JOIN vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN vds_statistics ON vds_static.vds_id = vds_statistics.vds_id LEFT OUTER JOIN storage_pool ON vds_groups.storage_pool_id = storage_pool.id LEFT OUTER JOIN fence_agents ON vds_static.vds_id = fence_agents.vds_id LEFT OUTER JOIN vds_spm_id_map ON vds_static.vds_id = vds_spm_id_map.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vds_with_tags AS SELECT vds_groups.vds_group_id, vds_groups.name AS vds_group_name, vds_groups.description AS vds_group_description, vds_groups.architecture AS architecture, vds_static.vds_id, vds_static.vds_name, vds_static.vds_unique_id, vds_static.host_name, vds_static.free_text_comment, vds_static.port, vds_static.vds_strength, vds_static.server_SSL_enabled, vds_static.vds_type, vds_dynamic.hw_product_name, vds_dynamic.hw_version, vds_dynamic.hw_serial_number, vds_dynamic.hw_uuid, vds_dynamic.hw_family, vds_static.pm_enabled, vds_static.pm_proxy_preferences AS pm_proxy_preferences, vds_static.pm_detect_kdump AS pm_detect_kdump, vds_dynamic.hooks, vds_dynamic.status, vds_dynamic.external_status, vds_dynamic.cpu_cores, vds_dynamic.cpu_threads, vds_dynamic.cpu_model, vds_dynamic.cpu_speed_mh, vds_dynamic.if_total_speed, vds_dynamic.kvm_enabled, vds_dynamic.physical_mem_mb, vds_dynamic.pending_vcpus_count, vds_dynamic.pending_vmem_size, vds_dynamic.mem_commited, vds_dynamic.vm_active, vds_dynamic.vm_count, vds_dynamic.vm_migrating, vds_dynamic.incoming_migrations, vds_dynamic.outgoing_migrations, vds_dynamic.vms_cores_count, vds_statistics.cpu_over_commit_time_stamp, vds_dynamic.net_config_dirty, vds_groups.max_vds_memory_over_commit, vds_groups.count_threads_as_cores, storage_pool.id AS storage_pool_id, storage_pool.name AS storage_pool_name, tags_vds_map_view.tag_name, tags_vds_map_view.tag_id, vds_dynamic.reserved_mem, vds_dynamic.guest_overhead, vds_dynamic.rpm_version, vds_dynamic.software_version, vds_dynamic.version_name, vds_dynamic.build_name, vds_dynamic.previous_status, vds_statistics.cpu_idle, vds_statistics.cpu_load, vds_statistics.cpu_sys, vds_statistics.cpu_user, vds_statistics.usage_mem_percent, vds_statistics.usage_cpu_percent, vds_statistics.usage_network_percent, vds_statistics.mem_available, vds_statistics.mem_free, vds_statistics.mem_shared, vds_statistics.swap_free, vds_statistics.swap_total, vds_statistics.ksm_cpu_percent, vds_statistics.ksm_pages, vds_statistics.ksm_state, vds_dynamic.cpu_flags, vds_groups.cpu_name AS vds_group_cpu_name, vds_dynamic.cpu_sockets, vds_spm_id_map.vds_spm_id, vds_static.otp_validity AS otp_validity, vds_static.console_address AS console_address, CASE WHEN storage_pool.spm_vds_id = vds_static.vds_id THEN CASE WHEN storage_pool.status = 5 THEN 1 ELSE 2 END ELSE 0 END AS spm_status, vds_dynamic.supported_cluster_levels, vds_dynamic.supported_engines, vds_groups.compatibility_version AS vds_group_compatibility_version, vds_dynamic.host_os, vds_dynamic.kvm_version, vds_dynamic.libvirt_version, vds_dynamic.spice_version, vds_dynamic.gluster_version, vds_dynamic.librbd1_version, vds_dynamic.glusterfs_cli_version, vds_dynamic.kernel_version, vds_dynamic.iscsi_initiator_name, vds_dynamic.transparent_hugepages_state, vds_statistics.anonymous_hugepages, vds_dynamic.non_operational_reason, storage_pool_iso_map.storage_id, vds_static.ssh_port, vds_static.ssh_username, vds_statistics.ha_score, vds_statistics.ha_configured, vds_statistics.ha_active, vds_statistics.ha_global_maintenance, vds_statistics.ha_local_maintenance, vds_static.disable_auto_pm AS disable_auto_pm, vds_dynamic.controlled_by_pm_policy AS controlled_by_pm_policy, vds_statistics.boot_time, vds_dynamic.kdump_status AS kdump_status, vds_dynamic.selinux_enforce_mode AS selinux_enforce_mode, vds_dynamic.auto_numa_balancing AS auto_numa_balancing, vds_dynamic.is_numa_supported AS is_numa_supported, vds_dynamic.supported_rng_sources AS supported_rng_sources, vds_dynamic.is_live_snapshot_supported AS is_live_snapshot_supported, vds_static.protocol AS protocol, vds_dynamic.is_live_merge_supported AS is_live_merge_supported, vds_dynamic.online_cpus AS online_cpus, fence_agents.id AS agent_id, fence_agents.agent_order AS agent_order, fence_agents.ip AS agent_ip, fence_agents.type AS agent_type, fence_agents.agent_user AS agent_user, fence_agents.agent_password AS agent_password, fence_agents.port AS agent_port, fence_agents.options AS agent_options, vds_dynamic.maintenance_reason AS maintenance_reason, vds_dynamic.is_update_available AS is_update_available, vds_dynamic.is_hostdev_enabled AS is_hostdev_enabled FROM vds_groups INNER JOIN vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id INNER JOIN vds_dynamic ON vds_static.vds_id = vds_dynamic.vds_id INNER JOIN vds_statistics ON vds_static.vds_id = vds_statistics.vds_id LEFT OUTER JOIN storage_pool ON vds_groups.storage_pool_id = storage_pool.id LEFT OUTER JOIN tags_vds_map_view ON vds_static.vds_id = tags_vds_map_view.vds_id LEFT OUTER JOIN fence_agents ON vds_static.vds_id = fence_agents.vds_id LEFT OUTER JOIN vds_spm_id_map ON vds_static.vds_id = vds_spm_id_map.vds_id LEFT OUTER JOIN storage_pool_iso_map ON storage_pool_iso_map.storage_pool_id = storage_pool.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW users_and_groups_to_vm_pool_map_view AS SELECT p.vm_pool_id AS vm_pool_id, p.vm_pool_name AS vm_pool_name, per.ad_element_id AS user_id FROM vm_pools AS p INNER JOIN permissions AS per ON per.object_id = p.vm_pool_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vdc_users AS SELECT 'user' AS user_group, users_1.name AS name, users_1.user_id AS user_id, users_1.surname AS surname, users_1.domain AS DOMAIN, users_1.username AS username, users_1.department AS department, users_1.email AS email, users_1.note AS note, 0 AS vm_admin, users_1.last_admin_check_status AS last_admin_check_status, users_1.external_id AS external_id, users_1.namespace AS namespace FROM users AS users_1 UNION SELECT 'group' AS user_group, ad_groups.name AS name, ad_groups.id AS id, '' AS surname, ad_groups.domain AS DOMAIN, '' AS username, '' AS department, '' AS email, '' AS note, 1 AS vm_admin, NULL AS last_admin_check_status, ad_groups.external_id AS external_id, ad_groups.namespace AS namespace FROM ad_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vdc_users_with_tags AS SELECT users_1.user_group AS user_group, users_1.name AS name, permissions.object_id AS vm_guid, users_1.user_id AS user_id, users_1.surname AS surname, users_1.domain AS DOMAIN, users_1.username AS username, users_1.department AS department, roles1.name AS mla_role, users_1.email AS email, users_1.note AS note, users_1.vm_admin AS vm_admin, tags_user_map_view_1.tag_name AS tag_name, tags_user_map_view_1.tag_id AS tag_id, users_1.last_admin_check_status AS last_admin_check_status, pools.vm_pool_name AS vm_pool_name FROM vdc_users AS users_1 LEFT OUTER JOIN users_and_groups_to_vm_pool_map_view AS pools ON users_1.user_id = pools.user_id LEFT OUTER JOIN permissions ON users_1.user_id = permissions.ad_element_id LEFT OUTER JOIN tags ON tags.type = 1 LEFT OUTER JOIN tags_user_map_view AS tags_user_map_view_1 ON users_1.user_id = tags_user_map_view_1.user_id LEFT OUTER JOIN roles AS roles1 ON roles1.id = permissions.role_id WHERE ( users_1.user_group = 'user' ) UNION SELECT users_2.user_group AS user_group, users_2.name AS name, permissions_1.object_id AS vm_guid, users_2.user_id AS user_id, users_2.surname AS surname, users_2.domain AS DOMAIN, users_2.username AS username, users_2.department AS department, roles2.name AS mla_role, users_2.email AS email, users_2.note AS note, users_2.vm_admin AS vm_admin, tags_user_group_map_view.tag_name AS tag_name, tags_user_group_map_view.tag_id AS tag_id, users_2.last_admin_check_status AS last_admin_check_status, pools1.vm_pool_name AS vm_pool_name FROM vdc_users AS users_2 LEFT OUTER JOIN users_and_groups_to_vm_pool_map_view AS pools1 ON users_2.user_id = pools1.user_id LEFT OUTER JOIN permissions AS permissions_1 ON users_2.user_id = permissions_1.ad_element_id LEFT OUTER JOIN tags AS tags_1 ON tags_1.type = 1 LEFT OUTER JOIN tags_user_group_map_view ON users_2.user_id = tags_user_group_map_view.group_id LEFT OUTER JOIN roles AS roles2 ON roles2.id = permissions_1.role_id WHERE ( users_2.user_group = 'group' ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_pools_view AS SELECT vm_pools.vm_pool_id, vm_pools.vm_pool_name, vm_pools.vm_pool_description, vm_pools.vm_pool_comment, vm_pools.vm_pool_type, vm_pools.parameters, vm_pools.prestarted_vms, vm_pools.vds_group_id, vds_groups.name AS vds_group_name, vds_groups.architecture AS architecture, storage_pool.name AS storage_pool_name, storage_pool.id AS storage_pool_id, vm_pools.max_assigned_vms_per_user AS max_assigned_vms_per_user, vm_pools.spice_proxy AS spice_proxy, vm_pools.is_being_destroyed AS is_being_destroyed FROM vm_pools JOIN vds_groups ON vm_pools.vds_group_id = vds_groups.vds_group_id LEFT JOIN storage_pool ON storage_pool.id = vds_groups.storage_pool_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_pools_full_view AS SELECT vmp.vm_pool_id, vmp.vm_pool_name, vmp.vm_pool_description, vmp.vm_pool_comment, vmp.vm_pool_type, vmp.parameters, vmp.prestarted_vms, vmp.vds_group_id, vmp.vds_group_name, vmp.architecture, vmp.max_assigned_vms_per_user, vmp.spice_proxy AS spice_proxy, ( SELECT COUNT ( vm_pool_map.vm_pool_id ) AS expr1 FROM vm_pools_view v1 LEFT JOIN vm_pool_map ON v1.vm_pool_id = vm_pool_map.vm_pool_id AND v1.vm_pool_id = vmp.vm_pool_id ) AS assigned_vm_count, ( SELECT COUNT ( v2.vm_pool_id ) AS expr1 FROM vm_pools v2 LEFT JOIN vm_pool_map vm_pool_map_1 ON v2.vm_pool_id = vm_pool_map_1.vm_pool_id AND v2.vm_pool_id = vmp.vm_pool_id LEFT JOIN vm_dynamic ON vm_pool_map_1.vm_guid = vm_dynamic.vm_guid WHERE vm_dynamic.status <> ALL ( ARRAY [ 0, 15 ] ) GROUP BY v2.vm_pool_id ) AS vm_running_count, vmp.storage_pool_name, vmp.storage_pool_id, vmp.is_being_destroyed FROM vm_pools_view vmp; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW permissions_view AS SELECT permissions.id AS id, permissions.role_id AS role_id, permissions.ad_element_id AS ad_element_id, permissions.object_id AS object_id, permissions.object_type_id AS object_type_id, roles.name AS role_name, roles.role_type AS role_type, roles.allows_viewing_children AS allows_viewing_children, roles.app_mode AS app_mode, fn_get_entity_name ( permissions.object_id, permissions.object_type_id ) AS object_name, ( fn_authz_entry_info ( permissions.ad_element_id ) ) .name AS owner_name, ( fn_authz_entry_info ( permissions.ad_element_id ) ) .namespace AS namespace, ( fn_authz_entry_info ( permissions.ad_element_id ) ) .authz AS authz, permissions.creation_date AS creation_date FROM permissions INNER JOIN roles ON permissions.role_id = roles.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW internal_permissions_view AS SELECT permissions.id AS id, permissions.role_id AS role_id, permissions.ad_element_id AS ad_element_id, permissions.object_id AS object_id, permissions.object_type_id AS object_type_id, roles.name AS role_name, roles.role_type AS role_type, roles.allows_viewing_children AS allows_viewing_children FROM permissions INNER JOIN roles ON permissions.role_id = roles.id; ************************** CREATE VIEW ********* QUERY ********** /************************************************* vds/vm/ interface view *************************************************/ CREATE OR REPLACE VIEW vds_interface_view AS SELECT vds_interface_statistics.rx_rate, vds_interface_statistics.tx_rate, vds_interface_statistics.rx_drop, vds_interface_statistics.tx_drop, vds_interface_statistics.rx_total, vds_interface_statistics.tx_total, vds_interface_statistics.rx_offset, vds_interface_statistics.tx_offset, vds_interface_statistics.iface_status, vds_interface_statistics.sample_time, vds_interface.type, vds_interface.gateway, vds_interface.subnet, vds_interface.addr, vds_interface.speed, vds_interface.base_interface, vds_interface.vlan_id, vds_interface.bond_type, vds_interface.bond_name, vds_interface.is_bond, vds_interface.bond_opts, vds_interface.mac_addr, vds_interface.network_name, vds_interface.name, vds_static.vds_id, vds_static.vds_name, vds_interface.id, vds_interface.boot_protocol, vds_interface.mtu AS mtu, vds_interface.bridged, 1 AS is_vds, vds_interface.qos_overridden AS qos_overridden, vds_interface.labels AS labels, vds_static.vds_group_id AS vds_group_id FROM vds_interface_statistics JOIN vds_interface ON vds_interface_statistics.id = vds_interface.id JOIN vds_static ON vds_interface.vds_id = vds_static.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_interface_view AS SELECT vm_interface_statistics.rx_rate, vm_interface_statistics.tx_rate, vm_interface_statistics.rx_drop, vm_interface_statistics.tx_drop, vm_interface_statistics.rx_total, vm_interface_statistics.tx_total, vm_interface_statistics.rx_offset, vm_interface_statistics.tx_offset, vm_interface_statistics.iface_status, vm_interface_statistics.sample_time, vm_interface.type, vm_interface.speed, vm_interface.mac_addr, network.name AS network_name, vm_interface.name, vm_interface.vnic_profile_id, vm_static.vm_guid, vm_interface.vmt_guid, vm_static.vm_name, vm_interface.id, 0 AS boot_protocol, 0 AS is_vds, vm_device.is_plugged, vm_device.custom_properties, vnic_profiles.port_mirroring AS port_mirroring, vm_interface.linked, vm_static.vds_group_id AS vds_group_id, vm_static.entity_type AS vm_entity_type, vnic_profiles.name AS vnic_profile_name, qos.name AS qos_name FROM vm_interface_statistics JOIN vm_interface ON vm_interface_statistics.id = vm_interface.id JOIN vm_static ON vm_interface.vm_guid = vm_static.vm_guid JOIN vm_device ON vm_interface.vm_guid = vm_device.vm_id AND vm_interface.id = vm_device.device_id LEFT JOIN ( ( vnic_profiles JOIN network ON network.id = vnic_profiles.network_id ) LEFT JOIN qos ON vnic_profiles.network_qos_id = qos.id ) ON vnic_profiles.id = vm_interface.vnic_profile_id UNION SELECT vm_interface_statistics.rx_rate, vm_interface_statistics.tx_rate, vm_interface_statistics.rx_drop, vm_interface_statistics.tx_drop, vm_interface_statistics.rx_total, vm_interface_statistics.tx_total, vm_interface_statistics.rx_offset, vm_interface_statistics.tx_offset, vm_interface_statistics.iface_status, vm_interface_statistics.sample_time, vm_interface.type, vm_interface.speed, vm_interface.mac_addr, network.name AS network_name, vm_interface.name, vm_interface.vnic_profile_id, NULL::uuid AS vm_guid, vm_interface.vmt_guid, vm_templates.vm_name AS vm_name, vm_interface.id, 0 AS boot_protocol, 0 AS is_vds, vm_device.is_plugged AS is_plugged, vm_device.custom_properties AS custom_properties, vnic_profiles.port_mirroring AS port_mirroring, vm_interface.linked, vm_templates.vds_group_id AS vds_group_id, vm_templates.entity_type AS vm_entity_type, vnic_profiles.name AS vnic_profile_name, qos.name AS qos_name FROM vm_interface_statistics RIGHT JOIN vm_interface ON vm_interface_statistics.id = vm_interface.id JOIN vm_static AS vm_templates ON vm_interface.vmt_guid = vm_templates.vm_guid JOIN vm_device ON vm_interface.vmt_guid = vm_device.vm_id AND vm_interface.id = vm_device.device_id LEFT JOIN ( ( vnic_profiles JOIN network ON network.id = vnic_profiles.network_id ) LEFT JOIN qos ON vnic_profiles.network_qos_id = qos.id ) ON vnic_profiles.id = vm_interface.vnic_profile_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_pool_with_storage_domain AS SELECT storage_pool.id AS id, storage_pool.name AS name, storage_pool.description AS description, storage_pool.free_text_comment AS free_text_comment, storage_pool.status AS status, storage_pool.is_local AS is_local, storage_pool.master_domain_version AS master_domain_version, storage_pool.spm_vds_id AS spm_vds_id, storage_pool.compatibility_version AS compatibility_version, storage_pool._create_date AS _create_date, storage_pool._update_date AS _update_date, storage_pool_iso_map.storage_id AS storage_id, storage_pool_iso_map.storage_pool_id AS storage_pool_id, storage_domain_static.storage_type AS storage_type, storage_domain_static.storage_domain_type AS storage_domain_type, storage_domain_static.storage_domain_format_type AS storage_domain_format_type, storage_domain_static.storage_name AS storage_name, storage_domain_static.storage AS storage, storage_domain_static.last_time_used_as_master AS last_time_used_as_master FROM storage_pool LEFT OUTER JOIN storage_pool_iso_map ON storage_pool.id = storage_pool_iso_map.storage_pool_id LEFT OUTER JOIN storage_domain_static ON storage_pool_iso_map.storage_id = storage_domain_static.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vds_groups_storage_domain AS SELECT vds_groups.vds_group_id, vds_groups.name, vds_groups.description, vds_groups.free_text_comment, vds_groups.cpu_name, vds_groups._create_date, vds_groups._update_date, vds_groups.storage_pool_id, vds_groups.max_vds_memory_over_commit, vds_groups.count_threads_as_cores, vds_groups.compatibility_version, vds_groups.transparent_hugepages, vds_groups.migrate_on_error, vds_groups.architecture, storage_pool_iso_map.storage_id, storage_pool.name AS storage_pool_name FROM vds_groups LEFT JOIN storage_pool_iso_map ON vds_groups.storage_pool_id = storage_pool_iso_map.storage_pool_id LEFT JOIN storage_pool ON vds_groups.storage_pool_id = storage_pool.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vds_groups_view AS SELECT vds_groups.*, storage_pool.name AS storage_pool_name, cluster_policies.name AS cluster_policy_name FROM vds_groups LEFT JOIN storage_pool ON vds_groups.storage_pool_id = storage_pool.id LEFT JOIN cluster_policies ON vds_groups.cluster_policy_id = cluster_policies.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW storage_domains_with_hosts_view AS SELECT storage_domain_static.id, storage_domain_static.storage, storage_domain_static.storage_name, storage_domain_static.storage_description AS storage_description, storage_domain_static.storage_comment AS storage_comment, storage_domain_dynamic.available_disk_size, storage_domain_dynamic.used_disk_size, fn_get_disk_commited_value_by_storage ( storage_domain_static.id ) AS commited_disk_size, fn_get_actual_images_size_by_storage ( storage_domain_static.id ) AS actual_images_size, storage_pool.name AS storage_pool_name, storage_domain_static.storage_type, storage_domain_static.storage_domain_type, storage_domain_static.storage_domain_format_type, storage_domain_static.last_time_used_as_master AS last_time_used_as_master, storage_domain_static.wipe_after_delete AS wipe_after_delete, fn_get_storage_domain_shared_status_by_domain_id ( storage_domain_static.id, storage_pool_iso_map.status, storage_domain_static.storage_domain_type ) AS storage_domain_shared_status, vds_groups.vds_group_id, vds_static.vds_id, storage_pool_iso_map.storage_pool_id, vds_static.recoverable FROM storage_domain_static INNER JOIN storage_domain_dynamic ON storage_domain_static.id = storage_domain_dynamic.id LEFT OUTER JOIN storage_pool_iso_map ON storage_domain_static.id = storage_pool_iso_map.storage_id LEFT OUTER JOIN storage_pool ON storage_pool_iso_map.storage_pool_id = storage_pool.id LEFT OUTER JOIN vds_groups ON storage_pool_iso_map.storage_pool_id = vds_groups.storage_pool_id LEFT OUTER JOIN vds_static ON vds_groups.vds_group_id = vds_static.vds_group_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_images_storage_domains_view AS SELECT vm_images_view.storage_id, vm_images_view.storage_path, vm_images_view.storage_pool_id, vm_images_view.image_guid, vm_images_view.creation_date, vm_images_view.actual_size, vm_images_view.read_rate, vm_images_view.write_rate, vm_images_view.size, vm_images_view.it_guid, vm_images_view.description, vm_images_view.parentid, vm_images_view.imagestatus, vm_images_view.lastmodified, vm_images_view.app_list, vm_images_view.vm_snapshot_id, vm_images_view.volume_type, vm_images_view.image_group_id, vm_images_view.active, vm_images_view.volume_format, vm_images_view.disk_interface, vm_images_view.boot, vm_images_view.wipe_after_delete, vm_images_view.propagate_errors, vm_images_view.entity_type, vm_images_view.number_of_vms, vm_images_view.vm_names, vm_images_view.quota_id, vm_images_view.quota_name, vm_images_view.disk_profile_id, vm_images_view.disk_profile_name, vm_images_view.disk_alias, vm_images_view.disk_description, vm_images_view.sgio, storage_domains_with_hosts_view.id, storage_domains_with_hosts_view.storage, storage_domains_with_hosts_view.storage_name, storage_domains_with_hosts_view.available_disk_size, storage_domains_with_hosts_view.used_disk_size, storage_domains_with_hosts_view.commited_disk_size, storage_domains_with_hosts_view.actual_images_size, storage_domains_with_hosts_view.storage_type, storage_domains_with_hosts_view.storage_domain_type, storage_domains_with_hosts_view.storage_domain_format_type, storage_domains_with_hosts_view.storage_domain_shared_status, storage_domains_with_hosts_view.vds_group_id, storage_domains_with_hosts_view.vds_id, storage_domains_with_hosts_view.recoverable, storage_domains_with_hosts_view.storage_pool_name, storage_domains_with_hosts_view.storage_name AS name FROM vm_images_view INNER JOIN images_storage_domain_view ON vm_images_view.image_guid = images_storage_domain_view.image_guid INNER JOIN storage_domains_with_hosts_view ON storage_domains_with_hosts_view.id = images_storage_domain_view.storage_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW quota_view AS SELECT q.id AS quota_id, q.storage_pool_id AS storage_pool_id, storage_pool.name AS storage_pool_name, q.quota_name AS quota_name, q.description AS description, q.threshold_vds_group_percentage AS threshold_vds_group_percentage, q.threshold_storage_percentage AS threshold_storage_percentage, q.grace_vds_group_percentage AS grace_vds_group_percentage, q.grace_storage_percentage AS grace_storage_percentage, storage_pool.quota_enforcement_type AS quota_enforcement_type FROM storage_pool, quota q WHERE storage_pool.id = q.storage_pool_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW quota_global_view AS SELECT q_limit.quota_id AS quota_id, q.storage_pool_id AS storage_pool_id, storage_pool.name AS storage_pool_name, q.quota_name AS quota_name, q.description AS description, q.threshold_vds_group_percentage AS threshold_vds_group_percentage, q.threshold_storage_percentage AS threshold_storage_percentage, q.grace_vds_group_percentage AS grace_vds_group_percentage, q.grace_storage_percentage AS grace_storage_percentage, virtual_cpu, ( CalculateVdsGroupUsage ( quota_id, NULL ) ) .virtual_cpu_usage, mem_size_mb, ( CalculateVdsGroupUsage ( quota_id, NULL ) ) .mem_size_mb_usage, storage_size_gb, CalculateStorageUsage ( quota_id, NULL ) AS storage_size_gb_usage, storage_pool.quota_enforcement_type AS quota_enforcement_type FROM storage_pool, quota q LEFT OUTER JOIN quota_limitation q_limit ON q_limit.quota_id = q.id WHERE storage_pool.id = q.storage_pool_id AND q_limit.vds_group_id IS NULL AND q_limit.storage_id IS NULL; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW quota_limitations_view AS SELECT q_limit.quota_id AS quota_id, q.storage_pool_id AS storage_pool_id, storage_pool.name AS storage_pool_name, q.quota_name AS quota_name, q.description AS description, q.threshold_vds_group_percentage AS threshold_vds_group_percentage, q.threshold_storage_percentage AS threshold_storage_percentage, q.grace_vds_group_percentage AS grace_vds_group_percentage, q.grace_storage_percentage AS grace_storage_percentage, virtual_cpu, mem_size_mb, storage_size_gb, storage_pool.quota_enforcement_type AS quota_enforcement_type, vds_group_id, storage_id, ( COALESCE ( vds_group_id, storage_id ) IS NULL ) AS is_global, ( COALESCE ( virtual_cpu, mem_size_mb, storage_size_gb ) IS NULL ) AS is_empty FROM quota q INNER JOIN storage_pool ON storage_pool.id = q.storage_pool_id LEFT OUTER JOIN quota_limitation q_limit ON q_limit.quota_id = q.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW quota_storage_view AS SELECT q_limit.id AS quota_storage_id, q_limit.quota_id AS quota_id, storage_id, storage_domain_static.storage_name AS storage_name, storage_size_gb, CalculateStorageUsage ( quota_id, storage_id ) AS storage_size_gb_usage FROM quota_limitation q_limit, quota q, storage_domain_static WHERE q_limit.quota_id = q.id AND q_limit.vds_group_id IS NULL AND q_limit.storage_id IS NOT NULL AND storage_domain_static.id = q_limit.storage_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW quota_vds_group_view AS SELECT q_limit.id AS quota_vds_group_id, q_limit.quota_id AS quota_id, q_limit.vds_group_id, vds_groups.name AS vds_group_name, virtual_cpu, ( CalculateVdsGroupUsage ( quota_id, q_limit.vds_group_id ) ) .virtual_cpu_usage AS virtual_cpu_usage, mem_size_mb, ( CalculateVdsGroupUsage ( quota_id, q_limit.vds_group_id ) ) .mem_size_mb_usage AS mem_size_mb_usage FROM quota_limitation q_limit, quota q, vds_groups WHERE q_limit.quota_id = q.id AND q_limit.vds_group_id IS NOT NULL AND q_limit.storage_id IS NULL AND vds_groups.vds_group_id = q_limit.vds_group_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW network_cluster_view AS SELECT network_cluster.cluster_id AS cluster_id, network_cluster.network_id AS network_id, network.name AS network_name, network_cluster.status AS status, network_cluster.required AS required, network_cluster.is_display AS is_display, network_cluster.migration AS migration, vds_groups.name AS cluster_name FROM network_cluster INNER JOIN network ON network_cluster.network_id = network.id INNER JOIN vds_groups ON network_cluster.cluster_id = vds_groups.vds_group_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW network_vds_view AS SELECT network.id AS network_id, network.name AS network_name, vds_static.vds_name AS vds_name FROM vds_interface INNER JOIN vds_static ON vds_interface.vds_id = vds_static.vds_id INNER JOIN network ON vds_interface.network_name = network.name INNER JOIN network_cluster ON network_cluster.network_id = network.id WHERE network_cluster.cluster_id = vds_static.vds_group_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW network_view AS SELECT network.id AS id, network.name AS name, network.description AS description, network.free_text_comment AS free_text_comment, network.type AS type, network.addr AS addr, network.subnet AS subnet, network.gateway AS gateway, network.vlan_id AS vlan_id, network.stp AS stp, network.mtu AS mtu, network.vm_network AS vm_network, network.storage_pool_id AS storage_pool_id, network.provider_network_provider_id AS provider_network_provider_id, network.provider_network_external_id AS provider_network_external_id, network.qos_id AS qos_id, network.label AS label, storage_pool.name AS storage_pool_name, storage_pool.compatibility_version AS compatibility_version, providers.name AS provider_name, qos.name AS qos_name FROM network INNER JOIN storage_pool ON network.storage_pool_id = storage_pool.id LEFT JOIN providers ON network.provider_network_provider_id = providers.id LEFT JOIN qos ON qos.id = network.qos_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vnic_profiles_view AS SELECT vnic_profiles.id AS id, vnic_profiles.name AS name, vnic_profiles.network_id AS network_id, vnic_profiles.network_qos_id AS network_qos_id, vnic_profiles.port_mirroring AS port_mirroring, vnic_profiles.passthrough as passthrough, vnic_profiles.custom_properties AS custom_properties, vnic_profiles.description AS description, network.name AS network_name, qos.name AS network_qos_name, storage_pool.name AS data_center_name, storage_pool.compatibility_version AS compatibility_version, storage_pool.id AS data_center_id FROM vnic_profiles INNER JOIN network ON vnic_profiles.network_id = network.id LEFT JOIN qos ON vnic_profiles.network_qos_id = qos.id INNER JOIN storage_pool ON network.storage_pool_id = storage_pool.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW engine_session_user_flat_groups AS SELECT id AS engine_session_seq_id, user_id AS user_id, fnSplitterUuid ( engine_sessions.group_ids ) AS granted_id FROM engine_sessions UNION ALL SELECT id, user_id, user_id FROM engine_sessions UNION ALL SELECT id, user_id, 'EEE00000-0000-0000-0000-123456789EEE' FROM engine_sessions; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vds_groups_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 9 AND role_type = 2 UNION ALL SELECT DISTINCT vds_group_id, ad_element_id FROM vm_static INNER JOIN internal_permissions_view ON object_id = vm_guid AND ( object_type_id = 2 OR object_type_id = 4 ) AND role_type = 2 AND vds_group_id IS NOT NULL UNION ALL SELECT vds_group_id, ad_element_id FROM vds_groups INNER JOIN internal_permissions_view ON object_id = vds_groups.storage_pool_id AND object_type_id = 14 AND role_type = 2 UNION ALL SELECT vds_group_id, ad_element_id FROM internal_permissions_view CROSS JOIN vds_groups WHERE object_type_id = 1 AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vds_groups_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_vds_groups_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_storage_pool_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 14 AND role_type = 2 UNION ALL SELECT storage_pool_id, ad_element_id FROM vds_groups INNER JOIN internal_permissions_view ON object_id = vds_groups.vds_group_id AND object_type_id = 9 AND role_type = 2 UNION ALL SELECT storage_pool_id, ad_element_id FROM vds_groups INNER JOIN vm_pools ON vds_groups.vds_group_id = vm_pools.vds_group_id INNER JOIN internal_permissions_view ON object_id = vm_pools.vm_pool_id AND object_type_id = 5 AND role_type = 2 UNION ALL SELECT storage_pool_id, ad_element_id FROM vm_static INNER JOIN vds_groups ON vds_groups.vds_group_id = vm_static.vds_group_id INNER JOIN internal_permissions_view ON object_id = vm_guid AND object_type_id = 2 AND role_type = 2 UNION ALL SELECT storage_pool.id, ad_element_id FROM internal_permissions_view CROSS JOIN storage_pool WHERE object_type_id = 1 AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_storage_pool_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_storage_pool_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_storage_domain_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 11 AND role_type = 2 UNION ALL SELECT storage_domains.id, ad_element_id FROM storage_domains INNER JOIN vds_groups ON vds_groups.storage_pool_id = storage_domains.storage_pool_id INNER JOIN vm_static ON vds_groups.vds_group_id = vm_static.vds_group_id INNER JOIN internal_permissions_view ON object_id = vm_static.vm_guid AND object_type_id = 2 AND role_type = 2 UNION ALL SELECT storage_id, ad_element_id FROM vm_templates_storage_domain INNER JOIN internal_permissions_view ON vmt_guid = internal_permissions_view.object_id AND object_type_id = 4 AND role_type = 2 UNION ALL SELECT storage_id, ad_element_id FROM vm_static INNER JOIN vm_templates_storage_domain ON vm_static.vmt_guid = vm_templates_storage_domain.vmt_guid INNER JOIN internal_permissions_view ON vm_static.vm_guid = object_id AND objecT_type_id = 2 AND role_type = 2 UNION ALL SELECT storage_domains.id, ad_element_id FROM storage_domains INNER JOIN internal_permissions_view ON object_id = storage_domains.storage_pool_id AND object_type_id = 14 AND role_type = 2 UNION ALL SELECT storage_domains.id, ad_element_id FROM internal_permissions_view CROSS JOIN storage_domains WHERE object_type_id = 1 AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_storage_domain_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_storage_domain_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vds_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 3 AND role_type = 2 UNION ALL SELECT vds_id, ad_element_id FROM vds INNER JOIN internal_permissions_view ON ( object_id = vds_group_id AND object_type_id = 9 ) OR ( object_id = storage_pool_id AND object_type_id = 14 ) AND role_type = 2 UNION ALL SELECT vds_id, ad_element_id FROM internal_permissions_view CROSS JOIN vds WHERE object_type_id = 1 AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vds_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_vds_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vm_pool_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 5 AND role_type = 2 UNION ALL SELECT vm_pool_id, ad_element_id FROM vm_pool_map INNER JOIN internal_permissions_view ON object_id = vm_guid AND object_type_id = 2 AND role_type = 2 UNION ALL SELECT vm_pool_id, ad_element_id FROM vm_pools INNER JOIN internal_permissions_view ON object_id = vds_group_id AND object_type_id = 9 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT vm_pool_id, ad_element_id FROM vm_pools INNER JOIN vds_groups ON vm_pools.vds_group_id = vds_groups.vds_group_id INNER JOIN internal_permissions_view ON object_id = storage_pool_id AND object_type_id = 14 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT vm_pool_id, ad_element_id FROM internal_permissions_view CROSS JOIN vm_pools WHERE object_type_id = 1 AND allows_viewing_children AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vm_pool_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_vm_pool_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vm_template_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 4 AND role_type = 2 UNION ALL SELECT vmt_guid, ad_element_id FROM vm_static INNER JOIN internal_permissions_view ON object_id = vm_static.vm_guid AND object_type_id = 2 AND role_type = 2 UNION ALL SELECT vm_guid, ad_element_id FROM vm_static INNER JOIN vds_groups ON vds_groups.vds_group_id = vm_static.vds_group_id INNER JOIN internal_permissions_view ON object_id = storage_pool_id AND object_type_id = 14 AND allows_viewing_children AND role_type = 2 AND vm_static.entity_type ::text = 'TEMPLATE' ::text UNION ALL SELECT vm_guid, ad_element_id FROM internal_permissions_view CROSS JOIN vm_static WHERE object_type_id = 1 AND allows_viewing_children AND role_type = 2 AND ( vm_static.entity_type ::text = 'TEMPLATE' ::text OR vm_static.entity_type ::text = 'INSTANCE_TYPE' ::text OR vm_static.entity_type ::text = 'IMAGE_TYPE' ::text ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vm_template_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_vm_template_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vm_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 2 AND role_type = 2 UNION ALL SELECT vm_guid, ad_element_id FROM vm_static INNER JOIN internal_permissions_view ON object_id = vds_group_id AND object_type_id = 9 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT vm_guid, ad_element_id FROM vm_static INNER JOIN vds_groups ON vds_groups.vds_group_id = vm_static.vds_group_id INNER JOIN internal_permissions_view ON object_id = storage_pool_id AND object_type_id = 14 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT vm_guid, ad_element_id FROM internal_permissions_view CROSS JOIN vm_static WHERE object_type_id = 1 AND allows_viewing_children AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vm_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_vm_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_disk_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 19 AND role_type = 2 UNION ALL SELECT device_id, user_vm_permissions_view.user_id AS ad_element_id FROM vm_device INNER JOIN user_vm_permissions_view ON user_vm_permissions_view.entity_id = vm_device.vm_id WHERE vm_device.type = 'disk' AND vm_device.device = 'disk' UNION ALL SELECT device_id, user_vm_template_permissions_view.user_id AS ad_element_id FROM vm_device INNER JOIN user_vm_template_permissions_view ON user_vm_template_permissions_view.entity_id = vm_device.vm_id WHERE type = 'disk' AND device = 'disk' UNION ALL SELECT images.image_group_id, ad_element_id FROM image_storage_domain_map INNER JOIN images ON images.image_guid = image_storage_domain_map.image_id INNER JOIN internal_permissions_view ON object_id = storage_domain_id AND object_type_id = 11 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT images.image_group_id, ad_element_id FROM image_storage_domain_map INNER JOIN storage_pool_iso_map ON image_storage_domain_map.storage_domain_id = storage_pool_iso_map.storage_id INNER JOIN images ON images.image_guid = image_storage_domain_map.image_id INNER JOIN internal_permissions_view ON object_id = storage_pool_id AND object_type_id = 14 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT device_id, ad_element_id FROM internal_permissions_view CROSS JOIN vm_device WHERE object_type_id = 1 AND allows_viewing_children AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_disk_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_disk_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_permissions_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT id, user_id FROM internal_permissions_view JOIN engine_session_user_flat_groups ON granted_id = ad_element_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_object_permissions_view AS SELECT DISTINCT permissions.object_id AS entity_id, engine_session_user_flat_groups.user_id FROM permissions JOIN roles ON permissions.role_id = roles.id JOIN engine_session_user_flat_groups ON engine_session_user_flat_groups.granted_id = permissions.ad_element_id WHERE permissions.ad_element_id != getGlobalIds ( 'everyone' ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_db_users_permissions_view AS SELECT DISTINCT permissions.ad_element_id, roles_groups.role_id, roles_groups.action_group_id FROM permissions JOIN roles_groups ON permissions.role_id = roles_groups.role_id WHERE roles_groups.action_group_id = 502; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_device_view AS SELECT device_id, vm_id, type, device, address, boot_order, spec_params, is_managed, is_plugged, is_readonly, alias, custom_properties, snapshot_id, logical_name, is_using_scsi_reservation FROM vm_device; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vnic_profile_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 27 AND role_type = 2 UNION ALL SELECT vnic_profiles.id, ad_element_id FROM vnic_profiles INNER JOIN internal_permissions_view ON object_id = network_id WHERE object_type_id = 20 AND allows_viewing_children AND role_type = 2 UNION ALL SELECT vnic_profiles.id, ad_element_id FROM vnic_profiles INNER JOIN network ON network.id = network_id INNER JOIN internal_permissions_view ON object_id = network.storage_pool_id WHERE object_type_id = 14 AND role_type = 2 AND allows_viewing_children UNION ALL SELECT vnic_profiles.id, ad_element_id FROM vnic_profiles INNER JOIN network_cluster ON network_cluster.network_id = vnic_profiles.network_id INNER JOIN internal_permissions_view ON object_id = network_cluster.cluster_id WHERE object_type_id = 9 AND role_type = 2 AND allows_viewing_children UNION ALL SELECT DISTINCT vnic_profile_id, ad_element_id FROM vm_interface INNER JOIN internal_permissions_view ON object_id = vm_guid WHERE object_type_id = 2 AND role_type = 2 UNION ALL SELECT DISTINCT vnic_profile_id, ad_element_id FROM vm_interface INNER JOIN internal_permissions_view ON object_id = vmt_guid WHERE object_type_id = 4 AND role_type = 2 UNION ALL SELECT vnic_profiles.id, ad_element_id FROM internal_permissions_view CROSS JOIN vnic_profiles WHERE object_type_id = 1 AND allows_viewing_children AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_vnic_profile_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_vnic_profile_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_network_permissions_view_base ( entity_id, granted_id ) AS SELECT network.id, user_id FROM network INNER JOIN vnic_profiles ON network_id = network.id INNER JOIN user_vnic_profile_permissions_view ON entity_id = vnic_profiles.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_network_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_network_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_disk_profile_permissions_view_base ( entity_id, granted_id ) AS SELECT object_id, ad_element_id FROM internal_permissions_view WHERE object_type_id = 29 AND role_type = 2; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_disk_profile_permissions_view ( entity_id, user_id ) AS SELECT DISTINCT entity_id, user_id FROM user_disk_profile_permissions_view_base NATURAL JOIN engine_session_user_flat_groups; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_cpu_profile_permissions_view ( entity_id, user_id, role_id ) AS SELECT object_id, ad_element_id, role_id FROM internal_permissions_view WHERE object_type_id = 30 UNION ALL SELECT cpu_profiles.id, internal_permissions_view.ad_element_id, internal_permissions_view.role_id FROM cpu_profiles INNER JOIN internal_permissions_view ON object_id=cluster_id AND object_type_id = 9 UNION ALL SELECT cpu_profiles.id, internal_permissions_view.ad_element_id, internal_permissions_view.role_id FROM cpu_profiles INNER JOIN vds_groups ON vds_groups.vds_group_id=cpu_profiles.cluster_id INNER JOIN internal_permissions_view ON object_id=vds_groups.storage_pool_id AND object_type_id = 14 UNION ALL SELECT cpu_profiles.id, internal_permissions_view.ad_element_id, internal_permissions_view.role_id FROM cpu_profiles CROSS JOIN internal_permissions_view WHERE object_type_id = 1; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_volumes_view AS SELECT gluster_volumes.*, vds_groups.name AS vds_group_name, CASE WHEN EXISTS (SELECT session_id FROM gluster_georep_session WHERE master_volume_id = gluster_volumes.id) THEN true ELSE false END as is_master, (SELECT vol.vol_name || '|' || cluster.name FROM gluster_georep_session INNER JOIN gluster_volumes vol ON master_volume_id = vol.id INNER JOIN vds_groups cluster ON cluster.vds_group_id = vol.cluster_id WHERE slave_volume_id = gluster_volumes.id) as master_vol_cluster FROM gluster_volumes INNER JOIN vds_groups ON gluster_volumes.cluster_id = vds_groups.vds_group_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_volume_snapshots_view AS SELECT gluster_volume_snapshots.*, gluster_volumes.cluster_id AS cluster_id, gluster_volumes.vol_name AS volume_name FROM gluster_volume_snapshots INNER JOIN gluster_volumes ON gluster_volume_snapshots.volume_id = gluster_volumes.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_volume_snapshot_schedules_view AS SELECT gluster_volume_snapshot_schedules.*, gluster_volumes.cluster_id AS cluster_id FROM gluster_volume_snapshot_schedules INNER JOIN gluster_volumes ON gluster_volume_snapshot_schedules.volume_id = gluster_volumes.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_volume_bricks_view AS SELECT gluster_volume_bricks.*, vds_static.host_name AS vds_name, gluster_volumes.vol_name AS volume_name, vds_interface.addr as interface_address, gluster_volumes.cluster_id as cluster_id FROM gluster_volume_bricks INNER JOIN vds_static ON vds_static.vds_id = gluster_volume_bricks.server_id INNER JOIN gluster_volumes ON gluster_volumes.id = gluster_volume_bricks.volume_id LEFT OUTER JOIN network on network.id = gluster_volume_bricks.network_id LEFT OUTER JOIN vds_interface ON vds_interface.vds_id = gluster_volume_bricks.server_id AND vds_interface.network_name = network.name; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_volume_task_steps AS SELECT step.*, gluster_volumes.id AS volume_id, job.job_id AS job_job_id, job.action_type, job.description AS job_description, job.status AS job_status, job.start_time AS job_start_time, job.end_time AS job_end_time FROM gluster_volumes INNER JOIN job_subject_entity js ON js.entity_id = gluster_volumes.id INNER JOIN job ON job.job_id = js.job_id AND job.action_type IN ( 'StartRebalanceGlusterVolume', 'StartRemoveGlusterVolumeBricks' ) LEFT OUTER JOIN step ON step.external_id = gluster_volumes.task_id AND step.external_system_type = 'GLUSTER' AND step.job_id = js.job_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_server_services_view AS SELECT gluster_server_services.*, gluster_services.service_name, gluster_services.service_type, vds_static.vds_name FROM gluster_server_services INNER JOIN gluster_services ON gluster_server_services.service_id = gluster_services.id INNER JOIN vds_static ON gluster_server_services.server_id = vds_static.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_server_hooks_view AS SELECT gluster_server_hooks.*, vds_static.vds_name AS server_name FROM gluster_server_hooks INNER JOIN vds_static ON gluster_server_hooks.server_id = vds_static.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_georep_sessions_view AS SELECT session_id, master_volume_id, session_key, slave_host_uuid, slave_host_name, slave_volume_id, slave_volume_name, georep.status, georep._create_date, georep._update_date, gluster_volumes.vol_name AS master_volume_name, gluster_volumes.cluster_id AS cluster_id, georep.user_name FROM gluster_georep_session georep INNER JOIN gluster_volumes ON gluster_volumes.id = georep.master_volume_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW gluster_geo_rep_config_view AS SELECT session_id, georepConfig.config_key, config_value, config_description, config_possible_values, _update_date FROM gluster_georep_config georepConfig LEFT OUTER JOIN gluster_config_master ON gluster_config_master.config_key = georepConfig.config_key AND gluster_config_master.config_feature='geo_replication'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW supported_cluster_features_view AS SELECT cluster_features.*, supported_cluster_features.cluster_id, supported_cluster_features.is_enabled FROM cluster_features INNER JOIN supported_cluster_features ON supported_cluster_features.feature_id = cluster_features.feature_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW affinity_groups_view AS SELECT affinity_groups.*, array_to_string ( array_agg ( affinity_group_members.vm_id ) , ',' ) AS vm_ids, array_to_string ( array_agg ( vm_static.vm_name ) , ',' ) AS vm_names FROM affinity_groups LEFT JOIN affinity_group_members ON affinity_group_members.affinity_group_id = affinity_groups.id LEFT JOIN vm_static ON vm_static.vm_guid = affinity_group_members.vm_id GROUP BY affinity_groups.id, affinity_groups.name, affinity_groups.description, affinity_groups.cluster_id, affinity_groups.positive, affinity_groups.enforcing, affinity_groups._create_date, affinity_groups._update_date; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW numa_node_cpus_view AS SELECT numa_node.numa_node_id, numa_node.vds_id, numa_node.vm_id, numa_node_cpu_map.cpu_core_id FROM numa_node INNER JOIN numa_node_cpu_map ON numa_node.numa_node_id = numa_node_cpu_map.numa_node_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW numa_node_assignment_view AS SELECT vm_vds_numa_node_map.vm_numa_node_id AS assigned_vm_numa_node_id, vm_vds_numa_node_map.is_pinned AS is_pinned, vm_vds_numa_node_map.vds_numa_node_index AS last_run_in_vds_numa_node_index, vm_numa_node.vm_id AS vm_numa_node_vm_id, vm_numa_node.numa_node_index AS vm_numa_node_index, vm_numa_node.mem_total AS vm_numa_node_mem_total, vm_numa_node.cpu_count AS vm_numa_node_cpu_count, vm_numa_node.mem_free AS vm_numa_node_mem_free, vm_numa_node.usage_mem_percent AS vm_numa_node_usage_mem_percent, vm_numa_node.cpu_sys AS vm_numa_node_cpu_sys, vm_numa_node.cpu_user AS vm_numa_node_cpu_user, vm_numa_node.cpu_idle AS vm_numa_node_cpu_idle, vm_numa_node.usage_cpu_percent AS vm_numa_node_usage_cpu_percent, vm_numa_node.distance AS vm_numa_node_distance, run_in_vds_numa_node.numa_node_id AS run_in_vds_numa_node_id, run_in_vds_numa_node.vds_id AS run_in_vds_id, run_in_vds_numa_node.numa_node_index AS run_in_vds_numa_node_index, run_in_vds_numa_node.mem_total AS run_in_vds_numa_node_mem_total, run_in_vds_numa_node.cpu_count AS run_in_vds_numa_node_cpu_count, run_in_vds_numa_node.mem_free AS run_in_vds_numa_node_mem_free, run_in_vds_numa_node.usage_mem_percent AS run_in_vds_numa_node_usage_mem_percent, run_in_vds_numa_node.cpu_sys AS run_in_vds_numa_node_cpu_sys, run_in_vds_numa_node.cpu_user AS run_in_vds_numa_node_cpu_user, run_in_vds_numa_node.cpu_idle AS run_in_vds_numa_node_cpu_idle, run_in_vds_numa_node.usage_cpu_percent AS run_in_vds_numa_node_usage_cpu_percent, run_in_vds_numa_node.distance AS run_in_vds_numa_node_distance FROM vm_vds_numa_node_map LEFT OUTER JOIN numa_node AS vm_numa_node ON vm_vds_numa_node_map.vm_numa_node_id = vm_numa_node.numa_node_id LEFT OUTER JOIN numa_node AS run_in_vds_numa_node ON vm_vds_numa_node_map.vds_numa_node_id = run_in_vds_numa_node.numa_node_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW numa_node_with_vds_group_view AS SELECT vm_numa_node.numa_node_id AS vm_numa_node_id, vm_numa_node.vm_id AS vm_numa_node_vm_id, vm_numa_node.numa_node_index AS vm_numa_node_index, vm_numa_node.mem_total AS vm_numa_node_mem_total, vm_numa_node.cpu_count AS vm_numa_node_cpu_count, vm_numa_node.mem_free AS vm_numa_node_mem_free, vm_numa_node.usage_mem_percent AS vm_numa_node_usage_mem_percent, vm_numa_node.cpu_sys AS vm_numa_node_cpu_sys, vm_numa_node.cpu_user AS vm_numa_node_cpu_user, vm_numa_node.cpu_idle AS vm_numa_node_cpu_idle, vm_numa_node.usage_cpu_percent AS vm_numa_node_usage_cpu_percent, vm_numa_node.distance AS vm_numa_node_distance, vm_static.vds_group_id FROM numa_node AS vm_numa_node LEFT OUTER JOIN vm_static ON vm_numa_node.vm_id = vm_static.vm_guid; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_host_pinning_view AS SELECT host.vds_name, vm.vm_name, vm_vds.* FROM vm_host_pinning_map AS vm_vds INNER JOIN vm_static AS vm ON vm_vds.vm_id = vm.vm_guid INNER JOIN vds_static AS host ON vm_vds.vds_id = host.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW host_device_view AS SELECT host_device.*, NULL::UUID AS configured_vm_id, NULL::VARCHAR AS spec_params, (SELECT array_to_string(array_agg(vm_host_pinning_view.vm_name), ',') FROM vm_device INNER JOIN vm_host_pinning_view ON vm_device.vm_id = vm_host_pinning_view.vm_id WHERE vm_device.device = host_device.device_name AND vm_host_pinning_view.vds_id = host_device.host_id) AS attached_vm_names, (SELECT vm_name FROM vm_static WHERE vm_static.vm_guid = host_device.vm_id) AS running_vm_name FROM host_device; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW vm_host_device_view AS SELECT host_device.*, vm_device.vm_id AS configured_vm_id, vm_device.spec_params AS spec_params, array_to_string(array_agg(vm_host_pinning_view.vm_name) OVER (PARTITION BY host_id, device_name), ',') AS attached_vm_names, (SELECT vm_name FROM vm_static WHERE vm_static.vm_guid = host_device.vm_id) AS running_vm_name FROM vm_device INNER JOIN vm_host_pinning_view ON vm_device.vm_id = vm_host_pinning_view.vm_id INNER JOIN host_device ON host_device.device_name = vm_device.device AND vm_host_pinning_view.vds_id = host_device.host_id WHERE vm_device.type = 'hostdev'; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW user_profiles_view AS SELECT user_profiles.*, users.username || '@' || users.domain AS login_name FROM user_profiles INNER JOIN users ON user_profiles.user_id = users.user_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW qos_for_vm_view AS SELECT qos.*, vm_static.vm_guid AS vm_id FROM qos INNER JOIN cpu_profiles ON qos.id = cpu_profiles.qos_id INNER JOIN vm_static ON vm_static.cpu_profile_id = cpu_profiles.id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW qos_for_disk_profile_view AS SELECT qos.*, disk_profiles.id AS disk_profile_id FROM qos INNER JOIN disk_profiles ON qos.id = disk_profiles.qos_id ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_datacenter_configuration_history_view AS SELECT id AS datacenter_id, name AS datacenter_name, description AS datacenter_description, is_local AS is_local_storage, _create_date AS create_date, _update_date AS update_date FROM storage_pool WHERE ( _create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( _update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_datacenter_history_view AS SELECT id AS datacenter_id, CAST ( status AS SMALLINT ) AS datacenter_status FROM storage_pool; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_storage_domain_configuration_history_view AS SELECT id AS storage_domain_id, storage_name AS storage_domain_name, CAST ( storage_domain_type AS SMALLINT ) AS storage_domain_type, CAST ( storage_type AS SMALLINT ) AS storage_type, _create_date AS create_date, _update_date AS update_date FROM storage_domain_static WHERE ( _create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( _update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_datacenter_storage_map_history_view AS SELECT DISTINCT storage_pool_id AS datacenter_id, storage_id AS storage_domain_id FROM storage_pool_iso_map; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_storage_domain_history_view AS SELECT storage_domain_dynamic.id AS storage_domain_id, fn_get_storage_domain_shared_status_by_domain_id ( storage_domain_static.id, status_table.status, storage_domain_static.storage_domain_type ) AS storage_domain_status, storage_domain_dynamic.available_disk_size AS available_disk_size_gb, storage_domain_dynamic.used_disk_size AS used_disk_size_gb FROM storage_domain_dynamic INNER JOIN storage_domain_static ON ( storage_domain_dynamic.id = storage_domain_static.id ) LEFT OUTER JOIN ( SELECT storage_id, MAX ( status ) AS status FROM storage_pool_iso_map GROUP BY storage_id ) AS status_table ON storage_domain_static.id = status_table.storage_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_cluster_configuration_history_view AS SELECT vds_group_id AS cluster_id, name AS cluster_name, description AS cluster_description, storage_pool_id AS datacenter_id, cpu_name, compatibility_version, _create_date AS create_date, _update_date AS update_date FROM vds_groups WHERE ( _create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( _update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_host_configuration_history_view AS SELECT a.vds_id AS host_id, a.vds_unique_id AS host_unique_id, a.vds_name AS host_name, a.vds_group_id AS cluster_id, CAST ( a.vds_type AS SMALLINT ) AS host_type, a.host_name AS fqdn_or_ip, b.physical_mem_mb AS memory_size_mb, CAST ( c.swap_total AS INT ) AS swap_size_mb, b.cpu_model, CAST ( b.cpu_cores AS SMALLINT ) AS number_of_cores, CAST ( b.cpu_sockets AS SMALLINT ) AS number_of_sockets, b.cpu_speed_mh, b.host_os, b.kernel_version, b.kvm_version, b.libvirt_version, b.software_version AS vdsm_version, a.port AS vdsm_port, CAST ( b.cpu_threads AS SMALLINT ) AS threads_per_core, b.hw_manufacturer AS hardware_manufacturer, b.hw_product_name AS hardware_product_name, b.hw_version AS hardware_version, b.hw_serial_number AS hardware_serial_number, a._create_date AS create_date, a._update_date AS update_date FROM vds_static AS a INNER JOIN vds_dynamic AS b ON a.vds_id = b.vds_id INNER JOIN vds_statistics AS c ON c.vds_id = a.vds_id WHERE ( a._create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( a._update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_host_configuration_full_check_view AS SELECT a.vds_id AS host_id, a.vds_unique_id AS host_unique_id, a.vds_name AS host_name, a.vds_group_id AS cluster_id, CAST ( a.vds_type AS SMALLINT ) AS host_type, a.host_name AS fqdn_or_ip, b.physical_mem_mb AS memory_size_mb, CAST ( c.swap_total AS INT ) AS swap_size_mb, b.cpu_model, CAST ( b.cpu_cores AS SMALLINT ) AS number_of_cores, CAST ( b.cpu_sockets AS SMALLINT ) AS number_of_sockets, b.cpu_speed_mh, b.host_os, b.kernel_version, b.kvm_version, b.libvirt_version, CASE SUBSTR ( b.software_version, 1, 3 ) WHEN '4.4' THEN '2.1' || SUBSTR ( b.software_version, 4, LENGTH ( b.software_version ) ) WHEN '4.5' THEN '2.2' || SUBSTR ( b.software_version, 4, LENGTH ( b.software_version ) ) WHEN '4.9' THEN '2.3' || SUBSTR ( b.software_version, 4, LENGTH ( b.software_version ) ) ELSE b.software_version END AS vdsm_version, a.port AS vdsm_port, CAST ( b.cpu_threads AS SMALLINT ) AS threads_per_core, b.hw_manufacturer AS hardware_manufacturer, b.hw_product_name AS hardware_product_name, b.hw_version AS hardware_version, b.hw_serial_number AS hardware_serial_number, a._create_date AS create_date, a._update_date AS update_date FROM vds_static AS a INNER JOIN vds_dynamic AS b ON a.vds_id = b.vds_id INNER JOIN vds_statistics AS c ON c.vds_id = a.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_host_history_view AS SELECT b.vds_id AS host_id, CAST ( b.status AS SMALLINT ) AS host_status, CAST ( c.usage_mem_percent AS SMALLINT ) AS memory_usage_percent, CAST ( c.usage_cpu_percent AS SMALLINT ) AS cpu_usage_percent, CAST ( c.ksm_cpu_percent AS SMALLINT ) AS ksm_cpu_percent, CAST ( c.cpu_load AS INT ) AS cpu_load, CAST ( c.cpu_sys AS SMALLINT ) AS system_cpu_usage_percent, CAST ( c.cpu_user AS SMALLINT ) AS user_cpu_usage_percent, CAST ( ( c.swap_total - c.swap_free ) AS INT ) AS swap_used_mb, CAST ( b.vm_active AS SMALLINT ) AS vm_active, CAST ( b.vm_count AS SMALLINT ) AS total_vms, b.vms_cores_count AS total_vms_vcpus, c.mem_shared AS ksm_shared_memory_mb FROM vds_dynamic b, vds_statistics c WHERE b.vds_id = c.vds_id; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_host_interface_configuration_history_view AS SELECT a.id AS host_interface_id, a.name AS host_interface_name, a.vds_id AS host_id, CAST ( a.type AS SMALLINT ) AS host_interface_type, a.speed AS host_interface_speed_bps, a.mac_addr AS mac_address, a.network_name AS logical_network_name, a.addr AS ip_address, a.gateway, a.is_bond AS bond, a.bond_name, a.vlan_id, a._create_date AS create_date, a._update_date AS update_date FROM vds_interface AS a WHERE ( ( a._create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( a._update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) ) AND ( a.is_bond IS NULL OR a.is_bond = FALSE OR ( a.is_bond = TRUE AND a.name IN ( SELECT b.bond_name FROM vds_interface AS b WHERE b.is_bond IS NULL AND b.vds_id = a.vds_id ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_host_interface_history_view AS SELECT vds_interface_statistics.id AS host_interface_id, CAST ( vds_interface_statistics.rx_rate AS SMALLINT ) AS receive_rate_percent, CAST ( vds_interface_statistics.tx_rate AS SMALLINT ) AS transmit_rate_percent, vds_interface_statistics.rx_total AS received_total_byte, vds_interface_statistics.tx_total AS transmitted_total_byte FROM vds_interface_statistics; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_configuration_history_view AS SELECT a.vm_guid AS vm_id, a.vm_name, a.description AS vm_description, CAST ( a.vm_type AS SMALLINT ) AS vm_type, a.vds_group_id AS cluster_id, a.vmt_guid AS template_id, b.vm_name AS template_name, CAST ( a.cpu_per_socket AS SMALLINT ) AS cpu_per_socket, CAST ( a.num_of_sockets AS SMALLINT ) AS number_of_sockets, a.mem_size_mb AS memory_size_mb, CAST ( a.os AS SMALLINT ) AS operating_system, f.vds_id AS default_host, a.auto_startup AS high_availability, a.is_initialized AS initialized, a.is_stateless AS stateless, a.fail_back, CAST ( a.usb_policy AS SMALLINT ) AS usb_policy, a.time_zone, c.vm_pool_id, d.vm_pool_name, e.user_id AS created_by_user_id, a._create_date AS create_date, a._update_date AS update_date FROM vm_static AS a INNER JOIN vm_static AS b ON a.vmt_guid = b.vm_guid LEFT OUTER JOIN vm_pool_map AS c ON a.vm_guid = c. vm_guid LEFT OUTER JOIN vm_pools AS d ON c.vm_pool_id = d.vm_pool_id LEFT OUTER JOIN users AS e ON a.created_by_user_id = e.user_id LEFT JOIN (SELECT DISTINCT ON (vm_id) vm_id,vds_id FROM vm_host_pinning_map ORDER BY vm_id) f ON f.vm_id = a.vm_guid WHERE ( a.entity_type = 'VM' AND b.entity_type = 'TEMPLATE' ) AND ( ( a._create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( a._update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) OR ( b._update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_history_view AS SELECT c.vm_guid AS vm_id, CAST ( b.status AS SMALLINT ) AS vm_status, CAST ( c.usage_cpu_percent AS SMALLINT ) AS cpu_usage_percent, CAST ( c.usage_mem_percent AS SMALLINT ) AS memory_usage_percent, CAST ( ( c.cpu_sys / ( vm_static.cpu_per_socket * vm_static.num_of_sockets ) ) AS SMALLINT ) AS system_cpu_usage_percent, CAST ( ( c.cpu_user / ( vm_static.cpu_per_socket * vm_static.num_of_sockets ) ) AS SMALLINT ) AS user_cpu_usage_percent, c.disks_usage, b.vm_ip, b.vm_fqdn, b.client_ip AS vm_client_ip, b.console_user_id AS current_user_id, CASE WHEN b.guest_cur_user_name IS NULL THEN FALSE ELSE TRUE END AS user_logged_in_to_guest, b.run_on_vds AS currently_running_on_host, b.guest_mem_buffered AS memory_buffered_kb, b.guest_mem_cached AS memory_cached_kb FROM vm_dynamic b LEFT OUTER JOIN vm_statistics c ON c.vm_guid = b.vm_guid INNER JOIN vm_static ON c.vm_guid = vm_static.vm_guid; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_interface_configuration_history_view AS SELECT vm_interface.id AS vm_interface_id, vm_interface.name AS vm_interface_name, vm_interface.vm_guid AS vm_id, CAST ( vm_interface.type AS SMALLINT ) AS vm_interface_type, vm_interface.speed AS vm_interface_speed_bps, vm_interface.mac_addr AS mac_address, network.name AS logical_network_name, vm_interface._create_date AS create_date, vm_interface._update_date AS update_date FROM vm_interface LEFT OUTER JOIN ( vnic_profiles JOIN network ON network.id = vnic_profiles.network_id ) ON vnic_profiles.id = vm_interface.vnic_profile_id WHERE vmt_guid IS NULL AND ( ( vm_interface._create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( vm_interface._update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_interface_history_view AS SELECT vm_interface_statistics.id AS vm_interface_id, CAST ( vm_interface_statistics.rx_rate AS SMALLINT ) AS receive_rate_percent, CAST ( vm_interface_statistics.tx_rate AS SMALLINT ) AS transmit_rate_percent, vm_interface_statistics.rx_total AS received_total_byte, vm_interface_statistics.tx_total AS transmitted_total_byte FROM vm_interface_statistics; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_disk_configuration_history_view AS SELECT d.disk_id AS vm_disk_id, d.disk_alias AS vm_disk_name, d.disk_description AS vm_disk_description, i.image_guid AS image_id, image_storage_domain_map.storage_domain_id AS storage_domain_id, CAST ( i.size / 1048576 AS INT ) AS vm_disk_size_mb, CAST ( i.volume_type AS SMALLINT ) AS vm_disk_type, CAST ( i.volume_format AS SMALLINT ) AS vm_disk_format, CASE WHEN d.disk_interface = 'IDE' THEN CAST ( 0 AS SMALLINT ) WHEN d.disk_interface = 'SCSI' THEN CAST ( 1 AS SMALLINT ) WHEN d.disk_interface = 'VirtIO' THEN CAST ( 2 AS SMALLINT ) END AS vm_disk_interface, d.shareable AS is_shared, i._create_date AS create_date, i._update_date AS update_date FROM images AS i INNER JOIN base_disks AS d ON i.image_group_id = d.disk_id INNER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = i.image_guid LEFT OUTER JOIN vm_device ON vm_device.device_id = i.image_group_id LEFT OUTER JOIN vm_static ON vm_static.vm_guid = vm_device.vm_id WHERE i.active = TRUE AND ( vm_static.entity_type = 'VM' OR vm_static.entity_type IS NULL ) AND ( ( i._create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( i._update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_disk_vm_map_history_view AS SELECT image_guid AS vm_disk_id, vm_device.vm_id FROM vm_device INNER JOIN images ON vm_device.device_id = images.image_group_id WHERE images.active = TRUE; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_device_history_view AS SELECT device_id, vm_id, type, address, is_managed, is_plugged, is_readonly, _create_date AS create_date, _update_date AS update_date FROM vm_device WHERE ( ( type = 'disk' AND device = 'disk' ) OR ( type = 'interface' ) ) AND ( ( _create_date > ( SELECT var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( _update_date > ( SELECT var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_vm_disks_history_view AS SELECT d.disk_id AS vm_disk_id, images.image_guid AS image_id, cast(images.imageStatus AS SMALLINT) AS vm_disk_status, vm_disk_actual_size.vm_disk_actual_size_mb AS vm_disk_actual_size_mb, disk_image_dynamic.read_rate AS read_rate_bytes_per_second, disk_image_dynamic.read_latency_seconds AS read_latency_seconds, disk_image_dynamic.write_rate AS write_rate_bytes_per_second, disk_image_dynamic.write_latency_seconds AS write_latency_seconds, disk_image_dynamic.flush_latency_seconds AS flush_latency_seconds FROM images INNER JOIN disk_image_dynamic ON images.image_guid = disk_image_dynamic.image_id INNER JOIN base_disks as d ON images.image_group_id = d.disk_id LEFT OUTER JOIN vm_device ON vm_device.device_id = images.image_group_id LEFT OUTER JOIN vm_static ON vm_static.vm_guid = vm_device.vm_id LEFT JOIN ( SELECT e.disk_id AS vm_disk_id, cast(SUM(disk_image_dynamic.actual_size / 1048576) AS INT) AS vm_disk_actual_size_mb FROM images images_b INNER JOIN disk_image_dynamic ON images_b.image_guid = disk_image_dynamic.image_id INNER JOIN base_disks e ON images_b.image_group_id = e.disk_id LEFT OUTER JOIN vm_device ON vm_device.device_id = images_b.image_group_id LEFT OUTER JOIN vm_static ON vm_static.vm_guid = vm_device.vm_id WHERE vm_static.entity_type = 'VM' OR vm_static.entity_type IS NULL GROUP BY vm_disk_id) AS vm_disk_actual_size ON d.disk_id = vm_disk_actual_size.vm_disk_id WHERE images.active = TRUE AND ( vm_static.entity_type = 'VM' OR vm_static.entity_type IS NULL ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_remove_tags_relations_history_view AS SELECT tag_id AS entity_id, parent_id AS parent_id FROM tags UNION ALL SELECT vds_id AS vds_id, tag_id AS tag_id FROM tags_vds_map UNION ALL SELECT vm_pool_id AS vm_pool_id, tag_id AS tag_id FROM tags_vm_pool_map UNION ALL SELECT vm_id AS vm_id, tag_id AS tag_id FROM tags_vm_map UNION ALL SELECT user_id AS user_id, tag_id AS tag_id FROM tags_user_map UNION ALL SELECT group_id AS group_id, tag_id AS tag_id FROM tags_user_group_map; ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_add_tags_relations_history_view AS SELECT tag_id AS entity_id, parent_id AS parent_id, CAST ( 18 AS SMALLINT ) AS entity_type, _create_date AS attach_date, _update_date AS move_date FROM tags WHERE ( _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( _update_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ) UNION ALL SELECT vds_id AS vds_id, tag_id AS tag_id, CAST ( 3 AS SMALLINT ) , _create_date, NULL FROM tags_vds_map WHERE _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) UNION ALL SELECT vm_pool_id AS vm_pool_id, tag_id AS tag_id, CAST ( 5 AS SMALLINT ) , _create_date, NULL FROM tags_vm_pool_map WHERE _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) UNION ALL SELECT vm_id AS vm_id, tag_id AS tag_id, CAST ( 2 AS SMALLINT ) , _create_date, NULL FROM tags_vm_map WHERE _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) UNION ALL SELECT user_id AS user_id, tag_id AS tag_id, CAST ( 15 AS SMALLINT ) , _create_date, NULL FROM tags_user_map WHERE _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) UNION ALL SELECT group_id AS group_id, tag_id AS tag_id, CAST ( 17 AS SMALLINT ) , _create_date, NULL FROM tags_user_group_map WHERE _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_tags_details_history_view AS SELECT tag_id AS tag_id, tag_name AS tag_name, description AS tag_description, _create_date AS create_date, _update_date AS update_date FROM tags WHERE ( _create_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping WHERE ( var_name = 'lastSync' ) ) ) OR ( _update_date > ( SELECT var_datetime AS var_datetime FROM dwh_history_timekeeping AS history_timekeeping_1 WHERE ( var_name = 'lastSync' ) ) ); ************************** CREATE VIEW ********* QUERY ********** CREATE OR REPLACE VIEW dwh_users_history_view AS SELECT user_id, name AS first_name, surname AS last_name, DOMAIN, username, department, '' AS user_role_title, email, external_id, TRUE AS active, _create_date AS create_date, _update_date AS update_date FROM users; ************************** CREATE VIEW ********* QUERY ********** Create or replace FUNCTION Insertaction_version_map(v_action_type INTEGER, v_cluster_minimal_version VARCHAR(40), v_storage_pool_minimal_version VARCHAR(40)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO action_version_map(action_type, cluster_minimal_version, storage_pool_minimal_version) VALUES(v_action_type, v_cluster_minimal_version, v_storage_pool_minimal_version); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deleteaction_version_map(v_action_type INTEGER) RETURNS VOID AS $procedure$ BEGIN DELETE FROM action_version_map WHERE action_type = v_action_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromaction_version_map() RETURNS SETOF action_version_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM action_version_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getaction_version_mapByaction_type(v_action_type INTEGER) RETURNS SETOF action_version_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM action_version_map WHERE action_type = v_action_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_delete_version_map(v_cluster_version varchar(10), v_sp_version varchar(40)) returns void AS $procedure$ BEGIN DELETE FROM action_version_map WHERE cluster_minimal_version = v_cluster_version AND storage_pool_minimal_version = v_sp_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGroup(v_id UUID, v_name VARCHAR(255), v_domain VARCHAR(100), v_distinguishedname VARCHAR(4000), v_external_id TEXT, v_namespace VARCHAR(2048)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO ad_groups(id, name,domain,distinguishedname,external_id, namespace) VALUES(v_id, v_name,v_domain,v_distinguishedname,v_external_id, v_namespace); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGroup(v_id UUID, v_name VARCHAR(255), v_domain VARCHAR(100), v_distinguishedname VARCHAR(4000), v_external_id TEXT, v_namespace VARCHAR(2048)) RETURNS VOID AS $procedure$ BEGIN UPDATE ad_groups SET name = v_name,domain = v_domain,distinguishedname = v_distinguishedname,external_id = v_external_id, namespace = v_namespace WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGroup(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM tags_user_group_map WHERE group_id = v_id; DELETE FROM ad_groups WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllGroups() RETURNS SETOF ad_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM ad_groups; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGroupById(v_id UUID) RETURNS SETOF ad_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM ad_groups WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGroupByExternalId(v_domain VARCHAR(100), v_external_id TEXT) RETURNS SETOF ad_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM ad_groups WHERE domain = v_domain AND external_id = v_external_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGroupByName(v_name VARCHAR(256)) RETURNS SETOF ad_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM ad_groups WHERE name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getAllAffinityGroupsByVmId(v_vm_id UUID) RETURNS SETOF affinity_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT affinity_groups_view.* FROM affinity_groups_view JOIN affinity_group_members ON v_vm_id = affinity_group_members.vm_id AND affinity_group_members.affinity_group_id = affinity_groups_view.id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getAllAffinityGroupsByClusterId(v_cluster_id UUID) RETURNS SETOF affinity_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM affinity_groups_view WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAffinityGroupByAffinityGroupId(v_id UUID) RETURNS SETOF affinity_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM affinity_groups_view WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAffinityGroupByName(v_name VARCHAR(255)) RETURNS SETOF affinity_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM affinity_groups_view WHERE name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertAffinityGroupWithMembers( v_id UUID, v_name VARCHAR(255), v_description VARCHAR(4000), v_cluster_id UUID, v_positive BOOLEAN, v_enforcing BOOLEAN, v_vm_ids VARCHAR(4000) ) RETURNS VOID AS $procedure$ DECLARE iter_id UUID; BEGIN INSERT INTO affinity_groups( id, name, description, cluster_id, positive, enforcing) VALUES( v_id, v_name, v_description, v_cluster_id, v_positive, v_enforcing); FOR iter_id IN (SELECT * FROM fnsplitteruuid(v_vm_ids)) LOOP INSERT INTO affinity_group_members( affinity_group_id, vm_id) VALUES( v_id, iter_id); END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAffinityGroup(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM affinity_groups WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateAffinityGroupWithMembers( v_id UUID, v_name VARCHAR(255), v_description VARCHAR(4000), v_cluster_id UUID, v_positive BOOLEAN, v_enforcing BOOLEAN, v_vm_ids VARCHAR(4000) ) RETURNS VOID AS $procedure$ BEGIN PERFORM DeleteAffinityGroup(v_id); PERFORM InsertAffinityGroupWithMembers( v_id, v_name, v_description, v_cluster_id, v_positive, v_enforcing, v_vm_ids); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveVmFromAffinityGroups(v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM affinity_group_members WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getPositiveEnforcingAffinityGroupsByRunningVmsOnVdsId(v_vds_id UUID) RETURNS SETOF affinity_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT affinity_groups_view.* FROM affinity_groups_view INNER JOIN affinity_group_members ON id = affinity_group_members.affinity_group_id INNER JOIN vm_dynamic ON affinity_group_members.vm_id = vm_dynamic.vm_guid AND vm_dynamic.run_on_vds = v_vds_id WHERE positive AND enforcing; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromDisks(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF all_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM all_disks WHERE (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_id = v_user_id AND entity_id = disk_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskByDiskId(v_disk_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF all_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM all_disks WHERE image_group_id = v_disk_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_id = v_user_id AND entity_id = v_disk_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDisksVmGuid(v_vm_guid UUID, v_only_plugged BOOLEAN, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF all_disks_for_vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM all_disks_for_vms WHERE vm_id = v_vm_guid AND (NOT v_only_plugged OR is_plugged) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_id = v_user_id AND entity_id = disk_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetDisksVmGuids ( v_vm_guids UUID[] ) RETURNS SETOF all_disks_for_vms STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM all_disks_for_vms WHERE vm_id = ANY(v_vm_guids); END;$PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS disks_basic_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE disks_basic_rs AS (disk_id UUID,disk_alias varchar(255),size BIGINT); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetDisksVmGuidBasicView(v_vm_guid UUID, v_only_plugged BOOLEAN, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF disks_basic_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT disk_id,disk_alias, size FROM images LEFT OUTER JOIN base_disks ON images.image_group_id = base_disks.disk_id LEFT JOIN vm_device ON vm_device.device_id = image_group_id AND (NOT v_only_plugged OR is_plugged) WHERE vm_device.vm_id = v_vm_guid AND images.active = true AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_id = v_user_id AND entity_id = disk_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmBootActiveDisk(v_vm_guid UUID) RETURNS SETOF all_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT all_disks.* FROM all_disks JOIN vm_device ON vm_device.device_id = all_disks.image_group_id WHERE vm_device.vm_id = v_vm_guid AND boot = TRUE AND vm_device.snapshot_id IS NULL; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllAttachableDisksByPoolId(v_storage_pool_id UUID, v_vm_id uuid, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF all_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT distinct all_disks.* FROM all_disks WHERE (v_storage_pool_id IS NULL OR all_disks.storage_pool_id = v_storage_pool_id) AND (all_disks.number_of_vms = 0 OR all_disks.shareable) -- ImageStatus.ILLEGAL=4 / imagestatus IS NULL -> LunDiski / ImageStatus.Locked=2 AND (all_disks.imagestatus IS NULL OR (all_disks.imagestatus != 4 AND all_disks.imagestatus != 2)) AND (v_vm_id IS NULL OR v_vm_id NOT IN (SELECT vm_id FROM vm_device WHERE vm_device.device_id = all_disks.image_group_id)) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_id = v_user_id AND entity_id = disk_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromDisksByDiskStorageType(v_disk_storage_type SMALLINT, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF all_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM all_disks WHERE disk_storage_type = v_disk_storage_type AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_id = v_user_id AND entity_id = disk_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertasync_tasks(v_action_type INTEGER, v_result INTEGER, v_status INTEGER, v_user_id UUID, v_vdsm_task_id UUID, v_task_id UUID, v_step_id UUID, v_command_id UUID, v_root_command_id UUID, v_started_at timestamp WITH TIME ZONE, v_storage_pool_id UUID, v_async_task_type INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO async_tasks(action_type, result, status, user_id, vdsm_task_id, task_id, step_id, command_id, root_command_id, started_at,storage_pool_id, task_type) VALUES(v_action_type, v_result, v_status, v_user_id, v_vdsm_task_id, v_task_id, v_step_id, v_command_id, v_root_command_id, v_started_at, v_storage_pool_id, v_async_task_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updateasync_tasks(v_action_type INTEGER, v_result INTEGER, v_status INTEGER, v_user_id UUID, v_vdsm_task_id UUID, v_task_id UUID, v_step_id UUID, v_command_id UUID, v_root_command_id UUID, v_storage_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE async_tasks SET action_type = v_action_type, result = v_result, status = v_status, step_id = v_step_id, command_id = v_command_id, root_command_id = v_root_command_id, vdsm_task_id = v_vdsm_task_id, storage_pool_id = v_storage_pool_id WHERE task_id = v_task_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertOrUpdateAsyncTasks(v_action_type INTEGER, v_result INTEGER, v_status INTEGER, v_user_id UUID, v_vdsm_task_id UUID, v_task_id UUID, v_step_id UUID, v_command_id UUID, v_root_command_id UUID, v_started_at timestamp WITH TIME ZONE, v_storage_pool_id UUID, v_async_task_type INTEGER) RETURNS VOID AS $procedure$ BEGIN IF NOT EXISTS (SELECT 1 from async_tasks where async_tasks.task_id = v_task_id) THEN PERFORM Insertasync_tasks(v_action_type, v_result, v_status, v_user_id, v_vdsm_task_id, v_task_id, v_step_id, v_command_id, v_root_command_id, v_started_at, v_storage_pool_id, v_async_task_type); ELSE PERFORM Updateasync_tasks(v_action_type, v_result, v_status, v_user_id, v_vdsm_task_id, v_task_id, v_step_id, v_command_id, v_root_command_id, v_storage_pool_id); END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertAsyncTaskEntities( v_task_id UUID, v_entity_id UUID, v_entity_type varchar(128)) RETURNS VOID AS $procedure$ BEGIN IF NOT EXISTS (SELECT 1 from async_tasks_entities where async_task_id = v_task_id and entity_id = v_entity_id) THEN INSERT INTO async_tasks_entities (async_task_id,entity_id,entity_type) VALUES (v_task_id, v_entity_id, v_entity_type); END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAsyncTasksIdsByEntityId(v_entity_id UUID) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT async_task_id from async_tasks_entities where entity_id = v_entity_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAsyncTasksIdsByUserId(v_user_id UUID) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT task_id from async_tasks where user_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVdsmTasksIdsByUserId(v_user_id UUID) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vdsm_task_id from async_tasks where user_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAsyncTaskEntitiesByTaskId(v_task_id UUID) RETURNS SETOF async_tasks_entities STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM async_tasks_entities WHERE async_task_id = v_task_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deleteasync_tasks(v_task_id UUID) RETURNS integer AS $procedure$ DECLARE deleted_rows int; BEGIN DELETE FROM async_tasks WHERE task_id = v_task_id; GET DIAGNOSTICS deleted_rows = ROW_COUNT; RETURN deleted_rows; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAsyncTasksByVdsmTaskId(v_vdsm_task_id UUID) RETURNS integer AS $procedure$ DECLARE deleted_rows int; BEGIN DELETE FROM async_tasks WHERE vdsm_task_id = v_vdsm_task_id; GET DIAGNOSTICS deleted_rows = ROW_COUNT; RETURN deleted_rows; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAsyncTasksByStoragePoolId(v_storage_pool_id UUID) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT async_tasks.task_id FROM async_tasks WHERE storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromasync_tasks() RETURNS SETOF async_tasks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM async_tasks; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getasync_tasksBytask_id(v_task_id UUID) RETURNS SETOF async_tasks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM async_tasks WHERE task_id = v_task_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAsyncTasksByEntityId(v_entity_id UUID) RETURNS SETOF async_tasks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT async_tasks.* FROM async_tasks JOIN async_tasks_entities ON async_task_id = task_id WHERE entity_id = v_entity_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAsyncTasksByVdsmTaskId(v_vdsm_task_id UUID) RETURNS SETOF async_tasks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM async_tasks WHERE vdsm_task_id = v_vdsm_task_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertAuditLog(INOUT v_audit_log_id INTEGER , v_log_time TIMESTAMP WITH TIME ZONE, v_log_type INTEGER, v_log_type_name VARCHAR(100), v_severity INTEGER, v_message text, v_user_id UUID , v_user_name VARCHAR(255) , v_vds_id UUID , v_vds_name VARCHAR(255) , v_vm_id UUID , v_vm_name VARCHAR(255) , v_vm_template_id UUID , v_vm_template_name VARCHAR(40) , v_storage_pool_id UUID , v_storage_pool_name VARCHAR(40) , v_storage_domain_id UUID , v_storage_domain_name VARCHAR(250) , v_vds_group_id UUID , v_vds_group_name VARCHAR(255), v_quota_id UUID, v_quota_name VARCHAR(60), v_correlation_id VARCHAR(50), v_job_id UUID, v_gluster_volume_id UUID, v_gluster_volume_name VARCHAR(1000), v_call_stack text, v_repeatable BOOLEAN, v_brick_id UUID, v_brick_path text) AS $procedure$ DECLARE v_min_alret_severity INTEGER; BEGIN v_min_alret_severity := 10; -- insert regular log messages (non alerts) if (v_severity < v_min_alret_severity) then INSERT INTO audit_log(LOG_TIME, log_type, log_type_name, severity,message, user_id, USER_NAME, vds_id, VDS_NAME, vm_id, VM_NAME,vm_template_id,VM_TEMPLATE_NAME,storage_pool_id,STORAGE_POOL_NAME,storage_domain_id,STORAGE_DOMAIN_NAME,vds_group_id,vds_group_name, correlation_id, job_id, quota_id, quota_name, gluster_volume_id, gluster_volume_name, call_stack, brick_id, brick_path) VALUES(v_log_time, v_log_type, v_log_type_name, v_severity, v_message, v_user_id, v_user_name, v_vds_id, v_vds_name, v_vm_id, v_vm_name,v_vm_template_id,v_vm_template_name,v_storage_pool_id,v_storage_pool_name,v_storage_domain_id,v_storage_domain_name,v_vds_group_id,v_vds_group_name, v_correlation_id, v_job_id, v_quota_id, v_quota_name, v_gluster_volume_id, v_gluster_volume_name, v_call_stack, v_brick_id, v_brick_path); v_audit_log_id := CURRVAL('audit_log_seq'); else if (v_repeatable OR not exists(select audit_log_id from audit_log where vds_name = v_vds_name and log_type = v_log_type and not deleted)) then INSERT INTO audit_log(LOG_TIME, log_type, log_type_name, severity,message, user_id, USER_NAME, vds_id, VDS_NAME, vm_id, VM_NAME,vm_template_id,VM_TEMPLATE_NAME,storage_pool_id,STORAGE_POOL_NAME,storage_domain_id,STORAGE_DOMAIN_NAME,vds_group_id,vds_group_name, correlation_id, job_id, quota_id, quota_name, gluster_volume_id, gluster_volume_name, call_stack, brick_id, brick_path) VALUES(v_log_time, v_log_type, v_log_type_name, v_severity, v_message, v_user_id, v_user_name, v_vds_id, v_vds_name, v_vm_id, v_vm_name,v_vm_template_id,v_vm_template_name,v_storage_pool_id,v_storage_pool_name,v_storage_domain_id,v_storage_domain_name,v_vds_group_id,v_vds_group_name, v_correlation_id, v_job_id, v_quota_id, v_quota_name, v_gluster_volume_id, v_gluster_volume_name, v_call_stack, v_brick_id, v_brick_path); v_audit_log_id := CURRVAL('audit_log_seq'); else select audit_log_id INTO v_audit_log_id from audit_log where vds_name = v_vds_name and log_type = v_log_type; end if; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertExternalAuditLog(INOUT v_audit_log_id INTEGER , v_log_time TIMESTAMP WITH TIME ZONE, v_log_type INTEGER, v_log_type_name VARCHAR(100), v_severity INTEGER, v_message text, v_user_id UUID , v_user_name VARCHAR(255) , v_vds_id UUID , v_vds_name VARCHAR(255) , v_vm_id UUID , v_vm_name VARCHAR(255) , v_vm_template_id UUID , v_vm_template_name VARCHAR(40) , v_storage_pool_id UUID , v_storage_pool_name VARCHAR(40) , v_storage_domain_id UUID , v_storage_domain_name VARCHAR(250) , v_vds_group_id UUID , v_vds_group_name VARCHAR(255), v_quota_id UUID, v_quota_name VARCHAR(60), v_correlation_id VARCHAR(50), v_job_id UUID, v_gluster_volume_id UUID, v_gluster_volume_name VARCHAR(1000), v_call_stack text, v_brick_id UUID, v_brick_path text, v_origin VARCHAR(25), v_custom_event_id INTEGER, v_event_flood_in_sec INTEGER, v_custom_data text) AS $procedure$ DECLARE v_max_message_length INTEGER; v_truncated_message text; BEGIN -- truncate message if exceeds configured max length. truncated messages will be ended -- with "..." to indicate that message is incomplete due to size limits. v_truncated_message := v_message; v_max_message_length := cast(option_value as int) FROM vdc_options WHERE option_name = 'MaxAuditLogMessageLength' and version = 'general'; IF (v_max_message_length IS NOT NULL and length(v_message) > v_max_message_length) THEN v_truncated_message := substr(v_message, 1, v_max_message_length -3) || '...'; END IF; INSERT INTO audit_log(LOG_TIME, log_type, log_type_name, severity,message, user_id, USER_NAME, vds_id, VDS_NAME, vm_id, VM_NAME,vm_template_id,VM_TEMPLATE_NAME,storage_pool_id,STORAGE_POOL_NAME,storage_domain_id,STORAGE_DOMAIN_NAME,vds_group_id,vds_group_name, correlation_id, job_id, quota_id, quota_name, gluster_volume_id, gluster_volume_name, call_stack, origin, custom_event_id, event_flood_in_sec, custom_data, brick_id, brick_path) VALUES(v_log_time, v_log_type, v_log_type_name, v_severity, v_truncated_message, v_user_id, v_user_name, v_vds_id, v_vds_name, v_vm_id, v_vm_name,v_vm_template_id,v_vm_template_name,v_storage_pool_id,v_storage_pool_name,v_storage_domain_id,v_storage_domain_name,v_vds_group_id,v_vds_group_name, v_correlation_id, v_job_id, v_quota_id, v_quota_name, v_gluster_volume_id, v_gluster_volume_name, v_call_stack, v_origin, v_custom_event_id, v_event_flood_in_sec, v_custom_data, v_brick_id, v_brick_path); v_audit_log_id := CURRVAL('audit_log_seq'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAuditLog(v_audit_log_id INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log SET deleted = true WHERE audit_log_id = v_audit_log_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION ClearAllAuditLogEvents(v_severity INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log SET deleted = true WHERE severity != v_severity; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DisplayAllAuditLogEvents(v_severity INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log SET deleted = false WHERE severity != v_severity; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION SetAllAuditLogAlerts(v_severity INTEGER, v_value BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log SET deleted = v_value WHERE severity = v_severity; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromAuditLog(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log a WHERE NOT deleted AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view pv, user_object_permissions_view dpv WHERE pv.user_id = v_user_id AND pv.entity_id = a.vm_id AND pv.entity_id = dpv.entity_id) OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view pv, user_object_permissions_view dpv WHERE pv.user_id = v_user_id AND pv.entity_id = a.vm_template_id AND pv.entity_id = dpv.entity_id) OR EXISTS (SELECT 1 FROM user_vds_permissions_view pv, user_object_permissions_view dpv WHERE pv.user_id = v_user_id AND pv.entity_id = a.vds_id AND pv.entity_id = dpv.entity_id) OR EXISTS (SELECT 1 FROM user_storage_pool_permissions_view pv, user_object_permissions_view dpv WHERE pv.user_id = v_user_id AND pv.entity_id = a.storage_pool_id AND pv.entity_id = dpv.entity_id) OR EXISTS (SELECT 1 FROM user_storage_domain_permissions_view pv, user_object_permissions_view dpv WHERE pv.user_id = v_user_id AND pv.entity_id = a.storage_domain_id AND pv.entity_id = dpv.entity_id) OR EXISTS (SELECT 1 FROM user_vds_groups_permissions_view pv, user_object_permissions_view dpv WHERE pv.user_id = v_user_id AND pv.entity_id = a.vds_group_id AND pv.entity_id = dpv.entity_id) ) order by audit_log_id desc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAuditLogByAuditLogId(v_audit_log_id INTEGER) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log WHERE audit_log_id = v_audit_log_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAuditLogByVMId(v_vm_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log WHERE not deleted and vm_id = v_vm_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = vm_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAuditLogByVMTemplateId(v_vm_template_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log WHERE not deleted and vm_template_id = v_vm_template_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = vm_template_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveAuditLogByBrickIdLogType(v_brick_id UUID, v_audit_log_type INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log set deleted = true WHERE brick_id = v_brick_id AND log_type = v_audit_log_type ; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAuditLogLaterThenDate(v_date TIMESTAMP WITH TIME ZONE) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log WHERE not deleted and LOG_TIME >= v_date; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAuditLogOlderThenDate(v_date TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ DECLARE v_id INTEGER; SWV_RowCount INTEGER; BEGIN -- get first the id from which to remove in order to use index select audit_log_id INTO v_id FROM audit_log WHERE LOG_TIME < v_date order by audit_log_id desc LIMIT 1; -- check if there are candidates to remove GET DIAGNOSTICS SWV_RowCount = ROW_COUNT; if (SWV_RowCount > 0) then DELETE FROM audit_log WHERE audit_log_id <= v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAuditAlertLogByVdsIDAndType(v_vds_id UUID, v_log_type INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log set deleted = true where vds_id = v_vds_id and log_type = v_log_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteBackupRelatedAlerts() RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log set deleted = true where origin='oVirt' and log_type in (9022, 9023, 9026); -- (ENGINE_NO_FULL_BACKUP, ENGINE_NO_WARM_BACKUP, ENGINE_BACKUP_FAILED) END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAuditAlertLogByVolumeIDAndType(v_gluster_volume_id UUID, v_log_type INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE audit_log set deleted = true where gluster_volume_id = v_gluster_volume_id and log_type = v_log_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAuditLogAlertsByVdsID(v_vds_id UUID, v_delete_config_alerts BOOLEAN=true) RETURNS VOID AS $procedure$ DECLARE v_min_alret_severity INTEGER; v_no_config_alret_type INTEGER; v_no_max_alret_type INTEGER; BEGIN v_min_alret_severity := 10; v_no_config_alret_type := 9000; v_no_max_alret_type := 9005; if (v_delete_config_alerts = true) then UPDATE audit_log set deleted = true where vds_id = v_vds_id and severity >= v_min_alret_severity and log_type between v_no_config_alret_type and v_no_max_alret_type; else UPDATE audit_log set deleted = true where vds_id = v_vds_id and severity >= v_min_alret_severity and log_type between v_no_config_alret_type + 1 and v_no_max_alret_type; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Used to find out how many seconds to wait after Start/Stop/Restart PM operations v_vds_name - The host name v_event - The event [USER_VDS_STOP | USER_VDS_START | USER_VDS_RESTART] v_wait_for_sec - Configurable time in seconds to wait from last operation. Returns : The number of seconds we have to wait (negative value means we can do the operation immediately) */ Create or replace FUNCTION get_seconds_to_wait_before_pm_operation(v_vds_name varchar(255), v_event varchar(100), v_wait_for_sec INTEGER ) RETURNS INTEGER STABLE AS $procedure$ declare v_last_event_dt timestamp with time zone; declare v_now_dt timestamp with time zone; BEGIN if exists(select 1 from audit_log where vds_name = v_vds_name and log_type_name = v_event) then begin v_last_event_dt := log_time from audit_log where vds_name = v_vds_name and log_type_name = v_event order by audit_log_id desc limit 1; v_now_dt := CURRENT_TIMESTAMP; RETURN cast((extract(epoch from v_last_event_dt) + v_wait_for_sec) - extract(epoch from v_now_dt) as int); end; else RETURN 0; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAuditLogByOriginAndCustomEventId(v_origin varchar(255), v_custom_event_id INTEGER) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log WHERE origin = v_origin and custom_event_id = v_custom_event_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAuditLogByVolumeIdAndType(v_gluster_volume_id UUID, v_log_type INTEGER) RETURNS SETOF audit_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM audit_log WHERE gluster_volume_id = v_gluster_volume_id and log_type = v_log_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertBaseDisk( v_disk_id UUID, v_disk_interface VARCHAR(32), v_wipe_after_delete BOOLEAN, v_propagate_errors VARCHAR(32), v_disk_alias VARCHAR(50), v_disk_description VARCHAR(500), v_shareable BOOLEAN, v_boot BOOLEAN, v_sgio INTEGER, v_alignment SMALLINT, v_last_alignment_scan TIMESTAMP WITH TIME ZONE, v_disk_storage_type SMALLINT, v_cinder_volume_type VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO base_disks( disk_id, disk_interface, wipe_after_delete, propagate_errors, disk_alias, disk_description, shareable, boot, sgio, alignment, last_alignment_scan, disk_storage_type, cinder_volume_type) VALUES( v_disk_id, v_disk_interface, v_wipe_after_delete, v_propagate_errors, v_disk_alias, v_disk_description, v_shareable, v_boot, v_sgio, v_alignment, v_last_alignment_scan, v_disk_storage_type, v_cinder_volume_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateBaseDisk( v_disk_id UUID, v_disk_interface VARCHAR(32), v_wipe_after_delete BOOLEAN, v_propagate_errors VARCHAR(32), v_disk_alias VARCHAR(50), v_disk_description VARCHAR(500), v_shareable BOOLEAN, v_boot BOOLEAN, v_sgio INTEGER, v_alignment SMALLINT, v_last_alignment_scan TIMESTAMP WITH TIME ZONE, v_disk_storage_type SMALLINT, v_cinder_volume_type VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN UPDATE base_disks SET disk_interface = v_disk_interface, wipe_after_delete = v_wipe_after_delete, propagate_errors = v_propagate_errors, disk_alias = v_disk_alias, disk_description = v_disk_description, shareable = v_shareable, boot = v_boot, sgio = v_sgio, alignment = v_alignment, last_alignment_scan = v_last_alignment_scan, disk_storage_type = v_disk_storage_type, cinder_volume_type = v_cinder_volume_type WHERE disk_id = v_disk_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateBaseDiskBootFlag ( v_disk_id UUID, v_boot BOOLEAN ) RETURNS VOID AS $PROCEDURE$ BEGIN UPDATE base_disks SET boot = v_boot WHERE disk_id = v_disk_id; END;$PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteBaseDisk(v_disk_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN DELETE FROM base_disks WHERE disk_id = v_disk_id; -- Delete the disk's permissions DELETE FROM permissions WHERE object_id = v_disk_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromBaseDisks() RETURNS SETOF base_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM base_disks; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBaseDiskByBaseDiskId(v_disk_id UUID) RETURNS SETOF base_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM base_disks WHERE disk_id = v_disk_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBaseDisksByAlias(v_disk_alias varchar(255)) RETURNS SETOF base_disks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM base_disks WHERE disk_alias = v_disk_alias; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertBookmark(v_bookmark_id UUID, v_bookmark_name VARCHAR(40), v_bookmark_value VARCHAR(300)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO bookmarks(bookmark_Id,bookmark_name, bookmark_value) VALUES(v_bookmark_id, v_bookmark_name, v_bookmark_value); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateBookmark(v_bookmark_id UUID, v_bookmark_name VARCHAR(40), v_bookmark_value VARCHAR(300)) RETURNS VOID AS $procedure$ BEGIN UPDATE bookmarks SET bookmark_name = v_bookmark_name,bookmark_value = v_bookmark_value WHERE bookmark_Id = v_bookmark_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteBookmark(v_bookmark_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM bookmarks WHERE bookmark_Id = v_bookmark_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromBookmarks() RETURNS SETOF bookmarks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM bookmarks; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBookmarkBybookmark_name(v_bookmark_name VARCHAR(40)) RETURNS SETOF bookmarks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM bookmarks WHERE bookmark_name = v_bookmark_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBookmarkBybookmark_id(v_bookmark_id UUID) RETURNS SETOF bookmarks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM bookmarks WHERE bookmark_Id = v_bookmark_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION insert_entity_snapshot(v_id uuid, v_command_id uuid,v_command_type character varying , v_entity_id character varying, v_entity_type character varying, v_entity_snapshot text, v_snapshot_class character varying, v_snapshot_type INTEGER,v_insertion_order INTEGER) RETURNS void AS $procedure$ BEGIN BEGIN INSERT INTO business_entity_snapshot(id, command_id, command_type, entity_id,entity_type,entity_snapshot, snapshot_class, snapshot_type,insertion_order) VALUES(v_id, v_command_id, v_command_type, v_entity_id,v_entity_type,v_entity_snapshot, v_snapshot_class, v_snapshot_type,v_insertion_order); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION get_entity_snapshot_by_id(v_id uuid) RETURNS SETOF business_entity_snapshot STABLE AS $procedure$ BEGIN RETURN QUERY SELECT business_entity_snapshot.* FROM business_entity_snapshot WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION get_entity_snapshot_by_command_id(v_command_id uuid) RETURNS SETOF business_entity_snapshot STABLE AS $procedure$ BEGIN RETURN QUERY SELECT business_entity_snapshot.* FROM business_entity_snapshot WHERE command_id = v_command_id order by insertion_order desc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS get_all_commands_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE get_all_commands_rs AS(command_id UUID, command_type varchar(256)); ************************** CREATE TYPE ********* QUERY ********** CREATE OR REPLACE FUNCTION get_all_commands() RETURNS SETOF get_all_commands_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT distinct business_entity_snapshot.command_id, business_entity_snapshot.command_type FROM business_entity_snapshot; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION delete_entity_snapshot_by_command_id(v_command_id uuid) RETURNS void AS $procedure$ BEGIN BEGIN delete from business_entity_snapshot where command_id = v_command_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Cluster Features related tables: cluster_features, supported_cluster_features, supported_host_features ----------------------------------------------------------------*/ Create or replace function InsertClusterFeature(v_feature_id UUID, v_feature_name VARCHAR(256), v_version VARCHAR(40), v_category INTEGER, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO cluster_features(feature_id, feature_name, version, category, description) VALUES(v_feature_id, v_feature_name, v_version, v_category, v_description); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace function UpdateClusterFeature(v_feature_id UUID, v_feature_name VARCHAR(256), v_version VARCHAR(40), v_category INTEGER, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE cluster_features SET feature_name = v_feature_name, version = v_version, description = v_description, category = v_category where feature_id = v_feature_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetClusterFeaturesByVersionAndCategory(v_version VARCHAR(256), v_category INTEGER) RETURNS SETOF cluster_features STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cluster_features WHERE cluster_features.version = v_version and (cluster_features.category & v_category) > 0; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace function InsertSupportedClusterFeature(v_feature_id UUID, v_cluster_id UUID, v_is_enabled BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO supported_cluster_features(cluster_id, feature_id, is_enabled) VALUES(v_cluster_id, v_feature_id, v_is_enabled); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace function UpdateSupportedClusterFeature(v_feature_id UUID, v_cluster_id UUID, v_is_enabled BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE supported_cluster_features SET is_enabled = v_is_enabled where cluster_id = v_cluster_id and feature_id = v_feature_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSupportedClusterFeaturesByClusterId(v_cluster_id UUID) RETURNS SETOF supported_cluster_features_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM supported_cluster_features_view WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace function InsertSupportedHostFeature(v_host_id UUID, v_feature_name VARCHAR(256)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO supported_host_features(host_id, feature_name) VALUES(v_host_id, v_feature_name); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSupportedHostFeaturesByHostId(v_host_id UUID) RETURNS SETOF supported_host_features STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM supported_host_features WHERE host_id = v_host_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace function RemoveSupportedHostFeature(v_host_id UUID, v_feature_name VARCHAR(256)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM supported_host_features WHERE host_id = v_host_id and feature_name = v_feature_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromClusterPolicys() RETURNS SETOF cluster_policies STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cluster_policies; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetClusterPolicyByClusterPolicyId(v_id UUID) RETURNS SETOF cluster_policies STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cluster_policies WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertClusterPolicy( v_id UUID, v_name VARCHAR(128), v_description VARCHAR(4000), v_is_locked BOOLEAN, v_is_default BOOLEAN, v_custom_properties text) RETURNS VOID AS $procedure$ BEGIN INSERT INTO cluster_policies( id, name, description, is_locked, is_default, custom_properties) VALUES( v_id, v_name, v_description, v_is_locked, v_is_default, v_custom_properties); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateClusterPolicy( v_id UUID, v_name VARCHAR(128), v_description VARCHAR(4000), v_is_locked BOOLEAN, v_is_default BOOLEAN, v_custom_properties text) RETURNS VOID AS $procedure$ BEGIN UPDATE cluster_policies SET name = v_name, description = v_description, is_locked = v_is_locked, is_default = v_is_default, custom_properties = v_custom_properties WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteClusterPolicy(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM cluster_policies WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromClusterPolicyUnits() RETURNS SETOF cluster_policy_units STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cluster_policy_units; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetClusterPolicyUnitsByClusterPolicyId(v_id UUID) RETURNS SETOF cluster_policy_units STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cluster_policy_units WHERE cluster_policy_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteClusterPolicyUnitsByClusterPolicyId(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM cluster_policy_units WHERE cluster_policy_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertClusterPolicyUnit( v_cluster_policy_id UUID, v_policy_unit_id UUID, v_filter_sequence int, v_factor int) RETURNS VOID AS $procedure$ BEGIN INSERT INTO cluster_policy_units( cluster_policy_id, policy_unit_id, filter_sequence, factor) VALUES( v_cluster_policy_id, v_policy_unit_id, v_filter_sequence, v_factor); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION InsertCommandEntity (v_user_id uuid, v_command_id uuid, v_command_type int, v_parent_command_id uuid, v_root_command_id uuid, v_job_id uuid, v_step_id uuid, v_command_parameters text, v_command_params_class varchar(256), v_created_at timestamp WITH TIME ZONE, v_status varchar(20), v_executed boolean, v_callback_enabled boolean, v_return_value text, v_return_value_class varchar(256)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO command_entities(user_id, command_id, command_type, parent_command_id, root_command_id, job_id, step_id, command_parameters, command_params_class, created_at, status, executed, callback_enabled, return_value, return_value_class) VALUES(v_user_id, v_command_id, v_command_type, v_parent_command_id, v_root_command_id, v_job_id, v_step_id, v_command_parameters, v_command_params_class, NOW(), v_status, v_executed, v_callback_enabled, v_return_value, v_return_value_class); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateCommandEntity (v_user_id uuid, v_command_id uuid, v_command_type int, v_parent_command_id uuid, v_root_command_id uuid, v_job_id uuid, v_step_id uuid, v_command_parameters text, v_command_params_class varchar(256), v_status varchar(20), v_executed boolean, v_callback_enabled boolean, v_return_value text, v_return_value_class varchar(256)) RETURNS VOID AS $procedure$ BEGIN UPDATE command_entities SET command_type = v_command_type, user_id = v_user_id, parent_command_id = v_parent_command_id, root_command_id = v_root_command_id, job_id = v_job_id, step_id = v_step_id, command_parameters = v_command_parameters, command_params_class = v_command_params_class, status = v_status, executed = v_executed, callback_enabled = v_callback_enabled, return_value = v_return_value, return_value_class = v_return_value_class WHERE command_id = v_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateCommandEntityStatus (v_command_id uuid, v_status varchar(20)) RETURNS VOID AS $procedure$ BEGIN UPDATE command_entities SET status = v_status WHERE command_id = v_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateCommandEntityExecuted(v_command_id uuid, v_executed boolean) RETURNS VOID AS $procedure$ BEGIN UPDATE command_entities SET executed = v_executed WHERE command_id = v_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateCommandEntityNotified(v_command_id uuid, v_callback_notified boolean) RETURNS VOID AS $procedure$ BEGIN UPDATE command_entities SET callback_notified = v_callback_notified WHERE command_id = v_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION InsertOrUpdateCommandEntity (v_user_id uuid, v_command_id uuid, v_command_type int, v_parent_command_id uuid, v_root_command_id uuid, v_job_id uuid, v_step_id uuid, v_command_parameters text, v_command_params_class varchar(256), v_created_at timestamp WITH TIME ZONE, v_status varchar(20), v_executed boolean, v_callback_enabled boolean, v_return_value text, v_return_value_class varchar(256)) RETURNS VOID AS $procedure$ BEGIN IF NOT EXISTS (SELECT 1 from command_entities where command_id = v_command_id) THEN PERFORM InsertCommandEntity (v_user_id, v_command_id, v_command_type, v_parent_command_id, v_root_command_id, v_job_id, v_step_id, v_command_parameters, v_command_params_class, v_created_at, v_status, v_executed, v_callback_enabled, v_return_value, v_return_value_class); ELSE PERFORM UpdateCommandEntity (v_user_id, v_command_id, v_command_type, v_parent_command_id, v_root_command_id, v_job_id, v_step_id, v_command_parameters, v_command_params_class, v_status, v_executed, v_callback_enabled, v_return_value, v_return_value_class); END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetCommandEntityByCommandEntityId (v_command_id uuid) RETURNS SETOF command_entities AS $procedure$ BEGIN RETURN QUERY SELECT command_entities.* FROM command_entities WHERE command_id = v_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllFromCommandEntities () RETURNS SETOF command_entities AS $procedure$ BEGIN RETURN QUERY SELECT * from command_entities; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetCommandEntitiesByParentCmdId (v_root_command_id uuid) RETURNS SETOF command_entities STABLE AS $procedure$ BEGIN RETURN QUERY SELECT command_entities.* FROM command_entities WHERE root_command_id = v_root_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DeleteCommandEntity(v_command_id uuid) RETURNS VOID AS $procedure$ BEGIN BEGIN delete from command_entities where command_id = v_command_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteCommandEntitiesOlderThanDate(v_date TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ DECLARE v_id INTEGER; SWV_RowCount INTEGER; BEGIN DELETE FROM command_entities WHERE CREATED_AT < v_date and command_id NOT IN(SELECT command_id FROM async_tasks); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertCommandAssociatedEntities( v_command_id UUID, v_entity_id UUID, v_entity_type varchar(128)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO command_assoc_entities (command_id,entity_id,entity_type) VALUES (v_command_id, v_entity_id, v_entity_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetCommandIdsByEntityId(v_entity_id UUID) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT command_id from command_assoc_entities where entity_id = v_entity_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetCommandAssociatedEntities(v_command_id UUID) RETURNS SETOF command_assoc_entities STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM command_assoc_entities WHERE command_id = v_command_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (not exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin insert into vdc_options (option_name, option_value, version) values (v_option_name, v_option_value, v_version); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value_all_versions(v_option_name varchar(100)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name)) then begin delete from vdc_options where option_name ilike v_option_name; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value(v_option_name varchar(100), v_version text) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)))) then begin delete from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_for_version(v_version text) returns void AS $procedure$ BEGIN delete from vdc_options where version in (select ID from fnSplitter(v_version)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin update vdc_options set option_value = v_option_value where option_name ilike v_option_name and version = v_version; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_default_config_value(v_option_name varchar(100),v_default_option_value varchar(4000),v_option_value varchar(4000),v_version varchar(40),v_ignore_default_value_case boolean) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin if (v_ignore_default_value_case) then update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value ilike v_default_option_value and version = v_version; else update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value = v_default_option_value and version = v_version; end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_rename_config_key(v_old_option_name varchar(100),v_new_option_name varchar(100),v_version varchar(40)) returns void AS $procedure$ DECLARE v_current_option_value varchar(4000); begin if (exists (select 1 from vdc_options where option_name ilike v_old_option_name and version = v_version)) then v_current_option_value:=option_value from vdc_options where option_name ilike v_old_option_name and version = v_version; update vdc_options set option_name = v_new_option_name, option_value = v_current_option_value where option_name ilike v_old_option_name and version = v_version; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'public' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'public' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'public' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'public' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and table_schema = 'public' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION attach_user_to_role ( v_user_name VARCHAR(255), v_domain VARCHAR(255), v_namespace VARCHAR(255), v_domain_entry_id text, v_role_name VARCHAR(255) ) RETURNS void AS $BODY$ DECLARE selected_user_id uuid; input_role_id uuid; BEGIN select roles.id into input_role_id from roles where roles.name = v_role_name; -- The external identifier is the user identifier converted to an array of -- bytes: insert into users(user_id,external_id, namespace,name,domain,username,last_admin_check_status) select uuid_generate_v1(), v_domain_entry_id, v_namespace, v_user_name, v_domain, v_user_name,true where not exists (select 1 from users where domain = v_domain and external_id = v_domain_entry_id); select user_id from users where domain = v_domain and external_id = v_domain_entry_id into selected_user_id; insert into permissions(id,role_id,ad_element_id,object_id,object_type_id) select uuid_generate_v1(), input_role_id, selected_user_id, getGlobalIds('system'), 1 where not exists(select role_id,ad_element_id,object_id,object_type_id from permissions where role_id = input_role_id and ad_element_id = selected_user_id and object_id= getGlobalIds('system') and object_type_id = 1); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(role_id,action_group_id) SELECT v_role_id, v_action_group_id WHERE NOT EXISTS (SELECT 1 FROM roles_groups WHERE role_id = v_role_id AND action_group_id = v_action_group_id); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) RETURNS void AS $BODY$ declare v_old_value varchar(4000); v_cur cursor for select distinct version from vdc_options where version <> 'general' order by version; v_version varchar(40); v_index integer; v_count integer; v_total_count integer; v_version_count integer; begin v_total_count := count(version) from vdc_options where option_name = v_option_name; v_old_value := option_value from vdc_options where option_name = v_option_name and version = 'general'; v_version_count := count(distinct version) from vdc_options where version <> 'general'; if (v_total_count <= v_version_count) then begin if (v_old_value IS NULL) then v_old_value := v_old_option_value; end if; v_count := count(distinct version) from vdc_options where version <> 'general'; v_index := 1; open v_cur; loop fetch v_cur into v_version; exit when not found; -- We shouldn't update if already exists if (not exists (select 1 from vdc_options where option_name = v_option_name and version = v_version)) then -- Might not work well for versions such as 3.10, but we currently don't have any if (v_version >= v_update_from_version) then insert into vdc_options (option_name, option_value, version) values (v_option_name, v_new_option_value, v_version); else insert into vdc_options (option_name, option_value, version) values (v_option_name, v_old_value, v_version); end if; end if; v_index := v_index +1; end loop; close v_cur; delete from vdc_options where option_name = v_option_name and version = 'general'; end; end if; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_grant_action_group_to_all_roles_filter(v_action_group_id integer, uuid[]) RETURNS void AS $BODY$ declare v_role_id_to_filter alias for $2; begin insert into roles_groups (role_id, action_group_id) select distinct role_id, v_action_group_id from roles_groups rg where not ARRAY [role_id] <@ v_role_id_to_filter and not exists (select 1 from roles_groups where role_id = rg.role_id and action_group_id = v_action_group_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_column_to_object_white_list(v_object_name varchar(128), v_column_name varchar(128)) returns void AS $procedure$ begin if (not exists (select 1 from object_column_white_list where object_name = v_object_name and column_name = v_column_name)) then begin -- verify that there is such object in db if exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = v_object_name and column_name = v_column_name) then insert into object_column_white_list (object_name, column_name) values (v_object_name, v_column_name); end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_disk(v_id UUID) returns void AS $procedure$ declare OK integer; LOCKED integer; begin OK:=1; LOCKED:=2; update images set imagestatus = OK where imagestatus = LOCKED and image_group_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_snapshot(v_id UUID) returns void AS $procedure$ declare OK varchar; LOCKED varchar; begin OK:='OK'; LOCKED:='LOCKED'; update snapshots set status = OK where status = LOCKED and snapshot_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_entity(v_object_type varchar(10), v_name varchar(255), v_recursive boolean) returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; v_id UUID; begin DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; --unlock images and snapshots if recursive flag is set if (v_recursive) then update images set imagestatus = OK where imagestatus = LOCKED and image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED and vm_id = v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_all() returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; BEGIN DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED; update vm_dynamic set status = DOWN where status = IMAGE_LOCKED; update images set imagestatus = OK where imagestatus = LOCKED; update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Displays DC id , DC name, SPM Host id , SPM Host name and number of async tasks awaiting. 1) create a record type with DC name, DC id, SPM host id, SPM host name, count 2) get all distinct DC ids from async_tasks table 3) Run a cursor for each result in 2) a) get DC name b) get SPM Host id & name if available c) get count of tasks return current record 4) return set of generated records */ DROP TYPE IF EXISTS async_tasks_info_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** create or replace FUNCTION fn_db_get_async_tasks() returns SETOF async_tasks_info_rs STABLE AS $procedure$ DECLARE v_record async_tasks_info_rs; -- selects storage_pool_id uuid found in async_tasks v_tasks_cursor cursor for select distinct storage_pool_id from async_tasks; begin OPEN v_tasks_cursor; FETCH v_tasks_cursor into v_record.dc_id; WHILE FOUND LOOP -- get dc_name and SPM Host id v_record.dc_name := name from storage_pool where id = v_record.dc_id; v_record.spm_host_id := spm_vds_id from storage_pool where id = v_record.dc_id; -- get Host name if we have non NULL SPM Host if (v_record.spm_host_id IS NOT NULL) then v_record.spm_host_name := vds_name from vds_static where vds_id = v_record.spm_host_id; else v_record.spm_host_name:=''; end if; -- get tasks count for this DC v_record.task_count := count(*) from async_tasks where position (cast(v_record.dc_id as varchar) in action_parameters) > 0; -- return the record RETURN NEXT v_record; FETCH v_tasks_cursor into v_record.dc_id; END LOOP; CLOSE v_tasks_cursor; -- return full set of generated records RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ DECLARE v varchar[]; e varchar; v_result varchar; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; FOR e in select unnest(v) LOOP IF (e != v_value) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_uuid_from_csv(v_csv_text text, v_uuid uuid) returns text STABLE AS $procedure$ DECLARE v uuid[]; e uuid; v_result text; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(v_csv_text, ','); FOR e in select unnest(v) LOOP IF (e != v_uuid) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; IF (v_result = '') THEN v_result := null; END IF; return v_result; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetCpuProfileByCpuProfileId(v_id UUID) RETURNS SETOF cpu_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cpu_profiles WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertCpuProfile(v_id UUID, v_name VARCHAR(50), v_cluster_id UUID, v_qos_id UUID, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO cpu_profiles(id, name, cluster_id, qos_id, description) VALUES(v_id, v_name, v_cluster_id, v_qos_id, v_description); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateCpuProfile(v_id UUID, v_name VARCHAR(50), v_cluster_id UUID, v_qos_id UUID, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE cpu_profiles SET id = v_id, name = v_name, cluster_id = v_cluster_id, qos_id = v_qos_id, description = v_description, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteCpuProfile(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN DELETE FROM cpu_profiles WHERE id = v_id; -- Delete the cpu profiles permissions DELETE FROM permissions WHERE object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromCpuProfiles() RETURNS SETOF cpu_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cpu_profiles; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetCpuProfilesByClusterId ( v_cluster_id UUID, v_user_id UUID, v_is_filtered boolean, v_action_group_id INTEGER ) RETURNS SETOF cpu_profiles STABLE AS $PROCEDURE$ DECLARE v_everyone_object_id UUID; BEGIN v_everyone_object_id := getGlobalIds('everyone'); RETURN QUERY SELECT * FROM cpu_profiles WHERE cluster_id = v_cluster_id AND ( NOT v_is_filtered OR ( EXISTS ( SELECT 1 FROM user_cpu_profile_permissions_view NATURAL JOIN roles_groups WHERE user_id IN (v_user_id, v_everyone_object_id) AND entity_id = cpu_profiles.id AND action_group_id = v_action_group_id ) ) ) ORDER BY _create_date; END;$PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetCpuProfilesByQosId(v_qos_id UUID) RETURNS SETOF cpu_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM cpu_profiles WHERE qos_id = v_qos_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertcustom_actions(INOUT v_action_id INTEGER , v_action_name VARCHAR(50), v_path VARCHAR(300), v_tab INTEGER , v_description VARCHAR(4000)) AS $procedure$ BEGIN INSERT INTO custom_actions(action_name, path, tab, description) VALUES(v_action_name, v_path, v_tab, v_description); v_action_id := CURRVAL('custom_actions_seq'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatecustom_actions(v_action_id INTEGER, v_action_name VARCHAR(50), v_path VARCHAR(300), v_tab INTEGER , v_description VARCHAR(4000)) RETURNS VOID AS $procedure$ BEGIN UPDATE custom_actions SET action_name = v_action_name,path = v_path,tab = v_tab,description = v_description WHERE action_id = v_action_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletecustom_actions(v_action_id INTEGER) RETURNS VOID AS $procedure$ BEGIN DELETE FROM custom_actions WHERE action_id = v_action_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromcustom_actions() RETURNS SETOF custom_actions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM custom_actions; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getcustom_actionsByaction_id(v_action_id INTEGER) RETURNS SETOF custom_actions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM custom_actions WHERE action_id = v_action_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getcustom_actionsByTab_id(v_tab INTEGER) RETURNS SETOF custom_actions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM custom_actions WHERE tab = v_tab; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getcustom_actionsByNameAndTab(v_action_name VARCHAR(50), v_tab INTEGER) RETURNS SETOF custom_actions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM custom_actions WHERE tab = v_tab and action_name = v_action_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertdisk_image_dynamic(v_image_id UUID, v_read_rate INTEGER , v_write_rate INTEGER , v_actual_size BIGINT, v_read_latency_seconds numeric(18,9), v_write_latency_seconds numeric(18,9), v_flush_latency_seconds numeric(18,9) ) RETURNS VOID AS $procedure$ BEGIN INSERT INTO disk_image_dynamic(image_id, read_rate, write_rate, actual_size, read_latency_seconds, write_latency_seconds, flush_latency_seconds) VALUES(v_image_id, v_read_rate, v_write_rate, v_actual_size, v_read_latency_seconds, v_write_latency_seconds, v_flush_latency_seconds); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatedisk_image_dynamic(v_image_id UUID, v_read_rate INTEGER , v_write_rate INTEGER , v_actual_size BIGINT , v_read_latency_seconds numeric(18,9) , v_write_latency_seconds numeric(18,9) , v_flush_latency_seconds numeric(18,9)) RETURNS VOID AS $procedure$ BEGIN UPDATE disk_image_dynamic SET read_rate = v_read_rate,write_rate = v_write_rate,actual_size = v_actual_size,read_latency_seconds = v_read_latency_seconds,write_latency_seconds = v_write_latency_seconds,flush_latency_seconds = v_flush_latency_seconds, _update_date = LOCALTIMESTAMP WHERE image_id = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatedisk_image_dynamic_by_disk_id_and_vm_id(v_image_group_id UUID, v_vm_id UUID, v_read_rate INTEGER , v_write_rate INTEGER , v_actual_size BIGINT , v_read_latency_seconds numeric(18,9) , v_write_latency_seconds numeric(18,9) , v_flush_latency_seconds numeric(18,9)) RETURNS VOID AS $procedure$ BEGIN UPDATE disk_image_dynamic SET read_rate = v_read_rate,write_rate = v_write_rate,actual_size = v_actual_size,read_latency_seconds = v_read_latency_seconds,write_latency_seconds = v_write_latency_seconds,flush_latency_seconds = v_flush_latency_seconds, _update_date = LOCALTIMESTAMP WHERE image_id in (SELECT distinct image_guid FROM images WHERE image_group_id = v_image_group_id and active = true) AND EXISTS (SELECT 1 FROM vm_device vmd WHERE vmd.vm_id = v_vm_id AND vmd.device_id = v_image_group_id AND vmd.snapshot_id is NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletedisk_image_dynamic(v_image_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM disk_image_dynamic WHERE image_id = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromdisk_image_dynamic() RETURNS SETOF disk_image_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_image_dynamic; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getdisk_image_dynamicByimage_id(v_image_id UUID) RETURNS SETOF disk_image_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_image_dynamic WHERE image_id = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TRIGGER IF EXISTS delete_disk_image_dynamic_for_image ON images; ************************** DROP TRIGGER ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_image_deleted() RETURNS TRIGGER AS $$ BEGIN DELETE FROM disk_image_dynamic dim WHERE DIM.image_id = OLD.image_guid; RETURN OLD; END; $$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE TRIGGER delete_disk_image_dynamic_for_image BEFORE DELETE ON IMAGES FOR EACH ROW EXECUTE PROCEDURE fn_image_deleted(); ************************** CREATE TRIGGER ********* QUERY ********** Create or replace FUNCTION GetImageByImageGuid(v_image_guid UUID) RETURNS SETOF vm_images_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_images_view WHERE image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAncestralImageByImageGuid(v_image_guid UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY WITH RECURSIVE ancestor_image(image_guid, parentid) AS ( SELECT image_guid, parentid FROM images WHERE image_guid = v_image_guid UNION ALL SELECT i.image_guid, i.parentid FROM images i, ancestor_image ai WHERE i.image_guid = ai.parentid ) SELECT i.* FROM ancestor_image ai, images_storage_domain_view i WHERE ai.parentid = '00000000-0000-0000-0000-000000000000' AND ai.image_guid = i.image_guid AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_permissions_view WHERE user_disk_permissions_view.user_id = v_user_id AND user_disk_permissions_view.entity_id = i.image_group_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotByGuid(v_image_guid UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images_storage_domain_view images_storage_domain_view WHERE image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images_storage_domain_view images_storage_domain_view WHERE storage_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotByParentGuid(v_parent_guid UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images_storage_domain_view images_storage_domain_view WHERE ParentId = v_parent_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotByLeafGuid(v_image_guid UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY WITH RECURSIVE image_list AS ( SELECT * FROM images_storage_domain_view WHERE image_guid = v_image_guid UNION ALL SELECT images_storage_domain_view.* FROM images_storage_domain_view JOIN image_list ON image_list.parentid = images_storage_domain_view.image_guid AND image_list.image_group_id = images_storage_domain_view.image_group_id ) SELECT * FROM image_list; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmImageByImageGuid(v_image_guid UUID) RETURNS SETOF vm_images_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_images_view WHERE image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotsByVmSnapshotId(v_vm_snapshot_id UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images_storage_domain_view images_storage_domain_view WHERE vm_snapshot_id = v_vm_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAttachedDiskSnapshotsToVm(v_vm_guid UUID, v_is_plugged BOOLEAN) RETURNS SETOF images_storage_domain_view AS $procedure$ BEGIN RETURN QUERY SELECT images_storage_domain_view.* FROM images_storage_domain_view JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id WHERE vm_device.vm_id = v_vm_guid AND (v_is_plugged IS NULL OR vm_device.is_plugged = v_is_plugged) AND vm_device.snapshot_id IS NOT NULL AND vm_device.snapshot_id = images_storage_domain_view.vm_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotsByImageGroupId(v_image_group_id UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images_storage_domain_view images_storage_domain_view WHERE image_group_id = v_image_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskSnapshotForVmSnapshot(v_image_group_id UUID, v_vm_snapshot_id UUID) RETURNS SETOF images_storage_domain_view AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images_storage_domain_view WHERE image_group_id = v_image_group_id AND vm_snapshot_id = v_vm_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllForStorageDomain(v_storage_domain_id UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT images_storage_domain_view.* FROM images_storage_domain_view WHERE active AND images_storage_domain_view.storage_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetImagesWhichHaveNoDisk(v_vm_id UUID) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT i.* FROM images_storage_domain_view i JOIN snapshots s ON (i.vm_snapshot_id = s.snapshot_id) WHERE s.vm_id = v_vm_id AND NOT EXISTS ( SELECT 1 FROM base_disks d WHERE d.disk_id = i.image_group_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllForDiskProfiles(v_disk_profile_ids UUID[]) RETURNS SETOF images_storage_domain_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT images_storage_domain_view.* FROM images_storage_domain_view WHERE images_storage_domain_view.disk_profile_id = ANY(v_disk_profile_ids); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertDiskLunMap( v_disk_id UUID, v_lun_id VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO disk_lun_map( disk_id, lun_id) VALUES( v_disk_id, v_lun_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteDiskLunMap(v_disk_id UUID, v_lun_id VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM disk_lun_map WHERE disk_id = v_disk_id AND lun_id = v_lun_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromDiskLunMaps() RETURNS SETOF disk_lun_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_lun_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskLunMapByDiskLunMapId(v_disk_id UUID, v_lun_id VARCHAR(50)) RETURNS SETOF disk_lun_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_lun_map WHERE disk_id = v_disk_id AND lun_id = v_lun_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskLunMapByLunId(v_lun_id VARCHAR(50)) RETURNS SETOF disk_lun_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_lun_map WHERE lun_id = v_lun_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskProfileByDiskProfileId(v_id UUID) RETURNS SETOF disk_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_profiles WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertDiskProfile(v_id UUID, v_name VARCHAR(50), v_storage_domain_id UUID, v_qos_id UUID, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO disk_profiles(id, name, storage_domain_id, qos_id, description) VALUES(v_id, v_name, v_storage_domain_id, v_qos_id, v_description); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateDiskProfile(v_id UUID, v_name VARCHAR(50), v_storage_domain_id UUID, v_qos_id UUID, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE disk_profiles SET id = v_id, name = v_name, storage_domain_id = v_storage_domain_id, qos_id = v_qos_id, description = v_description, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteDiskProfile(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN DELETE FROM disk_profiles WHERE id = v_id; -- Delete the disk profiles permissions DELETE FROM permissions WHERE object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromDiskProfiles() RETURNS SETOF disk_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_profiles; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskProfilesByStorageDomainId(v_storage_domain_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF disk_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_profiles WHERE storage_domain_id = v_storage_domain_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_disk_profile_permissions_view WHERE user_id = v_user_id AND entity_id = disk_profiles.id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION nullifyQosForStorageDomain(v_storage_domain_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE disk_profiles SET qos_id = NULL WHERE storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDiskProfilesByQosId(v_qos_id UUID) RETURNS SETOF disk_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM disk_profiles WHERE qos_id = v_qos_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateDwhHistoryTimekeeping(v_var_name VARCHAR(50), v_var_value VARCHAR(255), v_var_datetime TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN UPDATE dwh_history_timekeeping SET var_value = v_var_value, var_datetime = v_var_datetime WHERE var_name = v_var_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDwhHistoryTimekeepingByVarName(v_var_name VARCHAR(50)) RETURNS SETOF dwh_history_timekeeping STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM dwh_history_timekeeping WHERE var_name = v_var_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION clear_osinfo() RETURNS VOID AS $procedure$ BEGIN TRUNCATE dwh_osinfo; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION insert_osinfo(v_os_id INTEGER , v_os_name VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN INSERT into dwh_osinfo (os_id, os_name) VALUES (v_os_id, v_os_name); UPDATE dwh_history_timekeeping SET var_datetime = now() where var_name = 'lastOsinfoUpdate'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION LogEngineBackupEvent(v_scope VARCHAR(64), v_done_at TIMESTAMP WITH TIME ZONE , v_status INTEGER, v_output_message TEXT, v_fqdn varchar(255), v_log_path TEXT) RETURNS VOID AS $procedure$ BEGIN IF v_status = -1 THEN INSERT INTO engine_backup_log(scope, done_at,is_passed, output_message, fqdn, log_path) VALUES(v_scope, v_done_at, false, v_output_message, v_fqdn, v_log_path); INSERT INTO audit_log(log_time, log_type_name, log_type, severity, message) VALUES(v_done_at, 'ENGINE_BACKUP_FAILED', 9026, 2, v_output_message); ELSIF v_status = 0 THEN INSERT INTO audit_log(log_time, log_type_name, log_type, severity, message) VALUES(v_done_at, 'ENGINE_BACKUP_STARTED', 9024, 0, v_output_message); ELSIF v_status = 1 THEN INSERT INTO engine_backup_log(scope, done_at,is_passed, output_message, fqdn, log_path) VALUES(v_scope, v_done_at, true, v_output_message, v_fqdn, v_log_path); -- Clean alerts PERFORM DeleteBackupRelatedAlerts(); INSERT INTO audit_log(log_time, log_type_name, log_type, severity, message) VALUES(v_done_at, 'ENGINE_BACKUP_COMPLETED', 9025, 0, v_output_message); END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetLastSuccessfulEngineBackup(v_scope VARCHAR(64)) RETURNS SETOF engine_backup_log STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM engine_backup_log WHERE scope = v_scope and is_passed ORDER BY scope, done_at DESC LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertEngineSession(INOUT v_id INTEGER, v_engine_session_id text, v_user_id UUID, v_user_name VARCHAR(255), v_group_ids VARCHAR(2048), v_role_ids VARCHAR(2048)) RETURNS INTEGER AS $procedure$ BEGIN INSERT INTO engine_sessions(engine_session_id, user_id, user_name, group_ids, role_ids) VALUES(v_engine_session_id, v_user_id, v_user_name, v_group_ids, v_role_ids); v_id := CURRVAL('engine_session_seq'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetEngineSession(v_id INTEGER) RETURNS SETOF engine_sessions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM engine_sessions WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetEngineSessionBySessionId(v_engine_session_id text) RETURNS SETOF engine_sessions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM engine_sessions WHERE engine_session_id = v_engine_session_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteEngineSession(v_id INTEGER) RETURNS integer AS $procedure$ DECLARE deleted_rows int; BEGIN DELETE FROM engine_sessions WHERE id = v_id; GET DIAGNOSTICS deleted_rows = ROW_COUNT; RETURN deleted_rows; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAllFromEngineSessions() RETURNS integer AS $procedure$ DECLARE deleted_rows int; BEGIN DELETE FROM engine_sessions; GET DIAGNOSTICS deleted_rows = ROW_COUNT; RETURN deleted_rows; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION insertevent_notification_hist(v_audit_log_id BIGINT, v_event_name VARCHAR(100), v_method_type CHAR(10), v_reason CHAR(255) , v_sent_at TIMESTAMP WITH TIME ZONE, v_status BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO event_notification_hist(audit_log_id, event_name, method_type, reason, sent_at, status) VALUES(v_audit_log_id, v_event_name, v_method_type, v_reason, v_sent_at, v_status); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertevent_subscriber(v_event_up_name VARCHAR(100), v_notification_method VARCHAR(32), v_method_address VARCHAR(255), v_subscriber_id UUID, v_tag_name VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN if not exists(select * from event_subscriber where subscriber_id = v_subscriber_id and event_up_name = v_event_up_name and notification_method = v_notification_method and tag_name = v_tag_name) then INSERT INTO event_subscriber(event_up_name, notification_method, method_address, subscriber_id, tag_name) VALUES(v_event_up_name, v_notification_method, v_method_address, v_subscriber_id,v_tag_name); end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getevent_subscriberBysubscriber_id(v_subscriber_id UUID) RETURNS SETOF event_subscriber STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM event_subscriber WHERE subscriber_id = v_subscriber_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deleteevent_subscriber(v_event_up_name VARCHAR(100) , v_notification_method VARCHAR(32), v_subscriber_id UUID, v_tag_name VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN if (v_tag_name IS NULL) then delete from event_subscriber where event_up_name = v_event_up_name and notification_method = v_notification_method and subscriber_id = v_subscriber_id; else delete from event_subscriber where event_up_name = v_event_up_name and notification_method = v_notification_method and subscriber_id = v_subscriber_id and tag_name = v_tag_name; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deleteevent_notification_hist(v_sent_at TIMESTAMP) RETURNS VOID AS $procedure$ BEGIN DELETE FROM event_notification_hist WHERE sent_at < v_sent_at; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION InsertExternalVariable( v_var_name VARCHAR(100), v_var_value VARCHAR(4000)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO external_variable( var_name, var_value ) VALUES ( v_var_name, v_var_value ); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateExternalVariable( v_var_name VARCHAR(100), v_var_value VARCHAR(4000)) RETURNS BOOLEAN AS $procedure$ BEGIN UPDATE external_variable SET var_value = v_var_value, _update_date = LOCALTIMESTAMP WHERE var_name = v_var_name; RETURN found; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpsertExternalVariable( v_var_name VARCHAR(100), v_var_value VARCHAR(4000)) RETURNS VOID AS $procedure$ DECLARE record_found BOOLEAN; BEGIN SELECT UpdateExternalVariable( v_var_name, v_var_value ) INTO record_found; IF NOT record_found THEN PERFORM InsertExternalVariable( v_var_name, v_var_value ); END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DeleteExternalVariable( v_var_name VARCHAR(100)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM external_variable WHERE var_name = v_var_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetExternalVariableByName( v_var_name VARCHAR(100)) RETURNS SETOF external_variable STABLE AS $procedure$ BEGIN RETURN QUERY SELECT external_variable.* FROM external_variable WHERE var_name = v_var_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetFenceAgentsByVdsId(v_vds_guid UUID) RETURNS SETOF fence_agents STABLE AS $procedure$ BEGIN RETURN QUERY SELECT fence_agents.* FROM fence_agents WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetFenceAgentById(v_guid UUID) RETURNS SETOF fence_agents STABLE AS $procedure$ BEGIN RETURN QUERY SELECT fence_agents.* FROM fence_agents WHERE id = v_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteFenceAgent(v_guid UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM fence_agents WHERE id = v_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteFenceAgentsByVdsId(v_vds_guid UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM fence_agents WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateFenceAgent(v_guid UUID , v_vds_id UUID , v_agent_order INTEGER , v_ip VARCHAR(255) , v_type VARCHAR(255) , v_agent_user VARCHAR(255) , v_agent_password text , v_options text , v_encrypt_options BOOLEAN, v_port INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE fence_agents SET vds_id = v_vds_id, agent_order = v_agent_order, ip = v_ip, type = v_type, agent_user = v_agent_user, agent_password = v_agent_password, port = v_port, options = v_options, encrypt_options = v_encrypt_options WHERE id = v_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertFenceAgent( v_id UUID, v_vds_id UUID , v_agent_order INTEGER , v_ip VARCHAR(255) , v_type VARCHAR(255) , v_agent_user VARCHAR(255) , v_agent_password text , v_options text , v_encrypt_options BOOLEAN, v_port INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO fence_agents( id, vds_id, agent_order, ip, type, agent_user, agent_password, options, encrypt_options, port) VALUES ( v_id, v_vds_id, v_agent_order, v_ip, v_type, v_agent_user, v_agent_password, v_options, v_encrypt_options, v_port); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Gluster Geo-replication related tables: - gluster_georep_session - gluster_georep_config - gluster_georep_session_details ----------------------------------------------------------------*/ Create or replace FUNCTION InsertGlusterGeoRepSession(v_session_id UUID, v_master_volume_id UUID, v_session_key VARCHAR(150), v_slave_host_name VARCHAR(50), v_slave_host_uuid UUID, v_slave_volume_name VARCHAR(50), v_slave_volume_id UUID, v_status VARCHAR(50), v_user_name VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_georep_session(session_id, master_volume_id, session_key, slave_host_name, slave_host_uuid, slave_volume_name, slave_volume_id, status, user_name) VALUES (v_session_id, v_master_volume_id, v_session_key, v_slave_host_name, v_slave_host_uuid, v_slave_volume_name, v_slave_volume_id, v_status, v_user_name); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterGeoRepSessionConfig(v_session_id UUID, v_config_key VARCHAR(50), v_config_value VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_georep_config(session_id, config_key, config_value) VALUES (v_session_id, v_config_key, v_config_value); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterGeoRepSessionDetail(v_session_id UUID, v_master_brick_id UUID, v_slave_host_name VARCHAR(50), v_slave_host_uuid UUID, v_status VARCHAR(20), v_checkpoint_status VARCHAR(20), v_crawl_status VARCHAR(20), v_data_pending BIGINT, v_entry_pending BIGINT, v_meta_pending BIGINT, v_failures BIGINT, v_last_synced_at TIMESTAMP, v_checkpoint_time TIMESTAMP, v_checkpoint_completed_time TIMESTAMP, v_is_checkpoint_completed BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_georep_session_details(session_id, master_brick_id, slave_host_name, slave_host_uuid, status, checkpoint_status, crawl_status, data_pending, entry_pending, meta_pending, failures, last_synced_at, checkpoint_time, checkpoint_completed_time, is_checkpoint_completed) VALUES (v_session_id, v_master_brick_id, v_slave_host_name, v_slave_host_uuid, v_status, v_checkpoint_status, v_crawl_status, v_data_pending, v_entry_pending, v_meta_pending, v_failures, v_last_synced_at, v_checkpoint_time, v_checkpoint_completed_time, v_is_checkpoint_completed); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterGeoRepSessionDetail(v_session_id UUID, v_master_brick_id UUID, v_slave_host_name VARCHAR(50), v_slave_host_uuid UUID, v_status VARCHAR(20), v_checkpoint_status VARCHAR(20), v_crawl_status VARCHAR(20), v_data_pending BIGINT, v_entry_pending BIGINT, v_meta_pending BIGINT, v_failures BIGINT, v_last_synced_at TIMESTAMP, v_checkpoint_time TIMESTAMP, v_checkpoint_completed_time TIMESTAMP, v_is_checkpoint_completed BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_georep_session_details SET slave_host_name = v_slave_host_name, slave_host_uuid = v_slave_host_uuid, status = v_status, checkpoint_status = v_checkpoint_status, crawl_status = v_crawl_status, data_pending = v_data_pending, entry_pending = v_entry_pending, meta_pending = v_meta_pending, failures = v_failures, last_synced_at = v_last_synced_at, checkpoint_time = v_checkpoint_time, checkpoint_completed_time = v_checkpoint_completed_time, is_checkpoint_completed = v_is_checkpoint_completed, _update_date = LOCALTIMESTAMP WHERE session_id = v_session_id AND master_brick_id = v_master_brick_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterGeoRepSessionConfig(v_session_id UUID, v_config_key VARCHAR(50), v_config_value VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_georep_config SET config_value = v_config_value, _update_date = LOCALTIMESTAMP WHERE session_id = v_session_id AND config_key = v_config_key; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionById(v_session_id UUID) RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view WHERE session_id = v_session_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionsByVolumeId(v_master_volume_id UUID) RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view WHERE master_volume_id = v_master_volume_id order by slave_volume_name asc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionsByClusterId(v_cluster_id UUID) RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view WHERE cluster_id = v_cluster_id order by slave_volume_name asc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionByKey(v_session_key VARCHAR(150)) RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view WHERE session_key = v_session_key; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionBySlaveHostAndVolume(v_master_volume_id UUID, v_slave_host_uuid UUID, v_slave_volume_name VARCHAR(150)) RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view WHERE master_volume_id = v_master_volume_id AND slave_host_uuid = v_slave_host_uuid AND slave_volume_name = v_slave_volume_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterGeoRepSessionStatus(v_session_id UUID, v_status VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_georep_session SET status = v_status, _update_date = LOCALTIMESTAMP WHERE session_id = v_session_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterGeoRepSession(v_session_id UUID, v_status VARCHAR(50), v_slave_host_uuid UUID, v_slave_volume_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_georep_session SET status = v_status, slave_host_uuid = v_slave_host_uuid, slave_volume_id = v_slave_volume_id, _update_date = LOCALTIMESTAMP WHERE session_id = v_session_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionDetails(v_session_id UUID) RETURNS SETOF gluster_georep_session_details STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_session_details WHERE session_id = v_session_id order by slave_host_name asc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionDetailsForBrick(v_session_id UUID, v_master_brick_id UUID) RETURNS SETOF gluster_georep_session_details STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_session_details WHERE session_id = v_session_id AND master_brick_id = v_master_brick_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionConfig(v_session_id UUID) RETURNS SETOF gluster_geo_rep_config_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_geo_rep_config_view WHERE session_id = v_session_id order by config_key asc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionUnSetConfig(v_session_id UUID) RETURNS SETOF gluster_config_master STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_config_master WHERE gluster_config_master.config_feature = 'geo_replication' AND gluster_config_master.config_key NOT IN (SELECT config_key from gluster_georep_config WHERE gluster_georep_config.session_id = v_session_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterGeoRepSessionConfigByKey(v_session_id UUID, v_config_key VARCHAR(50)) RETURNS SETOF gluster_geo_rep_config_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_geo_rep_config_view WHERE session_id = v_session_id AND config_key = v_config_key; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllGlusterGeoRepSessions() RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterGeoRepSession(v_session_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_georep_session WHERE session_id=v_session_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGeoRepSessionBySlaveVolume(v_slave_volume_id UUID) RETURNS SETOF gluster_georep_sessions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_georep_sessions_view WHERE slave_volume_id = v_slave_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Gluster Hooks related tables: - gluster_hooks - gluster_server_hooks ----------------------------------------------------------------*/ Create or replace FUNCTION InsertGlusterHook(v_id UUID, v_cluster_id UUID, v_gluster_command VARCHAR(128), v_stage VARCHAR(50), v_name VARCHAR(256), v_hook_status VARCHAR(50), v_content_type VARCHAR(50), v_checksum VARCHAR(256), v_content TEXT, v_conflict_status INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_hooks(id, cluster_id, gluster_command, stage, name, hook_status, content_type, checksum, content, conflict_status) VALUES (v_id, v_cluster_id, v_gluster_command, v_stage, v_name,v_hook_status, v_content_type, v_checksum, v_content, v_conflict_status); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterHookById(v_id UUID, v_includeContent BOOLEAN=false) RETURNS SETOF gluster_hooks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT id, cluster_id, gluster_command, stage, name, hook_status, content_type, checksum, CASE v_includeContent WHEN true THEN content ELSE null::text END as content, conflict_status, _create_date, _update_date FROM gluster_hooks WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterHookContentById(v_id UUID) RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT content FROM gluster_hooks WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterHooksByClusterId(v_cluster_id UUID) RETURNS SETOF gluster_hooks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT id, cluster_id, gluster_command, stage, name, hook_status, content_type, checksum, null::text as content, conflict_status, _create_date, _update_date FROM gluster_hooks WHERE cluster_id = v_cluster_id order by gluster_command asc, stage asc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerHooksById(v_id UUID) RETURNS SETOF gluster_server_hooks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server_hooks_view WHERE hook_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterHook(v_cluster_id UUID, v_gluster_command VARCHAR(1000), v_stage VARCHAR(100), v_name VARCHAR(1000), v_includeContent BOOLEAN=false) RETURNS SETOF gluster_hooks STABLE AS $procedure$ BEGIN RETURN QUERY SELECT id, cluster_id, gluster_command, stage, name, hook_status, content_type, checksum, CASE v_includeContent WHEN true THEN content ELSE null::text END as content, conflict_status, _create_date, _update_date FROM gluster_hooks WHERE cluster_id = v_cluster_id AND gluster_command = v_gluster_command AND stage = v_stage AND name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterHookById(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_hooks WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterHook(v_cluster_id UUID, v_gluster_command VARCHAR(1000), v_stage VARCHAR(100), v_name VARCHAR(1000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_hooks WHERE cluster_id = v_cluster_id AND gluster_command = v_gluster_command AND stage = v_stage AND name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAllGlusterHooks(v_cluster_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_hooks WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterHooksByIds(v_ids TEXT) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_hooks WHERE id in (select * from fnSplitterUuid(v_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterHookConflictStatus(v_id UUID, v_conflict_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_hooks SET conflict_status = v_conflict_status, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterHookContentType(v_id UUID, v_content_type VARCHAR(100)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_hooks SET content_type = v_content_type, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterHookContent(v_id UUID, v_checksum VARCHAR(256), v_content text) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_hooks SET checksum = v_checksum, content = v_content, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterHook(v_id UUID, v_hook_status VARCHAR(50), v_content_type VARCHAR(50), v_checksum VARCHAR(256), v_content TEXT, v_conflict_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_hooks SET hook_status = v_hook_status, content_type = v_content_type, checksum = v_checksum, content = v_content, conflict_status = v_conflict_status, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterHookStatus(v_id UUID, v_hook_status VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_hooks SET hook_status = v_hook_status, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterServerHook(v_hook_id UUID, v_server_id UUID, v_hook_status VARCHAR(50), v_content_type VARCHAR(50), v_checksum VARCHAR(256)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_server_hooks(hook_id, server_id, hook_status, content_type, checksum) VALUES(v_hook_id, v_server_id, v_hook_status, v_content_type, v_checksum); UPDATE gluster_hooks SET _update_date = LOCALTIMESTAMP WHERE id = v_hook_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerHook(v_hook_id UUID, v_server_id UUID) RETURNS SETOF gluster_server_hooks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server_hooks_view WHERE hook_id = v_hook_id AND server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServerHook(v_hook_id UUID, v_server_id UUID, v_hook_status VARCHAR(50), v_content_type VARCHAR(50), v_checksum VARCHAR(256)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server_hooks SET hook_status = v_hook_status, content_type = v_content_type, checksum = v_checksum, _update_date = LOCALTIMESTAMP WHERE hook_id = v_hook_id AND server_id = v_server_id; UPDATE gluster_hooks SET _update_date = LOCALTIMESTAMP WHERE id = v_hook_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServerHookStatus(v_hook_id UUID, v_server_id UUID, v_hook_status VARCHAR(100)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server_hooks SET hook_status = v_hook_status, _update_date = LOCALTIMESTAMP WHERE hook_id = v_hook_id AND server_id = v_server_id; UPDATE gluster_hooks SET _update_date = LOCALTIMESTAMP WHERE id = v_hook_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServerHookChecksum(v_hook_id UUID, v_server_id UUID, v_checksum VARCHAR(100)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server_hooks SET checksum = v_checksum, _update_date = LOCALTIMESTAMP WHERE hook_id = v_hook_id AND server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterServerHookById(v_hook_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_server_hooks WHERE hook_id = v_hook_id; UPDATE gluster_hooks SET _update_date = LOCALTIMESTAMP WHERE id = v_hook_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterServerHooksByIds(v_ids TEXT) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_server_hooks WHERE hook_id in (select * from fnSplitterUuid(v_ids)); UPDATE gluster_hooks SET _update_date = LOCALTIMESTAMP WHERE id in (select * from fnSplitterUuid(v_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterServerHook(v_hook_id UUID, v_server_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_server_hooks WHERE hook_id = v_hook_id AND server_id = v_server_id; UPDATE gluster_hooks SET _update_date = LOCALTIMESTAMP WHERE id = v_hook_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /*-------------------------------------------------------------- Stored procedures for database operations on gluster_server table --------------------------------------------------------------*/ Create or replace FUNCTION InsertGlusterServer(v_server_id UUID, v_gluster_server_uuid UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_server(server_id, gluster_server_uuid) VALUES (v_server_id, v_gluster_server_uuid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerByServerId(v_server_id UUID) RETURNS SETOF gluster_server STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server WHERE server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerByGlusterServerUUID(v_gluster_server_uuid UUID) RETURNS SETOF gluster_server STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server WHERE gluster_server_uuid = v_gluster_server_uuid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterServer(v_server_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_server WHERE server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterServerByGlusterServerUUID(v_gluster_server_uuid UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_server WHERE gluster_server_uuid = v_gluster_server_uuid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServer(v_server_id UUID, v_gluster_server_uuid UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server SET gluster_server_uuid = v_gluster_server_uuid WHERE server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServerKnownAddresses(v_server_id UUID, v_known_addresses VARCHAR(250)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server SET known_addresses = v_known_addresses WHERE server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION AddGlusterServerKnownAddress(v_server_id UUID, v_known_address VARCHAR(250)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server SET known_addresses = coalesce(known_addresses || ',', '') || v_known_address WHERE server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Services related tables: - gluster_service_types - gluster_services - gluster_cluster_services - gluster_server_services ----------------------------------------------------------------*/ Create or replace FUNCTION GetGlusterServiceTypes() RETURNS SETOF gluster_service_types STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_service_types; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServicesByType(v_service_type VARCHAR(100)) RETURNS SETOF gluster_services STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_services WHERE service_type = v_service_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterClusterServicesByClusterId(v_cluster_id UUID) RETURNS SETOF gluster_cluster_services STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_cluster_services WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterClusterServicesByClusterIdAndServiceType(v_cluster_id UUID, v_service_type VARCHAR(100)) RETURNS SETOF gluster_cluster_services STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_cluster_services WHERE cluster_id = v_cluster_id AND service_type = v_service_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerServicesByServerId(v_server_id UUID) RETURNS SETOF gluster_server_services_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server_services_view WHERE server_id = v_server_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerServicesByClusterId(v_cluster_id UUID) RETURNS SETOF gluster_server_services_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT s.* FROM gluster_server_services_view s, vds_static v WHERE s.server_id = v.vds_id AND v.vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerServicesByClusterIdAndServiceType(v_cluster_id UUID, v_service_type VARCHAR(100)) RETURNS SETOF gluster_server_services_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT s.* FROM gluster_server_services_view s, vds_static v WHERE s.server_id = v.vds_id AND v.vds_group_id = v_cluster_id AND s.service_type = v_service_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerServicesByServerIdAndServiceType(v_server_id UUID, v_service_type VARCHAR(100)) RETURNS SETOF gluster_server_services_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server_services_view WHERE server_id = v_server_id AND service_type = v_service_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServiceByGlusterServiceId(v_id UUID) RETURNS SETOF gluster_services STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_services WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServerServiceByGlusterServerServiceId(v_id UUID) RETURNS SETOF gluster_server_services_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server_services_view WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromGlusterServerServices() RETURNS SETOF gluster_server_services_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_server_services_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterServiceByTypeAndName(v_service_type VARCHAR(100), v_service_name VARCHAR(100)) RETURNS SETOF gluster_services STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_services WHERE service_type = v_service_type AND service_name = v_service_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromGlusterServices() RETURNS SETOF gluster_services STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_services; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterClusterService(v_cluster_id UUID, v_service_type VARCHAR(100), v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_cluster_services(cluster_id, service_type, status) VALUES (v_cluster_id, v_service_type, v_status); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterServerService(v_id UUID, v_server_id UUID, v_service_id UUID, v_pid INTEGER, v_status VARCHAR(32), v_message VARCHAR(1000)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_server_services(id, server_id, service_id, pid, status, message) VALUES (v_id, v_server_id, v_service_id, v_pid, v_status, v_message); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterClusterService(v_cluster_id UUID, v_service_type VARCHAR(100), v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_cluster_services SET status = v_status, _update_date = LOCALTIMESTAMP WHERE cluster_id = v_cluster_id AND service_type = v_service_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServerService(v_id UUID, v_pid INTEGER, v_status VARCHAR(32), v_message VARCHAR(1000)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server_services SET pid = v_pid, status = v_status, message = v_message, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterServerServiceByServerIdAndServiceType(v_server_id UUID, v_service_id UUID, v_pid INTEGER, v_status VARCHAR(32), v_message VARCHAR(1000)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_server_services SET pid = v_pid, status = v_status, message = v_message, _update_date = LOCALTIMESTAMP WHERE server_id = v_server_id AND service_id = v_service_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterServerService(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_server_services WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Gluster Volume Snapshot related tables: - gluster_volume_snapshot_schedules ----------------------------------------------------------------*/ Create or replace FUNCTION InsertGlusterVolumeSnapshotSchedule(v_volume_id UUID, v_job_id VARCHAR(256), v_snapshot_name_prefix VARCHAR(128), v_snapshot_description VARCHAR(1024), v_recurrence VARCHAR(128), v_time_zone VARCHAR(128), v_interval INTEGER, v_start_date TIMESTAMP WITH TIME ZONE, v_execution_time TIME, v_days VARCHAR(256), v_end_by TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_snapshot_schedules (volume_id, job_id, snapshot_name_prefix, snapshot_description, recurrence, time_zone, interval, start_date, execution_time, days, end_by) VALUES (v_volume_id, v_job_id, v_snapshot_name_prefix, v_snapshot_description, v_recurrence, v_time_zone, v_interval, v_start_date, v_execution_time, v_days, v_end_by); UPDATE gluster_volumes SET snapshot_scheduled = true WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotScheduleByVolumeId(v_volume_id UUID) RETURNS SETOF gluster_volume_snapshot_schedules_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshot_schedules_view WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeSnapshotScheduleByVolumeId(v_volume_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_snapshot_schedules WHERE volume_id = v_volume_id; UPDATE gluster_volumes SET snapshot_scheduled = false WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeSnapshotScheduleByVolumeId(v_volume_id UUID, v_job_id VARCHAR(256), v_snapshot_name_prefix VARCHAR(128), v_snapshot_description VARCHAR(1024), v_recurrence VARCHAR(128), v_time_zone VARCHAR(128), v_interval INTEGER, v_start_date TIMESTAMP WITH TIME ZONE, v_execution_time TIME, v_days VARCHAR(256), v_end_by TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_snapshot_schedules SET job_id = v_job_id, snapshot_name_prefix = v_snapshot_name_prefix, snapshot_description = v_snapshot_description, recurrence = v_recurrence, time_zone = v_time_zone, interval = v_interval, start_date = v_start_date, execution_time = v_execution_time, days = v_days, end_by = v_end_by, _update_date = LOCALTIMESTAMP WHERE volume_id = v_volume_id; UPDATE gluster_volumes SET snapshot_scheduled = true WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Gluster Volume Snapshot related tables: - gluster_volume_snapshots - gluster_volume_snapshot_config ----------------------------------------------------------------*/ Create or replace FUNCTION InsertGlusterVolumeSnapshot(v_snapshot_id UUID, v_snapshot_name VARCHAR(1000), v_volume_id UUID, v_description VARCHAR(1024), v_status VARCHAR(32), v__create_date TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_snapshots (snapshot_id, snapshot_name, volume_id, description, status, _create_date) VALUES (v_snapshot_id, v_snapshot_name, v_volume_id, v_description, v_status, v__create_date); PERFORM UpdateSnapshotCountInc(v_volume_id, 1); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotById(v_snapshot_id UUID) RETURNS SETOF gluster_volume_snapshots_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshots_view WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotsByVolumeId(v_volume_id UUID) RETURNS SETOF gluster_volume_snapshots_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshots_view WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotsByClusterId(v_cluster_id UUID) RETURNS SETOF gluster_volume_snapshots_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshots_view WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotByName(v_volume_id UUID, v_snapshot_name VARCHAR(1000)) RETURNS SETOF gluster_volume_snapshots_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshots_view WHERE volume_id = v_volume_id and snapshot_name = v_snapshot_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeSnapshotByGuid(v_snapshot_id UUID) RETURNS VOID AS $procedure$ DECLARE ref_volume_id UUID; BEGIN SELECT volume_id INTO ref_volume_id FROM gluster_volume_snapshots WHERE snapshot_id = v_snapshot_id; DELETE FROM gluster_volume_snapshots WHERE snapshot_id = v_snapshot_id; PERFORM UpdateSnapshotCountDec(ref_volume_id, 1); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeSnapshotsByVolumeId(v_volume_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_snapshots WHERE volume_id = v_volume_id; UPDATE gluster_volumes SET snapshot_count = 0 WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeSnapshotByName(v_volume_id UUID, v_snapshot_name VARCHAR(1000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_snapshots WHERE volume_id = v_volume_id AND snapshot_name = v_snapshot_name; PERFORM UpdateSnapshotCountDec(v_volume_id, 1); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumesSnapshotByIds(v_snapshot_ids VARCHAR(5000)) RETURNS VOID AS $procedure$ DECLARE v_volume_id UUID; v_snapshot_count integer; v_cur CURSOR FOR SELECT volume_id, count(volume_id) FROM gluster_volume_snapshots WHERE snapshot_id IN (SELECT * FROM fnSplitterUuid(v_snapshot_ids)) GROUP BY volume_id; BEGIN OPEN v_cur; LOOP FETCH v_cur INTO v_volume_id, v_snapshot_count; EXIT WHEN NOT FOUND; PERFORM UpdateSnapshotCountDec(v_volume_id, v_snapshot_count); END LOOP; CLOSE v_cur; DELETE FROM gluster_volume_snapshots WHERE snapshot_id in (select * from fnSplitterUuid(v_snapshot_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeSnapshotStatus(v_snapshot_id UUID, v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_snapshots SET status = v_status, _update_date = LOCALTIMESTAMP WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeSnapshotStatusByName(v_volume_id UUID, v_snapshot_name VARCHAR(1000), v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_snapshots SET status = v_status, _update_date = LOCALTIMESTAMP WHERE volume_id = v_volume_id AND snapshot_name = v_snapshot_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeSnapshotConfig(v_cluster_id UUID, v_volume_id UUID, v_param_name VARCHAR(128), v_param_value VARCHAR(128)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_snapshot_config (cluster_id, volume_id, param_name, param_value) VALUES (v_cluster_id, v_volume_id, v_param_name, v_param_value); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotConfigByClusterId(v_cluster_id UUID) RETURNS SETOF gluster_volume_snapshot_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshot_config WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotConfigByVolumeId(v_cluster_id UUID, v_volume_id UUID) RETURNS SETOF gluster_volume_snapshot_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshot_config WHERE cluster_id = v_cluster_id and volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotConfigByClusterIdAndName(v_cluster_id UUID, v_param_name VARCHAR(128)) RETURNS SETOF gluster_volume_snapshot_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshot_config WHERE cluster_id = v_cluster_id and volume_id IS NULL and param_name = v_param_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeSnapshotConfigByVolumeIdAndName(v_cluster_id UUID, v_volume_id UUID, v_param_name VARCHAR(128)) RETURNS SETOF gluster_volume_snapshot_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_snapshot_config WHERE cluster_id = v_cluster_id and volume_id = v_volume_id and param_name = v_param_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateConfigByClusterIdAndName(v_cluster_id UUID, v_param_name VARCHAR(128), v_param_value VARCHAR(128)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_snapshot_config SET param_value = v_param_value, _update_date = LOCALTIMESTAMP WHERE cluster_id = v_cluster_id AND volume_id IS NULL AND param_name = v_param_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateConfigByVolumeIdIdAndName(v_cluster_id UUID, v_volume_id UUID, v_param_name VARCHAR(128), v_param_value VARCHAR(128)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_snapshot_config SET param_value = v_param_value, _update_date = LOCALTIMESTAMP WHERE cluster_id = v_cluster_id AND volume_id = v_volume_id AND param_name = v_param_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateSnapshotCountInc(v_volume_id UUID, v_num int) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET snapshot_count = snapshot_count + v_num WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateSnapshotCountDec(v_volume_id UUID, v_num int) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET snapshot_count = snapshot_count - v_num WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Gluster Volume related tables: - gluster_volumes - gluster_volume_bricks - gluster_volume_options - gluster_volume_access_protocols - gluster_volume_transport_types ----------------------------------------------------------------*/ Create or replace FUNCTION InsertGlusterVolume(v_id UUID, v_cluster_id UUID, v_vol_name VARCHAR(1000), v_vol_type VARCHAR(32), v_status VARCHAR(32), v_replica_count INTEGER, v_stripe_count INTEGER, v_disperse_count INTEGER, v_redundancy_count INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volumes (id, cluster_id, vol_name, vol_type, status, replica_count, stripe_count, disperse_count, redundancy_count) VALUES (v_id, v_cluster_id, v_vol_name, v_vol_type, v_status, v_replica_count, v_stripe_count, v_disperse_count, v_redundancy_count); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeDetails(v_volume_id UUID, v_total_space bigint, v_used_space bigint, v_free_space bigint) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_details (volume_id, total_space, used_space, free_space, _update_date) VALUES (v_volume_id, v_total_space, v_used_space, v_free_space, LOCALTIMESTAMP); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeBrick(v_id UUID, v_volume_id UUID, v_server_id UUID, v_brick_dir VARCHAR(4096), v_brick_order INTEGER, v_status VARCHAR(32), v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_bricks (id, volume_id, server_id, brick_dir, brick_order, status, network_id) VALUES (v_id, v_volume_id, v_server_id, v_brick_dir, v_brick_order, v_status, v_network_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeBrickDetails(v_brick_id UUID, v_total_space bigint, v_used_space bigint, v_free_space bigint) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_brick_details (brick_id, total_space, used_space, free_space, _update_date) VALUES (v_brick_id, v_total_space, v_used_space, v_free_space, LOCALTIMESTAMP); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeOption(v_id UUID, v_volume_id UUID, v_option_key VARCHAR(8192), v_option_val VARCHAR(8192)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_options (id, volume_id, option_key, option_val) VALUES (v_id, v_volume_id, v_option_key, v_option_val); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeAccessProtocol(v_volume_id UUID, v_access_protocol VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_access_protocols (volume_id, access_protocol) VALUES (v_volume_id, v_access_protocol); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertGlusterVolumeTransportType(v_volume_id UUID, v_transport_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO gluster_volume_transport_types (volume_id, transport_type) VALUES (v_volume_id, v_transport_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumesByClusterGuid(v_cluster_id UUID) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumesByOption(v_cluster_id UUID, v_status VARCHAR(32), v_option_key VARCHAR(8192), v_option_val VARCHAR(8192)) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE cluster_id = v_cluster_id AND status = v_status AND id IN (SELECT volume_id FROM gluster_volume_options WHERE option_key=v_option_key AND option_val=v_option_val); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumesByStatusTypesAndOption(v_cluster_id UUID, v_status VARCHAR(32), v_vol_types text, v_option_key VARCHAR(8192), v_option_val VARCHAR(8192)) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE cluster_id = v_cluster_id AND status = v_status AND vol_type IN (SELECT ID FROM fnSplitter(v_vol_types)) AND id IN (SELECT volume_id FROM gluster_volume_options WHERE option_key=v_option_key AND option_val=v_option_val); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumesByStatusAndTypes(v_cluster_id UUID, v_status VARCHAR(32), v_vol_types text) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE cluster_id = v_cluster_id AND status = v_status AND vol_type IN (SELECT ID FROM fnSplitter(v_vol_types)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeById(v_volume_id UUID) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeByName(v_cluster_id UUID, v_vol_name VARCHAR(1000)) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE cluster_id = v_cluster_id and vol_name = v_vol_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeByGlusterTaskId(v_task_id UUID) RETURNS SETOF gluster_volumes_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volumes_view WHERE task_id = v_task_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeDetailsById(v_volume_id UUID) RETURNS SETOF gluster_volume_details STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_details WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterBrickById(v_id UUID) RETURNS SETOF gluster_volume_bricks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_bricks_view WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBricksByGlusterVolumeGuid(v_volume_id UUID) RETURNS SETOF gluster_volume_bricks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_bricks_view WHERE volume_id = v_volume_id ORDER BY brick_order; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterVolumeBricksByServerGuid(v_server_id UUID) RETURNS SETOF gluster_volume_bricks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_bricks_view WHERE server_id = v_server_id ORDER BY brick_order; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBrickByServerIdAndDirectory(v_server_id UUID, v_brick_dir VARCHAR(4096)) RETURNS SETOF gluster_volume_bricks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_bricks_view WHERE server_id = v_server_id AND brick_dir = v_brick_dir; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBricksByTaskId(v_task_id UUID) RETURNS SETOF gluster_volume_bricks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_bricks_view WHERE task_id = v_task_id ORDER BY brick_order; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBrickDetailsById(v_brick_id UUID) RETURNS SETOF gluster_volume_brick_details STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_brick_details WHERE brick_id = v_brick_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterOptionById(v_id UUID) RETURNS SETOF gluster_volume_options STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_options WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetOptionsByGlusterVolumeGuid(v_volume_id UUID) RETURNS SETOF gluster_volume_options STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_options WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAccessProtocolsByGlusterVolumeGuid(v_volume_id UUID) RETURNS SETOF gluster_volume_access_protocols STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_access_protocols WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetGlusterTaskByGlusterVolumeGuid(v_volume_id UUID) RETURNS SETOF gluster_volume_task_steps STABLE AS $procedure$ BEGIN RETURN QUERY SELECT gluster_volume_task_steps.* FROM gluster_volume_task_steps, gluster_volumes vol WHERE volume_id = v_volume_id AND vol.id = volume_id AND (job_status = 'STARTED' OR (job_status != 'STARTED' AND external_id = vol.task_id)) ORDER BY job_start_time desc LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTransportTypesByGlusterVolumeGuid(v_volume_id UUID) RETURNS SETOF gluster_volume_transport_types STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_transport_types WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeByGuid(v_volume_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volumes WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumesByGuids(v_volume_ids VARCHAR(5000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volumes WHERE id in (select * from fnSplitterUuid(v_volume_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeByName(v_cluster_id UUID, v_vol_name VARCHAR(1000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volumes WHERE cluster_id = v_cluster_id AND vol_name = v_vol_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumesByClusterId(v_cluster_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volumes WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeBrick(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_bricks WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeBricks(v_ids VARCHAR(5000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_bricks WHERE id in (select * from fnSplitterUuid(v_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeOption(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_options WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeOptions(v_ids VARCHAR(5000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_options WHERE id in (select * from fnSplitterUuid(v_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeAccessProtocol(v_volume_id UUID, v_access_protocol VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_access_protocols WHERE volume_id = v_volume_id AND access_protocol = v_access_protocol; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteGlusterVolumeTransportType(v_volume_id UUID, v_transport_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM gluster_volume_transport_types WHERE volume_id = v_volume_id AND transport_type = v_transport_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolume(v_id UUID, v_cluster_id UUID, v_vol_name VARCHAR(1000), v_vol_type VARCHAR(32), v_status VARCHAR(32), v_replica_count INTEGER, v_stripe_count INTEGER, v_disperse_count INTEGER, v_redundancy_count INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET cluster_id = v_cluster_id, vol_name = v_vol_name, vol_type = v_vol_type, status = v_status, replica_count = v_replica_count, stripe_count = v_stripe_count, disperse_count = v_disperse_count, redundancy_count = v_redundancy_count, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeDetails(v_volume_id UUID, v_total_space bigint, v_used_space bigint, v_free_space bigint) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_details SET total_space = v_total_space, used_space = v_used_space, free_space = v_free_space, _update_date = LOCALTIMESTAMP WHERE volume_id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeBrick(v_id UUID, v_new_id UUID, v_new_server_id UUID, v_new_brick_dir VARCHAR(4096), v_new_status VARCHAR(32), v_new_network_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_bricks SET id = v_new_id, server_id = v_new_server_id, brick_dir = v_new_brick_dir, status = v_new_status, network_id = v_new_network_id, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeBrickDetails(v_brick_id UUID, v_total_space bigint, v_used_space bigint, v_free_space bigint) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_brick_details SET total_space = v_total_space, used_space = v_used_space, free_space = v_free_space, _update_date = LOCALTIMESTAMP WHERE brick_id = v_brick_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeBrickStatus(v_id UUID, v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_bricks SET status = v_status, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeBrickOrder(v_id UUID, v_brick_order INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_bricks SET brick_order = v_brick_order, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeBrickNetworkId(v_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_bricks SET network_id = v_network_id, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeStatus(v_volume_id UUID, v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET status = v_status, _update_date = LOCALTIMESTAMP WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeAsyncTask(v_volume_id UUID, v_task_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET task_id = v_task_id, _update_date = LOCALTIMESTAMP WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeBrickAsyncTask(v_id UUID, v_task_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_bricks SET task_id = v_task_id, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterBrickTaskByServerIdBrickDir(v_server_id UUID, v_brick_dir VARCHAR(200), v_task_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_bricks SET task_id = v_task_id, _update_date = LOCALTIMESTAMP WHERE server_id = v_server_id AND brick_dir = v_brick_dir; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeStatusByName(v_cluster_id UUID, v_vol_name VARCHAR(1000), v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET status = v_status, _update_date = LOCALTIMESTAMP WHERE cluster_id = v_cluster_id AND vol_name = v_vol_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGlusterVolumeOption(v_id UUID, v_option_val VARCHAR(8192)) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volume_options SET option_val = v_option_val WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateReplicaCount(v_volume_id UUID, v_replica_count INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE gluster_volumes SET replica_count = v_replica_count, _update_date = LOCALTIMESTAMP WHERE id = v_volume_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetBricksByClusterIdAndNetworkId(v_cluster_id UUID, v_network_id UUID) RETURNS SETOF gluster_volume_bricks_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM gluster_volume_bricks_view WHERE network_id = v_network_id AND cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION InsertHostDevice( v_host_id UUID, v_device_name VARCHAR(255), v_parent_device_name VARCHAR(255), v_capability VARCHAR(32), v_iommu_group INTEGER, v_product_name VARCHAR(255), v_product_id VARCHAR(255), v_vendor_name VARCHAR(255), v_vendor_id VARCHAR(255), v_physfn VARCHAR(255), v_total_vfs INTEGER, v_net_iface_name VARCHAR(50), v_is_assignable BOOLEAN) RETURNS VOID AS $procedure$ BEGIN SET CONSTRAINTS ALL DEFERRED; INSERT INTO host_device( host_id, device_name, parent_device_name, capability, iommu_group, product_name, product_id, vendor_name, vendor_id, physfn, total_vfs, net_iface_name, is_assignable) VALUES( v_host_id, v_device_name, v_parent_device_name, v_capability, v_iommu_group, v_product_name, v_product_id, v_vendor_name, v_vendor_id, v_physfn, v_total_vfs, v_net_iface_name, v_is_assignable ); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateHostDevice( v_host_id UUID, v_device_name VARCHAR(255), v_parent_device_name VARCHAR(255), v_capability VARCHAR(32), v_iommu_group INTEGER, v_product_name VARCHAR(255), v_product_id VARCHAR(255), v_vendor_name VARCHAR(255), v_vendor_id VARCHAR(255), v_physfn VARCHAR(255), v_total_vfs INTEGER, v_net_iface_name VARCHAR(50), v_is_assignable BOOLEAN) RETURNS VOID AS $procedure$ BEGIN SET CONSTRAINTS ALL DEFERRED; UPDATE host_device SET host_id = v_host_id, device_name = v_device_name, parent_device_name = v_parent_device_name, capability = v_capability, iommu_group = v_iommu_group, product_name = v_product_name, product_id = v_product_id, vendor_name = v_vendor_name, vendor_id = v_vendor_id, physfn = v_physfn, total_vfs = v_total_vfs, net_iface_name = v_net_iface_name, is_assignable = v_is_assignable WHERE host_id = v_host_id AND device_name = v_device_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DeleteHostDevice(v_host_id UUID, v_device_name VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN SET CONSTRAINTS ALL DEFERRED; DELETE FROM host_device WHERE host_id = v_host_id AND device_name = v_device_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetHostDevicesByHostId(v_host_id UUID) RETURNS SETOF host_device STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_device WHERE host_id = v_host_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetHostDevicesByHostIdAndIommuGroup(v_host_id UUID, v_iommu_group INTEGER) RETURNS SETOF host_device STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_device WHERE host_id = v_host_id AND iommu_group = v_iommu_group; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetHostDeviceByHostIdAndDeviceName(v_host_id UUID, v_device_name VARCHAR(255)) RETURNS SETOF host_device STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_device WHERE host_id = v_host_id AND device_name = v_device_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllFromHostDevices() RETURNS SETOF host_device STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_device; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmExtendedHostDevicesByVmId(v_vm_id UUID) RETURNS SETOF vm_host_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_host_device_view.* FROM vm_host_device_view WHERE vm_host_device_view.configured_vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetExtendedHostDevicesByHostId(v_host_id UUID) RETURNS SETOF host_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT host_device_view.* FROM host_device_view WHERE host_device_view.host_id = v_host_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CheckVmHostDeviceAvailability(v_vm_id UUID, v_host_id UUID) RETURNS BOOLEAN STABLE AS $procedure$ BEGIN RETURN NOT EXISTS( SELECT 1 FROM vm_device WHERE vm_id = v_vm_id AND device IN (SELECT device_name FROM host_device WHERE host_id = v_host_id AND vm_id IS NOT NULL AND vm_id <> v_vm_id)); -- device free or already belonging to the vm END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION MarkHostDevicesUsedByVmId(v_vm_id UUID, v_host_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE host_device SET vm_id = v_vm_id WHERE host_id = v_host_id AND device_name IN (SELECT device FROM vm_device WHERE vm_id = v_vm_id AND type = 'hostdev'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION SetVmIdOnHostDevice(v_host_id UUID, v_device_name VARCHAR(255), v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE host_device SET vm_id = v_vm_id WHERE host_id = v_host_id AND device_name = v_device_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION FreeHostDevicesUsedByVmId(v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE host_device SET vm_id = NULL WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CleanDownVms() RETURNS VOID AS $procedure$ BEGIN UPDATE host_device SET vm_id = NULL FROM vm_dynamic WHERE host_device.vm_id = vm_dynamic.vm_guid AND vm_dynamic.status = 0; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmDevicesAttachedToHost (v_host_id UUID) RETURNS SETOF vm_device AS $PROCEDURE$ BEGIN RETURN QUERY SELECT vm_device.* FROM vm_device INNER JOIN vm_host_pinning_map ON vm_device.vm_id = vm_host_pinning_map.vm_id AND vm_host_pinning_map.vds_id = v_host_id WHERE vm_device.type = 'hostdev'; END;$PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertImage( v_creation_date TIMESTAMP WITH TIME ZONE, v_image_guid UUID, v_it_guid UUID, v_size BIGINT, v_ParentId UUID, v_imageStatus INTEGER , v_lastModified TIMESTAMP WITH TIME ZONE, v_vm_snapshot_id UUID , v_volume_type INTEGER, v_volume_format INTEGER, v_image_group_id UUID , v_active BOOLEAN , v_volume_classification SMALLINT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO images( creation_date, image_guid, it_guid, size, ParentId, imageStatus, lastModified, vm_snapshot_id, volume_type, image_group_id, volume_format, active, volume_classification) VALUES( v_creation_date, v_image_guid, v_it_guid, v_size, v_ParentId, v_imageStatus, v_lastModified, v_vm_snapshot_id, v_volume_type, v_image_group_id, v_volume_format, v_active, v_volume_classification); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateImageStatus( v_image_id UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE images SET imageStatus = v_status WHERE image_guid = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStatusOfImagesByImageGroupId( v_image_group_id UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE images SET imageStatus = v_status WHERE image_group_id = v_image_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateImageVmSnapshotId( v_image_id UUID, v_vm_snapshot_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE images SET vm_snapshot_id = v_vm_snapshot_id WHERE image_guid = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateImageSize( v_image_id UUID, v_size BIGINT, v_lastModified TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN UPDATE images SET size = v_size, lastModified = v_lastModified WHERE image_guid = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateImage( v_creation_date TIMESTAMP WITH TIME ZONE, v_image_guid UUID, v_it_guid UUID, v_size BIGINT, v_ParentId UUID, v_imageStatus INTEGER , v_lastModified TIMESTAMP WITH TIME ZONE, v_vm_snapshot_id UUID , v_volume_type INTEGER, v_volume_format INTEGER, v_image_group_id UUID , v_active BOOLEAN , v_volume_classification SMALLINT) RETURNS VOID AS $procedure$ BEGIN UPDATE images SET creation_date = v_creation_date, it_guid = v_it_guid, size = v_size, ParentId = v_ParentId, imageStatus = v_imageStatus, lastModified = v_lastModified, vm_snapshot_id = v_vm_snapshot_id, volume_type = v_volume_type, image_group_id = v_image_group_id, volume_format = v_volume_format, active = v_active, volume_classification = v_volume_classification, _update_date = LOCALTIMESTAMP WHERE image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteImage(v_image_guid UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN DELETE FROM images WHERE image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromImages() RETURNS SETOF images STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetImageByImageId(v_image_guid UUID) RETURNS SETOF images STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM images WHERE image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertimage_storage_domain_map(v_image_id UUID, v_storage_domain_id UUID, v_quota_id UUID, v_disk_profile_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO image_storage_domain_map(image_id, storage_domain_id, quota_id, disk_profile_id) VALUES(v_image_id, v_storage_domain_id, v_quota_id, v_disk_profile_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deleteimage_storage_domain_map(v_image_id UUID, v_storage_domain_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM image_storage_domain_map WHERE image_id = v_image_id AND storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deleteimage_storage_domain_map_by_image_id(v_image_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM image_storage_domain_map WHERE image_id = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getimage_storage_domain_mapByimage_id(v_image_id UUID) RETURNS SETOF image_storage_domain_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM image_storage_domain_map WHERE image_id = v_image_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getimage_storage_domain_mapBystorage_domain_id(v_storage_domain_id UUID) RETURNS SETOF image_storage_domain_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM image_storage_domain_map WHERE storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateQuotaForImageAndSnapshots(v_disk_id UUID, v_storage_domain_id UUID, v_quota_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE image_storage_domain_map as isdm SET quota_id = v_quota_id FROM images as i WHERE i.image_group_id = v_disk_id AND i.image_guid = isdm.image_id AND storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateDiskProfileByImageGroupId(v_image_group_id UUID, v_storage_domain_id UUID, v_disk_profile_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE image_storage_domain_map as isdm SET disk_profile_id = v_disk_profile_id FROM images as i WHERE i.image_group_id = v_image_group_id AND i.image_guid = isdm.image_id AND storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION inst_update_default_storage_pool_type(v_is_local boolean) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_pool SET is_local = v_is_local, _update_date = LOCALTIMESTAMP WHERE storage_pool.name = 'Default' and not exists (select 1 from storage_domains where storage_domains.storage_pool_name = 'Default'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION inst_add_iso_storage_domain(v_storage_domain_id UUID, v_name VARCHAR(250), v_connection_id uuid, v_connection VARCHAR(250),v_available int, v_used int) RETURNS VOID AS $procedure$ DECLARE BEGIN if not exists (select 1 from storage_server_connections where connection = v_connection) then -- Insert storage server connection info perform Insertstorage_server_connections(v_connection,cast(v_connection_id as varchar(250)),NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,NULL,NULL,NULL); -- Insert storage domain static info perform Insertstorage_domain_static(v_storage_domain_id,cast(v_connection_id as varchar(250)),v_name,v_name,'',1,2,'0',0, FALSE, NULL, NULL); -- Insert storage domain dynamic info perform Insertstorage_domain_dynamic(v_available,v_storage_domain_id,v_used); end if; exception when others then RAISE EXCEPTION 'NUM:%, DETAILS:%', SQLSTATE, SQLERRM; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION inst_update_service_type(v_cluster_id uuid, v_virt_service boolean, v_gluster_service boolean) returns void AS $procedure$ begin update vds_groups set virt_service = v_virt_service, gluster_service = v_gluster_service where vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION inst_add_glance_provider( v_provider_id UUID, v_provider_name VARCHAR(128), v_provider_description VARCHAR(4000), v_provider_url VARCHAR(512), v_storage_domain_id UUID, v_auth_required boolean DEFAULT false, v_auth_username VARCHAR(64) DEFAULT NULL, v_auth_password text DEFAULT NULL, v_auth_url text DEFAULT NULL, v_tenant_name character varying(128) DEFAULT NULL ) RETURNS VOID AS $procedure$ BEGIN -- Adding the Glance provider insert into providers(id, name, description, url, provider_type, auth_required, auth_username, auth_password, auth_url, tenant_name) select v_provider_id, v_provider_name, v_provider_description, v_provider_url, 'OPENSTACK_IMAGE', v_auth_required, v_auth_username, v_auth_password, v_auth_url, v_tenant_name where not exists (select id from providers where id = v_provider_id); -- Adding a proper storage domain static entry insert into storage_domain_static(id, storage, storage_name, storage_domain_type, storage_type, storage_domain_format_type, recoverable) select v_storage_domain_id, v_provider_id, v_provider_name, 4, 8, 0, true where not exists (select id from storage_domain_static where id = v_storage_domain_id); -- Adding a proper storage domain dynamic entry insert into storage_domain_dynamic(id, available_disk_size, used_disk_size) select v_storage_domain_id, NULL, NULL where not exists (select id from storage_domain_dynamic where id = v_storage_domain_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIscsiBondByIscsiBondId(v_id UUID) RETURNS SETOF iscsi_bonds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT iscsi_bonds.* FROM iscsi_bonds WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromIscsiBonds() RETURNS SETOF iscsi_bonds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT iscsi_bonds.* FROM iscsi_bonds; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIscsiBondsByStoragePoolId(v_storage_pool_id UUID) RETURNS SETOF iscsi_bonds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT iscsi_bonds.* FROM iscsi_bonds WHERE storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworksByIscsiBondId(v_iscsi_bond_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT iscsi_bonds_networks_map.network_id FROM iscsi_bonds_networks_map WHERE iscsi_bond_id = v_iscsi_bond_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIscsiBondsByNetworkId(v_network_id UUID) RETURNS SETOF iscsi_bonds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT iscsi_bonds.* FROM iscsi_bonds_networks_map, iscsi_bonds WHERE iscsi_bonds.id = iscsi_bonds_networks_map.iscsi_bond_id AND network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertIscsiBond(v_id UUID, v_name VARCHAR(50), v_description VARCHAR(4000), v_storage_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO iscsi_bonds(id, name, description, storage_pool_id) VALUES(v_id, v_name, v_description, v_storage_pool_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateIscsiBond(v_id UUID, v_name VARCHAR(50), v_description VARCHAR(4000)) RETURNS VOID AS $procedure$ BEGIN UPDATE iscsi_bonds SET name = v_name, description = v_description WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteIscsiBond(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN DELETE FROM iscsi_bonds WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION AddNetworkToIscsiBond(v_iscsi_bond_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO iscsi_bonds_networks_map(iscsi_bond_id, network_id) VALUES(v_iscsi_bond_id, v_network_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveNetworkFromIscsiBond(v_iscsi_bond_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM iscsi_bonds_networks_map WHERE iscsi_bond_id = v_iscsi_bond_id and network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION AddConnectionToIscsiBond(v_iscsi_bond_id UUID, v_connection_id VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO iscsi_bonds_storage_connections_map(iscsi_bond_id, connection_id) VALUES(v_iscsi_bond_id, v_connection_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveConnectionFromIscsiBond(v_iscsi_bond_id UUID, v_connection_id VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM iscsi_bonds_storage_connections_map WHERE iscsi_bond_id = v_iscsi_bond_id and connection_id = v_connection_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetConnectionsByIscsiBondId(v_iscsi_bond_id UUID) RETURNS SETOF VARCHAR(50) STABLE AS $procedure$ BEGIN RETURN QUERY SELECT iscsi_bonds_storage_connections_map.connection_id FROM iscsi_bonds_storage_connections_map WHERE iscsi_bond_id = v_iscsi_bond_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertJob( v_job_id UUID, v_action_type VARCHAR(50), v_description TEXT, v_status VARCHAR(32), v_owner_id UUID, v_visible BOOLEAN, v_start_time TIMESTAMP WITH TIME ZONE, v_end_time TIMESTAMP WITH TIME ZONE, v_last_update_time TIMESTAMP WITH TIME ZONE, v_correlation_id VARCHAR(50), v_is_external boolean, v_is_auto_cleared boolean) RETURNS VOID AS $procedure$ BEGIN INSERT INTO job( job_id, action_type, description, status, owner_id, visible, start_time, end_time, last_update_time, correlation_id, is_external, is_auto_cleared) VALUES ( v_job_id, v_action_type, v_description, v_status, v_owner_id, v_visible, v_start_time, v_end_time, v_last_update_time, v_correlation_id, v_is_external, v_is_auto_cleared); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetJobByJobId(v_job_id UUID) RETURNS SETOF job STABLE AS $procedure$ BEGIN RETURN QUERY SELECT job.* FROM JOB WHERE job_id = v_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllJobs() RETURNS SETOF job STABLE AS $procedure$ BEGIN RETURN QUERY SELECT job.* FROM JOB where status != 'UNKNOWN' order by start_time DESC; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetJobsByOffsetAndPageSize(v_position INTEGER, v_page_size INTEGER) RETURNS SETOF job STABLE AS $procedure$ BEGIN RETURN QUERY (SELECT job.* FROM JOB WHERE status = 'STARTED' ORDER BY last_update_time desc) UNION ALL (SELECT job.* FROM JOB WHERE status not in ('STARTED','UNKNOWN') ORDER BY last_update_time desc) OFFSET v_position LIMIT v_page_size; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetJobsByCorrelationId(v_correlation_id VARCHAR(50)) RETURNS SETOF job STABLE AS $procedure$ BEGIN RETURN QUERY SELECT job.* FROM JOB WHERE correlation_id = v_correlation_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateJob( v_job_id UUID, v_action_type VARCHAR(50), v_description TEXT, v_status VARCHAR(32), v_owner_id UUID, v_visible BOOLEAN, v_start_time TIMESTAMP WITH TIME ZONE, v_end_time TIMESTAMP WITH TIME ZONE, v_last_update_time TIMESTAMP WITH TIME ZONE, v_correlation_id VARCHAR(50), v_is_external boolean, v_is_auto_cleared boolean) RETURNS VOID AS $procedure$ BEGIN update job SET action_type = v_action_type, description = v_description, status = v_status, owner_id = v_owner_id, visible = v_visible, start_time = v_start_time, end_time = v_end_time, last_update_time = v_last_update_time, correlation_id = v_correlation_id, is_external = v_is_external, is_auto_cleared = v_is_auto_cleared WHERE job_id = v_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateJobLastUpdateTime( v_job_id UUID, v_last_update_time TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN update job SET last_update_time = v_last_update_time WHERE job_id = v_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteJobOlderThanDateWithStatus( v_end_time TIMESTAMP WITH TIME ZONE, v_status TEXT) RETURNS VOID AS $procedure$ BEGIN DELETE FROM job WHERE is_auto_cleared AND end_time < v_end_time AND status = any (string_to_array(v_status,',')::VARCHAR[] ); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteJob( v_job_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM job WHERE job_id = v_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertJobSubjectEntity( v_job_id UUID, v_entity_id UUID, v_entity_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO job_subject_entity( job_id, entity_id, entity_type) VALUES ( v_job_id, v_entity_id, v_entity_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetJobSubjectEntityByJobId(v_job_id UUID) RETURNS SETOF job_subject_entity STABLE AS $procedure$ BEGIN RETURN QUERY SELECT job_subject_entity.* FROM job_subject_entity WHERE job_id = v_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllJobIdsByEntityId( v_entity_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT job_subject_entity.job_id FROM job_subject_entity WHERE entity_id = v_entity_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertStep( v_step_id UUID, v_parent_step_id UUID, v_job_id UUID, v_step_type VARCHAR(32), v_description TEXT, v_step_number INTEGER, v_status VARCHAR(32), v_start_time TIMESTAMP WITH TIME ZONE, v_end_time TIMESTAMP WITH TIME ZONE, v_correlation_id VARCHAR(50), v_external_id UUID, v_external_system_type VARCHAR(32), v_is_external boolean) RETURNS VOID AS $procedure$ BEGIN INSERT INTO step( step_id, parent_step_id, job_id, step_type, description, step_number, status, start_time, end_time, correlation_id, external_id, external_system_type, is_external) VALUES ( v_step_id, v_parent_step_id, v_job_id, v_step_type, v_description, v_step_number, v_status, v_start_time, v_end_time, v_correlation_id, v_external_id, v_external_system_type, v_is_external); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStep( v_step_id UUID, v_parent_step_id UUID, v_job_id UUID, v_step_type VARCHAR(32), v_description TEXT, v_step_number INTEGER, v_status VARCHAR(32), v_start_time TIMESTAMP WITH TIME ZONE, v_end_time TIMESTAMP WITH TIME ZONE, v_correlation_id VARCHAR(50), v_external_id UUID, v_external_system_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE step SET parent_step_id = v_parent_step_id, job_id = v_job_id, step_type = v_step_type, description = v_description, step_number = v_step_number, status = v_status, start_time = v_start_time, end_time = v_end_time, correlation_id = v_correlation_id, external_id = v_external_id, external_system_type = v_external_system_type WHERE step_id = v_step_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStepStatusAndEndTime( v_step_id UUID, v_status VARCHAR(32), v_end_time TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN UPDATE step SET status = v_status, end_time = v_end_time WHERE step_id = v_step_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStepExternalIdAndType( v_step_id UUID, v_external_id UUID, v_external_system_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE step SET external_id = v_external_id, external_system_type = v_external_system_type WHERE step_id = v_step_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStepByStepId(v_step_id UUID) RETURNS SETOF step STABLE AS $procedure$ BEGIN RETURN QUERY SELECT step.* FROM step WHERE step_id = v_step_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStepsByJobId(v_job_id UUID) RETURNS SETOF step STABLE AS $procedure$ BEGIN RETURN QUERY SELECT step.* FROM step WHERE job_id = v_job_id ORDER BY parent_step_id nulls first, step_number; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStepsByParentStepId(v_parent_step_id UUID) RETURNS SETOF step STABLE AS $procedure$ BEGIN RETURN QUERY SELECT step.* FROM step WHERE parent_step_id = v_parent_step_id ORDER BY step_number; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllSteps() RETURNS SETOF step STABLE AS $procedure$ BEGIN RETURN QUERY SELECT step.* FROM step; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteStep( v_step_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM step WHERE step_id = v_step_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION updateJobStepsCompleted( v_job_id UUID, v_status VARCHAR(32), v_end_time TIMESTAMP WITH TIME ZONE ) RETURNS VOID AS $procedure$ BEGIN UPDATE step SET status = v_status, end_time = v_end_time WHERE job_id = v_job_id AND status = 'STARTED' AND STATUS != v_status; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStartedExecutionEntitiesToUnknown( v_end_time TIMESTAMP WITH TIME ZONE ) RETURNS VOID AS $procedure$ BEGIN update job set status = 'UNKNOWN', end_time = v_end_time, last_update_time = v_end_time where job.status = 'STARTED' and job_id not in (select job_id from step where external_id is not null); update step set status = 'UNKNOWN', end_time = v_end_time where status = 'STARTED' and job_id not in (select step.job_id from step step where step.external_id is not null); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteRunningJobsOfTasklessCommands() RETURNS VOID AS $procedure$ BEGIN DELETE FROM job WHERE (status = 'STARTED' AND action_type IN ('MigrateVm', 'MigrateVmToServer', 'RunVm', 'RunVmOnce')) AND job_id not in (select job_id from step where step_id in (select step_id from async_tasks)); DELETE FROM job WHERE job_id IN (SELECT job_id from step WHERE (status = 'STARTED' AND step_type='MIGRATE_VM')); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteCompletedJobsOlderThanDate( v_succeeded_end_time TIMESTAMP WITH TIME ZONE, v_failed_end_time TIMESTAMP WITH TIME ZONE ) RETURNS VOID AS $procedure$ BEGIN DELETE FROM job WHERE (is_auto_cleared AND ((end_time < v_succeeded_end_time AND status = 'FINISHED') OR (end_time < v_failed_end_time AND status IN ('FAILED', 'ABORTED', 'UNKNOWN')))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckIfJobHasTasks( v_job_id UUID) RETURNS SETOF booleanResultType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT EXISTS( SELECT * FROM step WHERE job_id = v_job_id AND external_id is not null AND external_system_type in ('VDSM','GLUSTER')); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStepsByExternalTaskId(v_external_id UUID) RETURNS SETOF step STABLE AS $procedure$ BEGIN RETURN QUERY SELECT step.* FROM step WHERE external_id = v_external_id ORDER BY parent_step_id nulls first, step_number; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetExternalIdsFromSteps(v_status VARCHAR(32), v_external_system_type VARCHAR(32)) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT step.external_id FROM step INNER JOIN job ON step.job_id = job.job_id WHERE job.status = v_status AND step.external_system_type = v_external_system_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLibvirtSecretByLibvirtSecretId(v_secret_id UUID) RETURNS SETOF libvirt_secrets STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM libvirt_secrets WHERE secret_id = v_secret_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertLibvirtSecret(v_secret_id UUID, v_secret_value TEXT, v_secret_usage_type integer, v_secret_description TEXT, v_provider_id UUID, v__create_date TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN INSERT INTO libvirt_secrets(secret_id, secret_value, secret_usage_type, secret_description, provider_id, _create_date) VALUES(v_secret_id, v_secret_value, v_secret_usage_type, v_secret_description, v_provider_id, v__create_date); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateLibvirtSecret(v_secret_id UUID, v_secret_value TEXT, v_secret_usage_type integer, v_secret_description TEXT, v_provider_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE libvirt_secrets SET secret_id = v_secret_id, secret_value = v_secret_value, secret_usage_type = v_secret_usage_type, secret_description = v_secret_description, provider_id = v_provider_id, _update_date = LOCALTIMESTAMP WHERE secret_id = v_secret_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteLibvirtSecret(v_secret_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM libvirt_secrets WHERE secret_id = v_secret_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromLibvirtSecrets() RETURNS SETOF libvirt_secrets STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM libvirt_secrets; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllLibvirtSecretsByProviderId(v_provider_id UUID) RETURNS SETOF libvirt_secrets STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM libvirt_secrets WHERE provider_id = v_provider_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLibvirtSecretsByPoolIdOnActiveDomains(v_storage_pool_id UUID) RETURNS SETOF libvirt_secrets STABLE AS $procedure$ BEGIN RETURN QUERY SELECT libvirt_secrets.* FROM libvirt_secrets INNER JOIN storage_domain_static ON CAST (libvirt_secrets.provider_id as varchar) = storage_domain_static.storage INNER JOIN storage_pool_iso_map ON storage_domain_static.id = storage_pool_iso_map.storage_id WHERE storage_pool_iso_map.storage_pool_id = v_storage_pool_id AND storage_pool_iso_map.status = 3; -- Active END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertMacPool( v_id UUID, v_name VARCHAR(40), v_allow_duplicate_mac_addresses BOOLEAN, v_description VARCHAR(4000)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO mac_pools(id, name, allow_duplicate_mac_addresses, description) VALUES(v_id, v_name, v_allow_duplicate_mac_addresses, v_description); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateMacPool( v_id UUID, v_name VARCHAR(40), v_allow_duplicate_mac_addresses BOOLEAN, v_description VARCHAR(4000)) RETURNS VOID AS $procedure$ BEGIN UPDATE mac_pools SET id=v_id, name=v_name, allow_duplicate_mac_addresses=v_allow_duplicate_mac_addresses, description=v_description WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteMacPool(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM mac_pools WHERE id=v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetMacPoolByMacPoolId(v_id UUID) RETURNS SETOF mac_pools STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM mac_pools WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDefaultMacPool() RETURNS SETOF mac_pools STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM mac_pools where default_pool is true; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetMacPoolByDataCenterId(v_id UUID) RETURNS SETOF mac_pools STABLE AS $procedure$ BEGIN RETURN QUERY SELECT mp.* FROM mac_pools mp join storage_pool sp on sp.mac_pool_id=mp.id where sp.id=v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllFromMacPools() RETURNS SETOF mac_pools STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM mac_pools; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllMacsByMacPoolId(v_id UUID) RETURNS SETOF VARCHAR STABLE AS $procedure$ BEGIN RETURN QUERY SELECT mac_addr FROM vm_interface WHERE EXISTS(SELECT 1 FROM vm_static JOIN vds_groups ON vm_static.vds_group_id = vds_groups.vds_group_id WHERE vds_groups.storage_pool_id IN (SELECT sp.id FROM storage_pool sp WHERE sp.mac_pool_id = v_id) AND vm_static.vm_guid = vm_interface.vm_guid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertMacPoolRange( v_mac_pool_id UUID, v_from_mac CHARACTER VARYING(17), v_to_mac CHARACTER VARYING(17)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO mac_pool_ranges(mac_pool_id, from_mac, to_mac) VALUES (v_mac_pool_id, v_from_mac, v_to_mac); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteMacPoolRangesByMacPoolId(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM mac_pool_ranges WHERE mac_pool_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllMacPoolRangesByMacPoolId(v_id UUID) RETURNS SETOF mac_pool_ranges STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM mac_pool_ranges WHERE mac_pool_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* This file adds Snapshot Materialized Views support to Postgres. A Snapshot Materialized View is actually a table built on top of a real view that enables to select data from the Snapshot Materialized View easily and efficiently. Candidates for Snapshot Materialized Views are views that are based on slowly-changing data. The Snapshot Materialized Views is actually functioning as a cache. The Snapshot Materialized View is refreshed per request. The Snapshot Materialized View definitions are stored in the materialized_views table. Flow: 1) Create the Materialized View by calling: CreateMaterializedView - if you are creating a new view CreateMaterializedViewAs - If you want to preserve the original view name in this case the original view will be renamed and the new Materialized View will have the original view name. The following should be called for Custom Materialized Views CreateCustomMaterializedView CreateCustomMaterializedViewAs 2) If your Snapshot Materialized View is my_mt you should create Stored Procedures: MtDropmy_mtIndexes - Drops indexes on my_mt MtCreatemy_mtIndexes - Creates needed indexes on my_mt Those indexes should be defined in the "Snapshot Materialized Views Index Definitions Section" in post_upgrade/0020_create_materialized_views.sql file. Those SP are called automatically when a Snapshot Materialized View is refreshed to boost refresh performance. 3) You can call IsMaterializedViewRefreshed to check if it is time to refresh the view and if yes call RefreshMaterializedView manually. or You can define a cron job that calls RefreshAllMaterializedViews that loops over all Snapshot Materialized Views and refreshes it automatically RefreshAllMaterializedViews recieves a boolean v_force flag, please set this flag to false when calling it from a cron job in order to update the materialized views only when needed. (This SP is called with v_force = true after create/upgrade DB) There are also additional functions : CreateAllMaterializedViewsiIndexes - Creates indexes for all Snapshot Materialized views DropMaterializedView - Drops the Materialized View DropAllMaterializedViews - Drop all Materialized Views DropAllCustomMaterializedViews - Drop all custom Materialized Views UpdateMaterializedViewRefreshRate - Updates the Materialized View refresh rate UpdateMaterializedViewMinRefreshRate - Updates the Materialized View minimal refresh rate ActivateMaterializedView - activates/decativates a Materialized View ActivateAllMaterializedViews - activates/decativates all Materialized Views In addition, you can create a file named create_materialized_views.sql under dbscripts/upgrade/post_upgrade/custom/ This file may include other custom materialized views settings and is executed by the create/upgrade database scripts. NOTE : Materialized Views are automatically refreshed upon create/upgrade */ CREATE OR REPLACE FUNCTION to_interval (sec INTEGER) RETURNS INTERVAL AS $$ BEGIN RETURN (sec || ' seconds')::INTERVAL; END; $$ LANGUAGE 'plpgsql' IMMUTABLE STRICT; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_custom BOOLEAN, v_min_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF FOUND THEN RAISE EXCEPTION 'Materialized view % already exists.', v_matview; END IF; IF current_user != usename from pg_database , pg_user where datdba=usesysid and datname=current_database THEN RAISE EXCEPTION 'Materialized view % should be created with user ''engine''.', v_matview; END IF; EXECUTE 'REVOKE ALL ON ' || v_view_name || ' FROM PUBLIC'; EXECUTE 'GRANT SELECT ON ' || v_view_name || ' TO PUBLIC'; EXECUTE 'CREATE TABLE ' || v_matview || ' AS SELECT * FROM ' || v_view_name; EXECUTE 'REVOKE ALL ON ' || v_matview || ' FROM PUBLIC'; EXECUTE 'GRANT SELECT ON ' || v_matview || ' TO PUBLIC'; INSERT INTO materialized_views (mv_name, v_name, refresh_rate_in_sec, last_refresh, custom, min_refresh_rate_in_sec) VALUES (v_matview, v_view_name, v_refresh_rate_in_sec, CURRENT_TIMESTAMP, v_custom, v_min_refresh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, false, v_min_refresh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, true, v_min_refresh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, false, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedView(v_matview NAME, v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedView(v_matview, v_view_name, v_refresh_rate_in_sec, true, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_custom BOOLEAN, v_min_refesh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; v_renamed_view NAME; BEGIN IF FOUND THEN RAISE EXCEPTION 'Materialized view % already exists.', v_view_name; END IF; v_renamed_view := v_view_name || '_mt_base'; EXECUTE 'ALTER VIEW ' || v_view_name || ' RENAME TO ' || v_renamed_view; perform CreateMaterializedView(v_view_name, v_renamed_view, v_refresh_rate_in_sec, v_custom, v_min_refesh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refesh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, false, v_min_refesh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER, v_min_refesh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, true, v_min_refesh_rate_in_sec); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, false, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateCustomMaterializedViewAs(v_view_name NAME, v_refresh_rate_in_sec INTEGER) RETURNS VOID AS $procedure$ BEGIN PERFORM CreateMaterializedViewAs(v_view_name, v_refresh_rate_in_sec, true, 0); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DropMaterializedView(v_matview NAME) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; EXECUTE 'DROP TABLE ' || v_matview || ' CASCADE'; DELETE FROM materialized_views WHERE mv_name=v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DropAllMaterializedViews() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views; v_record materialized_views%ROWTYPE; BEGIN OPEN v_cur; -- loop on all entries in materialized_views LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; perform DropMaterializedView(v_record.mv_name); END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DropAllCustomMaterializedViews() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views where custom; v_record materialized_views%ROWTYPE; BEGIN OPEN v_cur; -- loop on all entries in materialized_views LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; perform DropMaterializedView(v_record.mv_name); END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION IsMaterializedViewRefreshed(v_matview NAME) RETURNS boolean STABLE AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; v_is_refreshed boolean; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; -- check if materialized View should refresh v_is_refreshed := (((CURRENT_TIMESTAMP - to_interval(refresh_rate_in_sec)) <= last_refresh) and ((CURRENT_TIMESTAMP - to_interval(min_refresh_rate_in_sec)) <= last_refresh)) or not active from materialized_views where mv_name = v_matview; RETURN v_is_refreshed; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION RefreshMaterializedView(v_matview NAME) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; v_drop_index_sp NAME; v_create_index_sp NAME; v_start_time TIMESTAMP WITH TIME ZONE; v_avg_cost_ms int; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; -- get start time v_start_time:=CURRENT_TIMESTAMP; -- SP for Drop / create Index should follow naming convention Mt[Drop|Create]Indexes v_drop_index_sp := 'MtDrop' || v_matview || 'Indexes'; v_create_index_sp := 'MtCreate' || v_matview || 'Indexes'; IF NOT EXISTS (select 1 from information_schema.routines where routine_name ilike v_drop_index_sp) THEN v_drop_index_sp := NULL; END IF; IF NOT EXISTS (select 1 from information_schema.routines where routine_name ilike v_create_index_sp) THEN v_create_index_sp := NULL; END IF; -- Lock materialized_views table until refresh completes to prevent duplicate refreshes by other threads LOCK TABLE materialized_views; -- taking a lock on the snapshot materialized view until it refreshed EXECUTE 'LOCK TABLE ' || v_matview; -- drop indexes on the snapshot materialized view if exists IF (v_drop_index_sp IS NOT NULL) THEN EXECUTE 'select ' || v_drop_index_sp || '()'; END IF; -- refresh the view EXECUTE 'TRUNCATE TABLE ' || v_matview; EXECUTE 'INSERT INTO ' || v_matview || ' SELECT * FROM ' || v_entry.v_name; -- restore indexes on the snapshot materialized view if exists IF (v_create_index_sp IS NOT NULL) THEN EXECUTE 'select ' || v_create_index_sp || '()'; END IF; -- update last refresh time and average cost in [ms] IF (v_entry.avg_cost_ms = 0) THEN v_avg_cost_ms:=EXTRACT(EPOCH FROM current_timestamp - v_start_time) * 1000; ELSE v_avg_cost_ms:=((EXTRACT(EPOCH FROM current_timestamp - v_start_time) * 1000) + v_entry.avg_cost_ms)/2; END IF; update materialized_views set last_refresh = CURRENT_TIMESTAMP, avg_cost_ms = v_avg_cost_ms where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION RefreshAllMaterializedViews(v_force boolean) RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views; v_record materialized_views%ROWTYPE; BEGIN OPEN v_cur; -- loop on all entries in materialized_views and refresh only needed snapshots LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; IF ((v_force and v_record.min_refresh_rate_in_sec = 0) or not IsMaterializedViewRefreshed(v_record.mv_name)) THEN perform RefreshMaterializedView(v_record.mv_name); END IF; END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION CreateAllMaterializedViewsiIndexes() RETURNS void AS $procedure$ DECLARE v_cur CURSOR FOR SELECT * FROM materialized_views; v_record materialized_views%ROWTYPE; v_create_index_sp NAME; BEGIN OPEN v_cur; -- loop on all entries in materialized_views and create indexes(if defined) LOOP FETCH v_cur INTO v_record; EXIT WHEN NOT FOUND; v_create_index_sp := 'MtCreate' || v_record.mv_name || 'Indexes'; -- Check if SP that creates the indexes exists IF NOT EXISTS (select 1 from information_schema.routines where routine_name ilike v_create_index_sp) THEN v_create_index_sp := NULL; END IF; IF (v_create_index_sp IS NOT NULL) THEN EXECUTE 'select ' || v_create_index_sp || '()'; END IF; END LOOP; CLOSE v_cur; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateMaterializedViewRefreshRate(v_matview NAME, v_refresh_rate INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; update materialized_views set refresh_rate_in_sec = v_refresh_rate where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateMaterializedViewMinRefreshRate(v_matview NAME, v_min_refresh_rate INTEGER) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; update materialized_views set min_refresh_rate_in_sec = v_min_refresh_rate where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION ActivateMaterializedView(v_matview NAME, v_active BOOLEAN) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN SELECT * INTO v_entry FROM materialized_views WHERE mv_name = v_matview; IF NOT FOUND THEN RAISE EXCEPTION 'Materialized view % does not exist.', v_matview; END IF; update materialized_views set active = v_active where mv_name = v_matview; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION ActivateAllMaterializedViews(v_active BOOLEAN) RETURNS VOID AS $procedure$ DECLARE v_entry materialized_views%ROWTYPE; BEGIN update materialized_views set active = v_active; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertPermission(v_ad_element_id UUID, v_id UUID, v_role_id UUID, v_object_id UUID, v_object_type_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO permissions(ad_element_id, id, role_id, object_id, object_type_id) VALUES(v_ad_element_id, v_id, v_role_id, v_object_id, v_object_type_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeletePermission(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM permissions WHERE id = v_id FOR UPDATE; DELETE FROM permissions WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByid(v_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION get_user_permissions_for_domain(v_name VARCHAR(255), v_domain VARCHAR(255)) RETURNS SETOF permissions_view STABLE AS $procedure$ DECLARE v_user_name VARCHAR(255); v_index INTEGER; BEGIN -- find if name already includes domain (@) v_index := POSITION('@' IN v_name); if (v_index > 0) then v_user_name := substr(v_name, 0, v_index); else v_user_name := v_name; end if; RETURN QUERY SELECT * FROM permissions_view WHERE permissions_view.ad_element_id in ( SELECT users.user_id FROM users WHERE users.domain = v_domain AND (users.name = v_user_name OR users.name = v_user_name || '@' || upper(v_domain) )); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetConsumedPermissionsForQuotaId(v_quota_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE role_id in (SELECT role_id FROM ROLES_groups where action_group_id = 901) AND object_id in(select id from fn_get_entity_parents(v_quota_id,17)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByAdElementId(v_ad_element_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered BOOLEAN, v_app_mode INTEGER) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE (permissions_view.app_mode & v_app_mode) > 0 AND (permissions_view.ad_element_id = v_ad_element_id OR ad_element_id IN (SELECT * FROM GetSessionUserAndGroupsById(v_ad_element_id, v_engine_session_seq_id))) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_permissions_permissions_view uv, engine_sessions WHERE uv.user_id = engine_sessions.user_id AND engine_sessions.id = v_engine_session_seq_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByRoleId(v_role_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE role_id = v_role_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByRoleIdAndAdElementId(v_role_id UUID, v_ad_element_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE role_id = v_role_id and ad_element_id = v_ad_element_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByRoleIdAndAdElementIdAndObjectId(v_role_id UUID, v_ad_element_id UUID,v_object_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE role_id = v_role_id and ad_element_id = v_ad_element_id and object_id = v_object_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDirectPermissionsByAdElementId(v_ad_element_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE permissions_view.ad_element_id = v_ad_element_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertRole(v_description VARCHAR(4000) , v_id UUID, v_name VARCHAR(126), v_is_readonly BOOLEAN, v_role_type INTEGER, v_allows_viewing_children BOOLEAN, v_app_mode INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles(description, id, name, is_readonly, role_type, allows_viewing_children, app_mode) VALUES(v_description, v_id, v_name, v_is_readonly, v_role_type, v_allows_viewing_children, v_app_mode); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateRole(v_description VARCHAR(4000) , v_id UUID, v_name VARCHAR(126), v_is_readonly BOOLEAN, v_role_type INTEGER, v_allows_viewing_children BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE roles SET description = v_description, name = v_name, is_readonly = v_is_readonly, role_type = v_role_type, allows_viewing_children = v_allows_viewing_children WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteRole(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM roles WHERE id = v_id FOR UPDATE; DELETE FROM roles WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromRole(v_app_mode INTEGER) RETURNS SETOF roles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM roles WHERE (roles.app_mode & v_app_mode) > 0; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetRolsByid(v_id UUID) RETURNS SETOF roles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM roles WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetRoleByName(v_name VARCHAR(126)) RETURNS SETOF roles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM roles WHERE name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAnyAdminRoleByUserIdAndGroupIds(v_user_id UUID, v_group_ids text, v_app_mode INTEGER) RETURNS SETOF roles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT roles.* FROM roles INNER JOIN permissions ON permissions.role_id = roles.id WHERE (roles.app_mode & v_app_mode) > 0 AND role_type = 1 -- admin AND (permissions.ad_element_id = v_user_id or permissions.ad_element_id in(select id from getElementIdsByIdAndGroups(v_user_id, v_group_ids))) LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionByRoleId(v_role_id UUID) RETURNS SETOF permissions STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * from permissions where role_id = v_role_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION get_entity_permissions(v_user_id UUID,v_action_group_id INTEGER,v_object_id UUID,v_object_type_id INTEGER) RETURNS SETOF UUID STABLE AS $procedure$ DECLARE v_everyone_object_id UUID; BEGIN v_everyone_object_id := getGlobalIds('everyone'); -- hardcoded also in MLA Handler RETURN QUERY select id from permissions where -- get all roles of action role_id in(select role_id from roles_groups where action_group_id = v_action_group_id) -- get allparents of object and (object_id in(select id from fn_get_entity_parents(v_object_id,v_object_type_id))) -- get user and his groups and (ad_element_id = v_everyone_object_id or ad_element_id = v_user_id or ad_element_id in(select * from getUserAndGroupsById(v_user_id))) LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION get_entity_permissions_for_user_and_groups(v_user_id UUID,v_group_ids text,v_action_group_id INTEGER,v_object_id UUID,v_object_type_id INTEGER, v_ignore_everyone BOOLEAN) RETURNS SETOF UUID STABLE AS $procedure$ DECLARE v_everyone_object_id UUID; BEGIN v_everyone_object_id := getGlobalIds('everyone'); -- hardcoded also in MLA Handler RETURN QUERY select id from permissions where -- get all roles of action role_id in(select role_id from roles_groups where action_group_id = v_action_group_id) -- get allparents of object and (object_id in(select id from fn_get_entity_parents(v_object_id,v_object_type_id))) -- get user and his groups and ((NOT v_ignore_everyone and ad_element_id = v_everyone_object_id) or ad_element_id = v_user_id or ad_element_id in(select * from fnsplitteruuid(v_group_ids))) LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insert_roles_groups(v_action_group_id INTEGER, v_role_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(action_group_id, role_id) VALUES(v_action_group_id, v_role_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Delete_roles_groups(v_action_group_id INTEGER, v_role_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM roles_groups WHERE action_group_id = v_action_group_id AND role_id = v_role_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Get_roles_groups_By_action_group_id_And_By_role_id(v_action_group_id INTEGER,v_role_id UUID) RETURNS SETOF roles_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM roles_groups where action_group_id = v_action_group_id AND role_id = v_role_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Get_role_groups_By_role_id(v_role_id UUID) RETURNS SETOF roles_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM roles_groups where role_id = v_role_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByEntityId(v_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered BOOLEAN, v_app_mode INTEGER) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE (permissions_view.app_mode & v_app_mode) > 0 AND object_id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM GetUserPermissionsByEntityId(v_id, v_engine_session_seq_id, v_is_filtered))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllUsersWithPermissionsOnEntityByEntityId(v_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered BOOLEAN, v_app_mode INTEGER) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE (permissions_view.app_mode & v_app_mode) > 0 AND object_id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM GetAllUsersWithPermissionsByEntityId(v_id, v_engine_session_seq_id, v_is_filtered))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserPermissionsByEntityId(v_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered BOOLEAN) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view p WHERE object_id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM engine_session_user_flat_groups u WHERE p.ad_element_id = u.granted_id AND u.engine_session_seq_id = v_engine_session_seq_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllUsersWithPermissionsByEntityId(v_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered BOOLEAN) RETURNS SETOF permissions_view STABLE AS $procedure$ declare r_type int4; BEGIN for r_type in (SELECT DISTINCT role_type FROM permissions_view p WHERE object_id = v_id) LOOP RETURN QUERY SELECT * FROM permissions_view p WHERE object_id in (select id from fn_get_entity_parents(v_id, r_type)) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM engine_session_user_flat_groups u WHERE p.ad_element_id = u.granted_id AND u.engine_session_seq_id = v_engine_session_seq_id)); END LOOP; return; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeletePermissionsByEntityId(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM permissions WHERE object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetRoleActionGroupsByRoleId(v_id UUID) RETURNS SETOF roles_groups STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM roles_groups WHERE role_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsTreeByEntityId (v_id UUID, v_object_type_id INTEGER, v_engine_session_seq_id INTEGER, v_is_filtered BOOLEAN, v_app_mode INTEGER) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view p WHERE (p.app_mode & v_app_mode) > 0 AND object_id in(select id from fn_get_entity_parents(v_id,v_object_type_id)) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM engine_session_user_flat_groups u WHERE p.ad_element_id = u.granted_id AND u.engine_session_seq_id = v_engine_session_seq_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPermissionsByRoleIdAndObjectId(v_role_id UUID, v_object_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE role_id = v_role_id and object_id = v_object_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetForRoleAndAdElementAndObject_wGroupCheck(v_role_id UUID, v_ad_element_id UUID, v_object_id UUID) RETURNS SETOF permissions_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM permissions_view WHERE role_id = v_role_id and object_id = v_object_id and ad_element_id in ( select * from getUserAndGroupsById(v_ad_element_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertnetwork(v_addr VARCHAR(50) , v_description VARCHAR(4000) , v_free_text_comment text, v_id UUID, v_name VARCHAR(50), v_subnet VARCHAR(20) , v_gateway VARCHAR(20) , v_type INTEGER , v_vlan_id INTEGER , v_stp BOOLEAN , v_storage_pool_id UUID, v_mtu INTEGER, v_vm_network BOOLEAN, v_provider_network_provider_id UUID, v_provider_network_external_id TEXT, v_qos_id UUID, v_label TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO network(addr, description, free_text_comment, id, name, subnet, gateway, type, vlan_id, stp, storage_pool_id, mtu, vm_network, provider_network_provider_id, provider_network_external_id, qos_id, label) VALUES(v_addr, v_description, v_free_text_comment, v_id, v_name, v_subnet, v_gateway, v_type, v_vlan_id, v_stp, v_storage_pool_id, v_mtu, v_vm_network, v_provider_network_provider_id, v_provider_network_external_id, v_qos_id, v_label); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatenetwork(v_addr VARCHAR(50) , v_description VARCHAR(4000) , v_free_text_comment text, v_id UUID, v_name VARCHAR(50), v_subnet VARCHAR(20) , v_gateway VARCHAR(20) , v_type INTEGER , v_vlan_id INTEGER , v_stp BOOLEAN , v_storage_pool_id UUID, v_mtu INTEGER, v_vm_network BOOLEAN, v_provider_network_provider_id UUID, v_provider_network_external_id TEXT, v_qos_id UUID, v_label TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE network SET addr = v_addr,description = v_description, free_text_comment = v_free_text_comment, name = v_name,subnet = v_subnet, gateway = v_gateway,type = v_type,vlan_id = v_vlan_id, stp = v_stp,storage_pool_id = v_storage_pool_id, mtu = v_mtu, vm_network = v_vm_network, provider_network_provider_id = v_provider_network_provider_id, provider_network_external_id = v_provider_network_external_id, qos_id = v_qos_id, label = v_label WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletenetwork(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM network WHERE id = v_id FOR UPDATE; DELETE FROM network WHERE id = v_id; -- Delete the network's permissions DELETE FROM permissions WHERE object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromnetwork(v_user_id uuid, v_is_filtered boolean) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network WHERE NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_network_permissions_view WHERE user_id = v_user_id AND entity_id = network.id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetnetworkByid(v_id UUID, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network WHERE id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_network_permissions_view WHERE user_id = v_user_id AND entity_id = v_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetnetworkByName(v_networkName VARCHAR(50)) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network WHERE name = v_networkName; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkByNameAndDataCenter(v_name VARCHAR(50), v_storage_pool_id UUID) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT network.* FROM network WHERE network.name = v_name AND network.storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkByNameAndCluster(v_name VARCHAR(50), v_cluster_id UUID) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT network.* FROM network WHERE network.name = v_name AND EXISTS (SELECT 1 FROM network_cluster WHERE network.id = network_cluster.network_id AND network_cluster.cluster_id = v_cluster_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetManagementNetworkByCluster(v_cluster_id UUID) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT network.* FROM network WHERE id = (SELECT network_id FROM network_cluster WHERE network_cluster.cluster_id = v_cluster_id AND network_cluster.management); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllNetworkByStoragePoolId(v_id UUID, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network WHERE storage_pool_id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_network_permissions_view WHERE user_id = v_user_id AND entity_id = network.id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS networkViewClusterType CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE networkViewClusterType AS(id uuid,name VARCHAR(50),description VARCHAR(4000), free_text_comment text, type INTEGER, addr VARCHAR(50),subnet VARCHAR(20),gateway VARCHAR(20),vlan_id INTEGER,stp BOOLEAN,storage_pool_id UUID, mtu INTEGER, vm_network BOOLEAN, label TEXT, provider_network_provider_id UUID, provider_network_external_id TEXT, qos_id UUID, network_id UUID,cluster_id UUID, status INTEGER, is_display BOOLEAN, required BOOLEAN, migration BOOLEAN, management BOOLEAN, is_gluster BOOLEAN); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetAllNetworkByClusterId(v_id UUID, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF networkViewClusterType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT network.id, network.name, network.description, network.free_text_comment, network.type, network.addr, network.subnet, network.gateway, network.vlan_id, network.stp, network.storage_pool_id, network.mtu, network.vm_network, network.label, network.provider_network_provider_id, network.provider_network_external_id, network.qos_id, network_cluster.network_id, network_cluster.cluster_id, network_cluster.status, network_cluster.is_display, network_cluster.required, network_cluster.migration, network_cluster.management, network_cluster.is_gluster FROM network INNER JOIN network_cluster ON network.id = network_cluster.network_id WHERE network_cluster.cluster_id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_network_permissions_view WHERE user_id = v_user_id AND entity_id = network.id)) ORDER BY network.name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllNetworksByQosId(v_id UUID) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network WHERE qos_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllNetworksByNetworkProviderId(v_id UUID) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network WHERE provider_network_provider_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllNetworkViewsByNetworkProviderId(v_id UUID) RETURNS SETOF network_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_view WHERE provider_network_provider_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllNetworkLabelsByDataCenterId(v_id UUID) RETURNS SETOF TEXT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT label FROM network WHERE network.storage_pool_id = v_id AND label IS NOT NULL; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertvds_interface(v_addr VARCHAR(20) , v_bond_name VARCHAR(50) , v_bond_type INTEGER , v_gateway VARCHAR(20) , v_id UUID, v_is_bond BOOLEAN , v_bond_opts VARCHAR(4000) , v_mac_addr VARCHAR(20) , v_name VARCHAR(50), v_network_name VARCHAR(50) , v_speed INTEGER , v_subnet VARCHAR(20) , v_boot_protocol INTEGER , v_type INTEGER , v_vds_id UUID, v_base_interface VARCHAR(50) , v_vlan_id INTEGER, v_mtu INTEGER, v_bridged BOOLEAN, v_labels TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vds_interface(addr, bond_name, bond_type, gateway, id, is_bond, bond_opts, mac_addr, name, network_name, speed, subnet, boot_protocol, type, VDS_ID, base_interface, vlan_id, mtu, bridged, labels) VALUES(v_addr, v_bond_name, v_bond_type, v_gateway, v_id, v_is_bond, v_bond_opts, v_mac_addr, v_name, v_network_name, v_speed, v_subnet, v_boot_protocol, v_type, v_vds_id, v_base_interface, v_vlan_id, v_mtu, v_bridged, v_labels); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatevds_interface(v_addr VARCHAR(20) , v_bond_name VARCHAR(50) , v_bond_type INTEGER , v_gateway VARCHAR(20) , v_id UUID, v_is_bond BOOLEAN , v_bond_opts VARCHAR(4000) , v_mac_addr VARCHAR(20) , v_name VARCHAR(50), v_network_name VARCHAR(50) , v_speed INTEGER , v_subnet VARCHAR(20) , v_boot_protocol INTEGER , v_type INTEGER , v_vds_id UUID, v_base_interface VARCHAR(50), v_vlan_id INTEGER, v_mtu INTEGER, v_bridged BOOLEAN, v_labels TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_interface SET addr = v_addr,bond_name = v_bond_name,bond_type = v_bond_type,gateway = v_gateway, is_bond = v_is_bond,bond_opts = v_bond_opts,mac_addr = v_mac_addr, name = v_name,network_name = v_network_name,speed = v_speed, subnet = v_subnet,boot_protocol = v_boot_protocol, type = v_type,VDS_ID = v_vds_id,base_interface = v_base_interface,vlan_id = v_vlan_id,_update_date = LOCALTIMESTAMP, mtu = v_mtu, bridged = v_bridged, labels = v_labels WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletevds_interface(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vds_interface WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Clear_network_from_nics(v_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_interface SET network_name = null WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getinterface_viewByvds_id(v_vds_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds_interface_view WHERE vds_id = v_vds_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_permissions_view WHERE user_id = v_user_id AND entity_id = v_vds_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS host_networks_by_cluster_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE host_networks_by_cluster_rs AS ( vds_id UUID, network_name VARCHAR ); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetHostNetworksByCluster(v_cluster_id UUID) RETURNS SETOF host_networks_by_cluster_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_static.vds_id, vds_interface.network_name FROM vds_static JOIN vds_interface ON vds_interface.vds_id = vds_static.vds_id AND vds_static.vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getinterface_viewByAddr(v_cluster_id UUID, v_addr VARCHAR(50)) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_interface_view.* FROM vds_interface_view INNER JOIN vds_static ON vds_interface_view.vds_id = vds_static.vds_id WHERE vds_interface_view.addr = v_addr AND vds_static.vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsManagedInterfaceByVdsId(v_vds_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds_interface_view -- Checking if the 2nd bit in the type column is set, meaning that the interface is managed WHERE vds_id = v_vds_id AND (type & 2) = 2 AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_permissions_view WHERE user_id = v_user_id AND entity_id = v_vds_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsInterfacesByNetworkId(v_network_id UUID) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_interface_view.* FROM vds_interface_view INNER JOIN vds ON vds.vds_id = vds_interface_view.vds_id INNER JOIN network_cluster ON network_cluster.cluster_id = vds.vds_group_id INNER JOIN network ON network.id = network_cluster.network_id AND network.name = vds_interface_view.network_name WHERE network.id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsInterfaceById(v_vds_interface_id UUID) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds_interface_view WHERE id = v_vds_interface_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsInterfaceByName(v_host_id UUID, v_name VARCHAR(50)) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds_interface_view WHERE name = v_name AND vds_id = v_host_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetInterfacesByClusterId(v_cluster_id UUID) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_interface_view.* FROM vds_interface_view INNER JOIN vds_static ON vds_interface_view.vds_id = vds_static.vds_id WHERE vds_static.vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetInterfacesByDataCenterId(v_data_center_id UUID) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_interface_view.* FROM vds_interface_view INNER JOIN vds_static ON vds_interface_view.vds_id = vds_static.vds_id INNER JOIN vds_groups ON vds_static.vds_group_id = vds_groups.vds_group_id WHERE vds_groups.storage_pool_id = v_data_center_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmInterface(v_id UUID, v_mac_addr VARCHAR(20) , v_name VARCHAR(50), v_speed INTEGER , v_vnic_profile_id UUID , v_vm_guid UUID , v_vmt_guid UUID , v_type INTEGER, v_linked BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_interface(id, mac_addr, name, speed, vnic_profile_id, vm_guid, vmt_guid, type, linked) VALUES(v_id, v_mac_addr, v_name, v_speed, v_vnic_profile_id, v_vm_guid, v_vmt_guid, v_type, v_linked); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmInterface(v_id UUID, v_mac_addr VARCHAR(20) , v_name VARCHAR(50), v_speed INTEGER , v_vnic_profile_id UUID , v_vm_guid UUID , v_vmt_guid UUID , v_type INTEGER, v_linked BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_interface SET mac_addr = v_mac_addr,name = v_name, speed = v_speed, vnic_profile_id = v_vnic_profile_id, vm_guid = v_vm_guid, vmt_guid = v_vmt_guid,type = v_type, _update_date = LOCALTIMESTAMP, linked = v_linked WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmInterface(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM vm_interface WHERE id = v_id FOR UPDATE; DELETE FROM vm_interface WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInterfaceByVmInterfaceId(v_id UUID) RETURNS SETOF vm_interface STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmInterfaces() RETURNS SETOF vm_interface STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInterfacesByVmId(v_vm_id UUID) RETURNS SETOF vm_interface STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface WHERE vm_guid = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInterfaceByTemplateId(v_template_id UUID) RETURNS SETOF vm_interface STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface WHERE vmt_guid = v_template_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInterfacesByNetworkId(v_network_id UUID) RETURNS SETOF vm_interface STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_interface.* FROM vm_interface INNER JOIN vnic_profiles ON vm_interface.vnic_profile_id = vnic_profiles.id INNER JOIN vm_static on vm_interface.vm_guid = vm_static.vm_guid WHERE vnic_profiles.network_id = v_network_id AND vm_static.entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplateInterfacesByNetworkId(v_network_id UUID) RETURNS SETOF vm_interface STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_interface.* FROM vm_interface INNER JOIN vm_static on vm_interface.vmt_guid = vm_static.vm_guid INNER JOIN vnic_profiles ON vm_interface.vnic_profile_id = vnic_profiles.id WHERE vnic_profiles.network_id = v_network_id AND vm_static.entity_type = 'TEMPLATE'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetMacsByDataCenterId(v_data_center_id UUID) RETURNS SETOF varchar STABLE AS $procedure$ BEGIN RETURN QUERY SELECT mac_addr FROM vm_interface WHERE EXISTS (SELECT 1 FROM vm_static JOIN vds_groups ON vm_static.vds_group_id = vds_groups.vds_group_id WHERE vds_groups.storage_pool_id = v_data_center_id AND vm_static.vm_guid = vm_interface.vm_guid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmNetworkInterfaceViews() RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmNetworkInterfaceViewByVmNetworkInterfaceViewId(v_id UUID) RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface_view WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPluggedVmInterfacesByMac(v_mac_address VARCHAR(20)) RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface_view WHERE mac_addr = v_mac_address AND is_plugged = true; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmNetworkInterfaceViewByVmId(v_vm_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface_view WHERE vm_guid = v_vm_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmNetworkInterfaceViewByTemplateId(v_template_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface_view WHERE vmt_guid = v_template_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = v_template_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInterfaceViewsByNetworkId(v_network_id UUID) RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_interface_view.* FROM vm_interface_view INNER JOIN vnic_profiles ON vnic_profiles.id = vm_interface_view.vnic_profile_id WHERE vnic_profiles.network_id = v_network_id AND vm_interface_view.vm_entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplateInterfaceViewsByNetworkId(v_network_id UUID) RETURNS SETOF vm_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_interface_view.* FROM vm_interface_view INNER JOIN vnic_profiles ON vnic_profiles.id = vm_interface_view.vnic_profile_id WHERE vnic_profiles.network_id = v_network_id AND vm_interface_view.vm_entity_type = 'TEMPLATE'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getvm_interface_statisticsById(v_id UUID) RETURNS SETOF vm_interface_statistics STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_interface_statistics WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertvm_interface_statistics(v_id UUID, v_rx_drop DECIMAL(18,0) , v_rx_rate DECIMAL(18,0) , v_rx_total BIGINT , v_rx_offset BIGINT , v_tx_drop DECIMAL(18,0) , v_tx_rate DECIMAL(18,0) , v_tx_total BIGINT , v_tx_offset BIGINT , v_iface_status INTEGER , v_sample_time DOUBLE PRECISION , v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_interface_statistics(id, rx_drop, rx_rate, rx_total, rx_offset, tx_drop, tx_rate, tx_total, tx_offset, vm_id, iface_status, sample_time) VALUES(v_id, v_rx_drop, v_rx_rate, v_rx_total, v_rx_offset, v_tx_drop, v_tx_rate, v_tx_total, v_tx_offset, v_vm_id, v_iface_status, v_sample_time); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatevm_interface_statistics(v_id UUID, v_rx_drop DECIMAL(18,0) , v_rx_rate DECIMAL(18,0) , v_rx_total BIGINT , v_rx_offset BIGINT , v_tx_drop DECIMAL(18,0) , v_tx_rate DECIMAL(18,0) , v_tx_total BIGINT , v_tx_offset BIGINT , v_iface_status INTEGER , v_sample_time DOUBLE PRECISION , v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_interface_statistics SET rx_drop = v_rx_drop,rx_rate = v_rx_rate,rx_total = v_rx_total,rx_offset = v_rx_offset, tx_drop = v_tx_drop,tx_rate = v_tx_rate,tx_total = v_tx_total,tx_offset = v_tx_offset, vm_id = v_vm_id,iface_status = v_iface_status,sample_time = v_sample_time, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletevm_interface_statistics(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM vm_interface_statistics WHERE id = v_id FOR UPDATE; DELETE FROM vm_interface_statistics WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmGuestAgentInterfacesByVmId(v_vm_id UUID, v_user_id UUID, v_filtered BOOLEAN) RETURNS SETOF vm_guest_agent_interfaces STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_guest_agent_interfaces WHERE vm_id = v_vm_id AND (NOT v_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmGuestAgentInterfacesByVmId(v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_guest_agent_interfaces WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmGuestAgentInterface(v_vm_id UUID, v_interface_name VARCHAR(50), v_mac_address VARCHAR(59), v_ipv4_addresses text, v_ipv6_addresses text) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_guest_agent_interfaces(vm_id, interface_name, mac_address, ipv4_addresses, ipv6_addresses) VALUES(v_vm_id, v_interface_name, v_mac_address, v_ipv4_addresses, v_ipv6_addresses); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertvds_interface_statistics(v_id UUID, v_rx_drop DECIMAL(18,0) , v_rx_rate DECIMAL(18,0) , v_rx_total BIGINT , v_rx_offset BIGINT , v_tx_drop DECIMAL(18,0) , v_tx_rate DECIMAL(18,0) , v_tx_total BIGINT , v_tx_offset BIGINT , v_iface_status INTEGER , v_sample_time DOUBLE PRECISION , v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vds_interface_statistics(id, rx_drop, rx_rate, rx_total, rx_offset, tx_drop, tx_rate, tx_total, tx_offset, vds_id, iface_status, sample_time) VALUES(v_id, v_rx_drop, v_rx_rate, v_rx_total, v_rx_offset, v_tx_drop, v_tx_rate, v_tx_total, v_tx_offset, v_vds_id, v_iface_status, v_sample_time); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatevds_interface_statistics(v_id UUID, v_rx_drop DECIMAL(18,0) , v_rx_rate DECIMAL(18,0) , v_rx_total BIGINT , v_rx_offset BIGINT , v_tx_drop DECIMAL(18,0) , v_tx_rate DECIMAL(18,0) , v_tx_total BIGINT , v_tx_offset BIGINT , v_iface_status INTEGER , v_sample_time DOUBLE PRECISION , v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_interface_statistics SET rx_drop = v_rx_drop,rx_rate = v_rx_rate,rx_total = v_rx_total,rx_offset = v_rx_offset, tx_drop = v_tx_drop,tx_rate = v_tx_rate,tx_total = v_tx_total,tx_offset = v_tx_offset, vds_id = v_vds_id,iface_status = v_iface_status,sample_time = v_sample_time, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletevds_interface_statistics(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM vds_interface_statistics WHERE id = v_id FOR UPDATE; DELETE FROM vds_interface_statistics WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertnetwork_cluster(v_cluster_id UUID, v_network_id UUID, v_status INTEGER, v_is_display BOOLEAN, v_required BOOLEAN, v_migration BOOLEAN, v_management BOOLEAN, v_is_gluster BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO network_cluster(cluster_id, network_id, status, is_display, required, migration, management, is_gluster) VALUES(v_cluster_id, v_network_id, v_status, v_is_display, v_required, v_migration, v_management, v_is_gluster); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatenetwork_cluster(v_cluster_id UUID, v_network_id UUID, v_status INTEGER, v_is_display BOOLEAN, v_required BOOLEAN, v_migration BOOLEAN, v_management BOOLEAN, v_is_gluster BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE network_cluster SET status = v_status, is_display = v_is_display, required = v_required, migration = v_migration, management = v_management, is_gluster = v_is_gluster WHERE cluster_id = v_cluster_id AND network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatenetwork_cluster_status(v_cluster_id UUID, v_network_id UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE network_cluster SET status = v_status WHERE cluster_id = v_cluster_id AND network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletenetwork_cluster(v_cluster_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM network_cluster WHERE cluster_id = v_cluster_id AND network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromnetwork_cluster() RETURNS SETOF network_cluster STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_cluster; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromnetwork_clusterByClusterId(v_cluster_id UUID) RETURNS SETOF network_cluster STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_cluster WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllManagementNetworksByDataCenterId(v_data_center_id UUID) RETURNS SETOF network STABLE AS $procedure$ BEGIN RETURN QUERY SELECT network.* FROM network JOIN network_cluster ON network.id = network_cluster.network_id JOIN vds_groups ON network_cluster.cluster_id = vds_groups.vds_group_id WHERE vds_groups.storage_pool_id = v_data_center_id AND network_cluster.management; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromnetwork_clusterByNetworkId(v_network_id UUID) RETURNS SETOF network_cluster STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_cluster WHERE network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getnetwork_clusterBycluster_idAndBynetwork_id(v_cluster_id UUID, v_network_id UUID) RETURNS SETOF network_cluster STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_cluster WHERE cluster_id = v_cluster_id AND network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetvmStaticByGroupIdAndNetwork(v_groupId UUID, v_networkName VARCHAR(50)) RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* from vm_static inner join vm_interface_view on vm_static.vm_guid = vm_interface_view.vm_guid and network_name = v_networkName and vm_static.vds_group_id = v_groupId; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION set_network_exclusively_as_display(v_cluster_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE network_cluster SET is_display = true WHERE cluster_id = v_cluster_id AND network_id = v_network_id; IF FOUND THEN UPDATE network_cluster SET is_display = false WHERE cluster_id = v_cluster_id AND network_id != v_network_id; END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION set_network_exclusively_as_migration(v_cluster_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE network_cluster SET migration = true WHERE cluster_id = v_cluster_id AND network_id = v_network_id; IF FOUND THEN UPDATE network_cluster SET migration = false WHERE cluster_id = v_cluster_id AND network_id != v_network_id; END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION set_network_exclusively_as_gluster(v_cluster_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE network_cluster SET is_gluster = COALESCE(network_id = v_network_id, false) WHERE cluster_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION set_network_exclusively_as_management(v_cluster_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE network_cluster SET management = true WHERE cluster_id = v_cluster_id AND network_id = v_network_id; IF FOUND THEN UPDATE network_cluster SET management = false WHERE cluster_id = v_cluster_id AND network_id != v_network_id; END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVnicProfileByVnicProfileId(v_id UUID) RETURNS SETOF vnic_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVnicProfile(v_id UUID, v_name VARCHAR(50), v_network_id UUID, v_network_qos_id UUID, v_port_mirroring BOOLEAN, v_passthrough BOOLEAN, v_custom_properties TEXT, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vnic_profiles(id, name, network_id, network_qos_id, port_mirroring, passthrough, custom_properties, description) VALUES(v_id, v_name, v_network_id, v_network_qos_id, v_port_mirroring, v_passthrough, v_custom_properties, v_description); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVnicProfile(v_id UUID, v_name VARCHAR(50), v_network_id UUID, v_network_qos_id UUID, v_port_mirroring BOOLEAN, v_passthrough BOOLEAN, v_custom_properties TEXT, v_description TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE vnic_profiles SET id = v_id, name = v_name, network_id = v_network_id, network_qos_id = v_network_qos_id, port_mirroring = v_port_mirroring, passthrough = v_passthrough, custom_properties = v_custom_properties, description = v_description,_update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVnicProfile(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN DELETE FROM vnic_profiles WHERE id = v_id; -- Delete the vnic profiles permissions DELETE FROM permissions WHERE object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVnicProfiles() RETURNS SETOF vnic_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVnicProfilesByNetworkId(v_network_id UUID) RETURNS SETOF vnic_profiles STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles WHERE network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVnicProfileViewByVnicProfileViewId(v_id UUID, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF vnic_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles_view WHERE id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vnic_profile_permissions_view WHERE user_id = v_user_id AND entity_id = vnic_profiles_view.id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVnicProfileViews(v_user_id uuid, v_is_filtered boolean) RETURNS SETOF vnic_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles_view WHERE NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vnic_profile_permissions_view WHERE user_id = v_user_id AND entity_id = vnic_profiles_view.id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVnicProfileViewsByNetworkId(v_network_id UUID, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF vnic_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles_view WHERE network_id = v_network_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vnic_profile_permissions_view WHERE user_id = v_user_id AND entity_id = vnic_profiles_view.id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVnicProfileViewsByDataCenterId(v_id UUID, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF vnic_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles_view WHERE data_center_id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vnic_profile_permissions_view WHERE user_id = v_user_id AND entity_id = vnic_profiles_view.id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVnicProfileViewsByNetworkQosId(v_network_qos_id UUID) RETURNS SETOF vnic_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vnic_profiles_view WHERE network_qos_id = v_network_qos_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIscsiIfacesByHostIdAndStorageTargetId(v_host_id UUID, v_target_id varchar(50)) RETURNS SETOF vds_interface_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_interface_view.* FROM vds_interface_view, network_cluster, network, iscsi_bonds_networks_map, iscsi_bonds_storage_connections_map WHERE iscsi_bonds_storage_connections_map.connection_id = v_target_id AND iscsi_bonds_storage_connections_map.iscsi_bond_id = iscsi_bonds_networks_map.iscsi_bond_id AND iscsi_bonds_networks_map.network_id = network.id AND network.id = network_cluster.network_id AND network.name = vds_interface_view.network_name AND network_cluster.cluster_id = vds_interface_view.vds_group_id AND vds_interface_view.vds_id = v_host_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertHostNicVfsConfig(v_id UUID, v_nic_id UUID, v_is_all_networks_allowed BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO host_nic_vfs_config(id, nic_id, is_all_networks_allowed) VALUES(v_id, v_nic_id, v_is_all_networks_allowed); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateHostNicVfsConfig(v_id UUID, v_nic_id UUID, v_is_all_networks_allowed BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE host_nic_vfs_config SET id = v_id, nic_id = v_nic_id, is_all_networks_allowed = v_is_all_networks_allowed, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteHostNicVfsConfig(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM host_nic_vfs_config WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetHostNicVfsConfigById(v_id UUID) RETURNS SETOF host_nic_vfs_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_nic_vfs_config WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVfsConfigByNicId(v_nic_id UUID) RETURNS SETOF host_nic_vfs_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_nic_vfs_config WHERE nic_id = v_nic_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromHostNicVfsConfigs() RETURNS SETOF host_nic_vfs_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM host_nic_vfs_config; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllVfsConfigByHostId(v_host_id UUID) RETURNS SETOF host_nic_vfs_config STABLE AS $procedure$ BEGIN RETURN QUERY SELECT host_nic_vfs_config.* FROM host_nic_vfs_config INNER JOIN vds_interface ON host_nic_vfs_config.nic_id = vds_interface.id WHERE vds_interface.vds_id = v_host_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkAttachmentByNetworkAttachmentId(v_id UUID) RETURNS SETOF network_attachments STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_attachments WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertNetworkAttachment(v_id UUID, v_network_id UUID, v_nic_id UUID, v_boot_protocol CHARACTER VARYING(20), v_address CHARACTER VARYING(20), v_netmask CHARACTER VARYING(20), v_gateway CHARACTER VARYING(20), v_custom_properties TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO network_attachments(id, network_id, nic_id, boot_protocol, address, netmask, gateway, custom_properties) VALUES(v_id, v_network_id, v_nic_id, v_boot_protocol, v_address, v_netmask, v_gateway, v_custom_properties); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateNetworkAttachment(v_id UUID, v_network_id UUID, v_nic_id UUID, v_boot_protocol CHARACTER VARYING(20), v_address CHARACTER VARYING(20), v_netmask CHARACTER VARYING(20), v_gateway CHARACTER VARYING(20), v_custom_properties TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE network_attachments SET network_id = v_network_id, nic_id = v_nic_id, boot_protocol = v_boot_protocol, address = v_address, netmask = v_netmask, gateway = v_gateway, custom_properties = v_custom_properties, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteNetworkAttachment(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM network_attachments WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromNetworkAttachments() RETURNS SETOF network_attachments STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_attachments; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkAttachmentsByNicId(v_nic_id UUID) RETURNS SETOF network_attachments STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_attachments WHERE nic_id = v_nic_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkAttachmentsByNetworkId(v_network_id UUID) RETURNS SETOF network_attachments STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_attachments WHERE network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkAttachmentsByHostId(v_host_id UUID) RETURNS SETOF network_attachments STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM network_attachments WHERE EXISTS (SELECT 1 FROM vds_interface WHERE network_attachments.nic_id = vds_interface.id AND vds_interface.vds_id = v_host_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworkAttachmentByNicIdAndNetworkId(v_nic_id UUID, v_network_id UUID) RETURNS SETOF network_attachments STABLE AS $procedure$ BEGIN RETURN QUERY SELECT na.* FROM network_attachments na WHERE na.network_id = v_network_id and na.nic_id = v_nic_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveNetworkAttachmentByNetworkId(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM network_attachments na WHERE na.network_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVfsConfigNetwork(v_vfs_config_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vfs_config_networks(vfs_config_id, network_id) VALUES(v_vfs_config_id, v_network_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVfsConfigNetwork(v_vfs_config_id UUID, v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vfs_config_networks WHERE vfs_config_id = v_vfs_config_id AND network_id = v_network_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAllVfsConfigNetworks(v_vfs_config_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vfs_config_networks WHERE vfs_config_id = v_vfs_config_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNetworksByVfsConfigId(v_vfs_config_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT network_id FROM vfs_config_networks WHERE vfs_config_id = v_vfs_config_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVfsConfigLabel(v_vfs_config_id UUID, v_label TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vfs_config_labels(vfs_config_id, label) VALUES(v_vfs_config_id, v_label); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVfsConfigLabel(v_vfs_config_id UUID, v_label TEXT) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vfs_config_labels WHERE vfs_config_id = v_vfs_config_id AND label = v_label; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAllVfsConfigLabels(v_vfs_config_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vfs_config_labels WHERE vfs_config_id = v_vfs_config_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLabelsByVfsConfigId(v_vfs_config_id UUID) RETURNS SETOF TEXT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT label FROM vfs_config_labels WHERE vfs_config_id = v_vfs_config_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertNumaNode(v_numa_node_id UUID, v_vds_id UUID, v_vm_id UUID, v_numa_node_index SMALLINT, v_mem_total BIGINT, v_cpu_count SMALLINT, v_mem_free BIGINT, v_usage_mem_percent INTEGER, v_cpu_sys DECIMAL(5,2), v_cpu_user DECIMAL(5,2), v_cpu_idle DECIMAL(5,2), v_usage_cpu_percent INTEGER, v_distance text) RETURNS VOID AS $procedure$ BEGIN BEGIN INSERT INTO numa_node(numa_node_id, vds_id, vm_id, numa_node_index, mem_total, cpu_count, mem_free, usage_mem_percent, cpu_sys, cpu_user, cpu_idle, usage_cpu_percent, distance) VALUES(v_numa_node_id, v_vds_id, v_vm_id, v_numa_node_index, v_mem_total, v_cpu_count, v_mem_free, v_usage_mem_percent, v_cpu_sys, v_cpu_user, v_cpu_idle, v_usage_cpu_percent, v_distance); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateNumaNode(v_numa_node_id UUID, v_numa_node_index SMALLINT, v_mem_total BIGINT, v_cpu_count SMALLINT, v_distance text) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE numa_node SET numa_node_index = v_numa_node_index, mem_total = v_mem_total, cpu_count = v_cpu_count, distance = v_distance WHERE numa_node_id = v_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateNumaNodeStatistics(v_numa_node_id UUID, v_mem_free BIGINT, v_usage_mem_percent INTEGER, v_cpu_sys DECIMAL(5,2), v_cpu_user DECIMAL(5,2), v_cpu_idle DECIMAL(5,2), v_usage_cpu_percent INTEGER) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE numa_node SET mem_free = v_mem_free, usage_mem_percent = v_usage_mem_percent, cpu_sys = v_cpu_sys, cpu_user = v_cpu_user, cpu_idle = v_cpu_idle, usage_cpu_percent = v_usage_cpu_percent WHERE numa_node_id = v_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteNumaNode(v_numa_node_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM numa_node WHERE numa_node_id = v_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromNumaNode() RETURNS SETOF numa_node STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node.* FROM numa_node; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumaNodeByNumaNodeId(v_numa_node_id UUID) RETURNS SETOF numa_node STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node.* FROM numa_node WHERE numa_node_id = v_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumaNodeByVdsId(v_vds_id UUID) RETURNS SETOF numa_node STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node.* FROM numa_node WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumaNodeByVmId(v_vm_id UUID) RETURNS SETOF numa_node STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node.* FROM numa_node WHERE vm_id = v_vm_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertNumaNodeCpu(v_id UUID, v_numa_node_id UUID, v_cpu_core_id INTEGER) RETURNS VOID AS $procedure$ BEGIN BEGIN INSERT INTO numa_node_cpu_map(id, numa_node_id, cpu_core_id) VALUES(v_id, v_numa_node_id, v_cpu_core_id); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteNumaNodeCpuByNumaNodeId(v_numa_node_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM numa_node_cpu_map WHERE numa_node_id = v_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromNumaNodeCpuMap() RETURNS SETOF numa_node_cpu_map STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_cpu_map.* FROM numa_node_cpu_map; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumaNodeCpuByNumaNodeId(v_numa_node_id UUID) RETURNS SETOF integer STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_cpu_map.cpu_core_id FROM numa_node_cpu_map WHERE numa_node_id = v_numa_node_id ORDER BY numa_node_cpu_map.cpu_core_id ASC; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertNumaNodeMap(v_id UUID, v_vm_numa_node_id UUID, v_vds_numa_node_id UUID, v_vds_numa_node_index SMALLINT, v_is_pinned BOOLEAN) RETURNS VOID AS $procedure$ BEGIN BEGIN INSERT INTO vm_vds_numa_node_map(id, vm_numa_node_id, vds_numa_node_id, vds_numa_node_index, is_pinned) VALUES(v_id, v_vm_numa_node_id, v_vds_numa_node_id, v_vds_numa_node_index, v_is_pinned); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteNumaNodeMapByVmNumaNodeId(v_vm_numa_node_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM vm_vds_numa_node_map WHERE vm_numa_node_id = v_vm_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteNumaNodeMapByVdsNumaNodeId(v_vds_numa_node_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM vm_vds_numa_node_map WHERE vds_numa_node_id = v_vds_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteUnpinnedNumaNodeMapByVmNumaNodeId(v_vm_numa_node_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM vm_vds_numa_node_map WHERE vm_numa_node_id = v_vm_numa_node_id AND is_pinned = FALSE; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumaNodeCpuByVdsId(v_vds_id UUID) RETURNS SETOF numa_node_cpus_view STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_cpus_view.* FROM numa_node_cpus_view WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumaNodeCpuByVmId(v_vm_id UUID) RETURNS SETOF numa_node_cpus_view STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_cpus_view.* FROM numa_node_cpus_view WHERE vm_id = v_vm_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmNumaNodeByVdsNumaNodeIdWithPinnedInfo(v_vds_numa_node_id UUID, v_is_pinned BOOLEAN) RETURNS SETOF numa_node STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_assignment_view.assigned_vm_numa_node_id, numa_node_assignment_view.run_in_vds_id, numa_node_assignment_view.vm_numa_node_vm_id, numa_node_assignment_view.vm_numa_node_index, numa_node_assignment_view.vm_numa_node_mem_total, numa_node_assignment_view.vm_numa_node_cpu_count, numa_node_assignment_view.vm_numa_node_mem_free, numa_node_assignment_view.vm_numa_node_usage_mem_percent, numa_node_assignment_view.vm_numa_node_cpu_sys, numa_node_assignment_view.vm_numa_node_cpu_user, numa_node_assignment_view.vm_numa_node_cpu_idle, numa_node_assignment_view.vm_numa_node_usage_cpu_percent, numa_node_assignment_view.vm_numa_node_distance FROM numa_node_assignment_view WHERE run_in_vds_numa_node_id = v_vds_numa_node_id AND is_pinned = v_is_pinned; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmNumaNodeByVdsNumaNodeId(v_vds_numa_node_id UUID) RETURNS SETOF numa_node STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_assignment_view.assigned_vm_numa_node_id, numa_node_assignment_view.run_in_vds_id, numa_node_assignment_view.vm_numa_node_vm_id, numa_node_assignment_view.vm_numa_node_index, numa_node_assignment_view.vm_numa_node_mem_total, numa_node_assignment_view.vm_numa_node_cpu_count, numa_node_assignment_view.vm_numa_node_mem_free, numa_node_assignment_view.vm_numa_node_usage_mem_percent, numa_node_assignment_view.vm_numa_node_cpu_sys, numa_node_assignment_view.vm_numa_node_cpu_user, numa_node_assignment_view.vm_numa_node_cpu_idle, numa_node_assignment_view.vm_numa_node_usage_cpu_percent, numa_node_assignment_view.vm_numa_node_distance FROM numa_node_assignment_view WHERE run_in_vds_numa_node_id = v_vds_numa_node_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllAssignedNumaNodeInfomation() RETURNS SETOF numa_node_assignment_view STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_assignment_view.* FROM numa_node_assignment_view; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLastRunInPnodeInfoByVmId(v_vm_id UUID) RETURNS SETOF numa_node_assignment_view STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_assignment_view.* FROM numa_node_assignment_view WHERE vm_numa_node_vm_id = v_vm_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmNumaNodeByVdsGroup(v_vds_group_id UUID) RETURNS SETOF numa_node_with_vds_group_view STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT numa_node_with_vds_group_view.* FROM numa_node_with_vds_group_view WHERE vds_group_id = v_vds_group_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromPolicyUnits() RETURNS SETOF policy_units STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM policy_units; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetPolicyUnitByPolicyUnitId(v_id UUID) RETURNS SETOF policy_units STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM policy_units WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertPolicyUnit( v_id UUID, v_name VARCHAR(128), v_description text, v_is_internal BOOLEAN, v_type SMALLINT, v_custom_properties_regex text, v_enabled BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO policy_units( id, name, description, is_internal, type, custom_properties_regex, enabled) VALUES( v_id, v_name, v_description, v_is_internal, v_type, v_custom_properties_regex, v_enabled); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdatePolicyUnit( v_id UUID, v_enabled BOOLEAN, v_custom_properties_regex text, v_description text) RETURNS VOID AS $procedure$ BEGIN UPDATE policy_units SET custom_properties_regex = v_custom_properties_regex, enabled = v_enabled, description = v_description WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeletePolicyUnit(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM policy_units WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertProvider( v_id UUID, v_name VARCHAR(128), v_description VARCHAR(4000), v_url VARCHAR(512), v_provider_type VARCHAR(32), v_auth_required BOOLEAN, v_auth_username VARCHAR(64), v_auth_password TEXT, v_custom_properties TEXT, v_tenant_name VARCHAR DEFAULT NULL, v_plugin_type VARCHAR DEFAULT NULL, v_agent_configuration TEXT DEFAULT NULL, v_additional_properties TEXT DEFAULT NULL, v_auth_url TEXT DEFAULT NULL) RETURNS VOID AS $procedure$ BEGIN INSERT INTO providers( id, name, description, url, provider_type, auth_required, auth_username, auth_password, custom_properties, tenant_name, plugin_type, agent_configuration, additional_properties, auth_url) VALUES( v_id, v_name, v_description, v_url, v_provider_type, v_auth_required, v_auth_username, v_auth_password, v_custom_properties, v_tenant_name, v_plugin_type, v_agent_configuration, v_additional_properties, v_auth_url); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateProvider( v_id UUID, v_name VARCHAR(128), v_description VARCHAR(4000), v_url VARCHAR(512), v_provider_type VARCHAR(32), v_auth_required BOOLEAN, v_auth_username VARCHAR(64), v_auth_password TEXT, v_custom_properties TEXT, v_tenant_name VARCHAR DEFAULT NULL, v_plugin_type VARCHAR DEFAULT NULL, v_agent_configuration TEXT DEFAULT NULL, v_additional_properties TEXT DEFAULT NULL, v_auth_url TEXT DEFAULT NULL) RETURNS VOID AS $procedure$ BEGIN UPDATE providers SET name = v_name, description = v_description, url = v_url, provider_type = v_provider_type, auth_required = v_auth_required, auth_username = v_auth_username, auth_password = v_auth_password, custom_properties = v_custom_properties, tenant_name = v_tenant_name, plugin_type = v_plugin_type, _update_date = NOW(), agent_configuration = v_agent_configuration, additional_properties = v_additional_properties, auth_url = v_auth_url WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteProvider(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM providers WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromProviders() RETURNS SETOF providers STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM providers; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromProvidersByType(v_provider_type varchar(32)) RETURNS SETOF providers STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM providers WHERE provider_type = v_provider_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetProviderByProviderId(v_id UUID) RETURNS SETOF providers STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM providers WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetProviderByName(v_name VARCHAR) RETURNS SETOF providers STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM providers WHERE name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertStorageQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_max_throughput INTEGER, v_max_read_throughput INTEGER, v_max_write_throughput INTEGER, v_max_iops INTEGER, v_max_read_iops INTEGER, v_max_write_iops INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO qos(id, qos_type, name, description, storage_pool_id, max_throughput, max_read_throughput, max_write_throughput, max_iops, max_read_iops, max_write_iops) VALUES(v_id, v_qos_type, v_name, v_description, v_storage_pool_id, v_max_throughput, v_max_read_throughput, v_max_write_throughput, v_max_iops, v_max_read_iops, v_max_write_iops); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertCpuQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_cpu_limit INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO qos(id, qos_type, name, description, storage_pool_id, cpu_limit) VALUES(v_id, v_qos_type, v_name, v_description, v_storage_pool_id, v_cpu_limit); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertNetworkQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_inbound_average INTEGER, v_inbound_peak INTEGER, v_inbound_burst INTEGER, v_outbound_average INTEGER, v_outbound_peak INTEGER, v_outbound_burst INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO qos(id, qos_type, name, description, storage_pool_id, inbound_average, inbound_peak, inbound_burst, outbound_average, outbound_peak, outbound_burst) VALUES(v_id, v_qos_type, v_name, v_description, v_storage_pool_id, v_inbound_average, v_inbound_peak, v_inbound_burst, v_outbound_average, v_outbound_peak, v_outbound_burst); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertHostNetworkQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_out_average_linkshare INTEGER, v_out_average_upperlimit INTEGER, v_out_average_realtime INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO qos(id, qos_type, name, description, storage_pool_id, out_average_linkshare, out_average_upperlimit, out_average_realtime) VALUES(v_id, v_qos_type, v_name, v_description, v_storage_pool_id, v_out_average_linkshare, v_out_average_upperlimit, v_out_average_realtime); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStorageQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_max_throughput INTEGER, v_max_read_throughput INTEGER, v_max_write_throughput INTEGER, v_max_iops INTEGER, v_max_read_iops INTEGER, v_max_write_iops INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE qos SET qos_type = v_qos_type, name = v_name, description = v_description, storage_pool_id = v_storage_pool_id, max_throughput = v_max_throughput, max_read_throughput = v_max_read_throughput, max_write_throughput = v_max_write_throughput, max_iops = v_max_iops, max_read_iops = v_max_read_iops, max_write_iops = v_max_write_iops, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateCpuQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_cpu_limit INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE qos SET qos_type = v_qos_type, name = v_name, description = v_description, storage_pool_id = v_storage_pool_id, cpu_limit = v_cpu_limit, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateNetworkQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_inbound_average INTEGER, v_inbound_peak INTEGER, v_inbound_burst INTEGER, v_outbound_average INTEGER, v_outbound_peak INTEGER, v_outbound_burst INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE qos SET qos_type = v_qos_type, name = v_name, description = v_description, storage_pool_id = v_storage_pool_id, inbound_average = v_inbound_average, inbound_peak = v_inbound_peak, inbound_burst = v_inbound_burst, outbound_average = v_outbound_average, outbound_peak = v_outbound_peak, outbound_burst = v_outbound_burst, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateHostNetworkQos(v_id uuid, v_qos_type SMALLINT, v_name VARCHAR(50), v_description TEXT, v_storage_pool_id uuid, v_out_average_linkshare INTEGER, v_out_average_upperlimit INTEGER, v_out_average_realtime INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE qos SET qos_type = v_qos_type, name = v_name, description = v_description, storage_pool_id = v_storage_pool_id, out_average_linkshare = v_out_average_linkshare, out_average_upperlimit = v_out_average_upperlimit, out_average_realtime = v_out_average_realtime, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteQos(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM qos WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQosByQosId(v_id UUID) RETURNS SETOF qos STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM qos WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllQosForStoragePoolByQosType(v_storage_pool_id UUID, v_qos_type SMALLINT) RETURNS SETOF qos STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM qos WHERE storage_pool_id = v_storage_pool_id AND qos_type = v_qos_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllQosForStoragePool(v_storage_pool_id UUID) RETURNS SETOF qos STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM qos WHERE storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllQosByQosType(v_qos_type SMALLINT) RETURNS SETOF qos STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM qos WHERE qos_type = v_qos_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetQosByDiskProfiles (v_disk_profile_ids UUID[]) RETURNS SETOF qos_for_disk_profile_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM qos_for_disk_profile_view WHERE disk_profile_id = ANY(v_disk_profile_ids); END;$PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetQosByVmIds (v_vm_ids UUID[]) RETURNS SETOF qos_for_vm_view STABLE AS $PROCEDURE$ BEGIN RETURN QUERY SELECT * FROM qos_for_vm_view WHERE vm_id = ANY(v_vm_ids); END;$PROCEDURE$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertQuota(v_id UUID, v_storage_pool_id UUID, v_quota_name VARCHAR(50), v_description VARCHAR(500), v_threshold_vds_group_percentage INTEGER, v_threshold_storage_percentage INTEGER, v_grace_vds_group_percentage INTEGER, v_grace_storage_percentage INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO quota(id, storage_pool_id, quota_name, description, threshold_vds_group_percentage, threshold_storage_percentage, grace_vds_group_percentage, grace_storage_percentage) VALUES(v_id, v_storage_pool_id, v_quota_name, v_description, v_threshold_vds_group_percentage , v_threshold_storage_percentage, v_grace_vds_group_percentage, v_grace_storage_percentage); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertQuotaLimitation(v_id UUID, v_quota_id UUID, v_storage_id UUID, v_vds_group_id UUID, v_virtual_cpu INTEGER, v_mem_size_mb BIGINT, v_storage_size_gb BIGINT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO quota_limitation(id, quota_id, storage_id, vds_group_id, virtual_cpu, mem_size_mb, storage_size_gb) VALUES(v_id, v_quota_id, v_storage_id, v_vds_group_id, v_virtual_cpu, v_mem_size_mb, v_storage_size_gb); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaStorageByStorageGuid(v_storage_id UUID, v_id UUID, v_allow_empty BOOLEAN) RETURNS SETOF quota_storage_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM (SELECT COALESCE(q_storage_view.quota_storage_id, q_g_view.quota_id) as quota_storage_id, q_g_view.quota_id as quota_id, q_storage_view.storage_id, q_storage_view.storage_name, COALESCE(q_storage_view.storage_size_gb, q_g_view.storage_size_gb) as storage_size_gb, COALESCE(q_storage_view.storage_size_gb_usage, q_g_view.storage_size_gb_usage) as storage_size_gb_usage FROM quota_global_view q_g_view LEFT OUTER JOIN quota_storage_view q_storage_view ON q_g_view.quota_id = q_storage_view.quota_id AND (v_storage_id = q_storage_view.storage_id OR v_storage_id IS NULL) WHERE q_g_view.quota_id = v_id) sub WHERE (v_allow_empty OR storage_size_gb IS NOT NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaByAdElementId(v_ad_element_id UUID, v_storage_pool_id UUID, v_recursive BOOLEAN) RETURNS SETOF quota_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM quota_view WHERE quota_view.quota_id IN (SELECT object_id FROM PERMISSIONS WHERE object_type_id = 17 AND role_id in (SELECT role_id FROM ROLES_groups where action_group_id = 901) AND ad_element_id = v_ad_element_id OR (v_recursive AND ad_element_id IN (SELECT * FROM getUserAndGroupsById(v_ad_element_id)))) AND (v_storage_pool_id = quota_view.storage_pool_id or v_storage_pool_id IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getAllThinQuota() RETURNS SETOF quota_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM quota_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getQuotaCount() RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT count(*) as num_quota FROM quota; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaStorageByQuotaGuid(v_id UUID) RETURNS SETOF quota_storage_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM quota_storage_view WHERE quota_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaVdsGroupByVdsGroupGuid(v_vds_group_id UUID, v_id UUID, v_allow_empty BOOLEAN) RETURNS SETOF quota_vds_group_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM (SELECT COALESCE(q_vds_view.quota_vds_group_id, q_g_view.quota_id) as quota_vds_group_id, q_g_view.quota_id as quota_id, q_vds_view.vds_group_id as vds_group_id, q_vds_view.vds_group_name as vds_group_name, COALESCE(q_vds_view.virtual_cpu,q_g_view.virtual_cpu) as virtual_cpu, COALESCE(q_vds_view.virtual_cpu_usage, q_g_view.virtual_cpu_usage) as virtual_cpu_usage, COALESCE(q_vds_view.mem_size_mb,q_g_view.mem_size_mb) as mem_size_mb, COALESCE(q_vds_view.mem_size_mb_usage, q_g_view.mem_size_mb_usage) as mem_size_mb_usage FROM quota_global_view q_g_view LEFT OUTER JOIN quota_vds_group_view q_vds_view ON q_g_view.quota_id = q_vds_view.quota_id AND (v_vds_group_id = q_vds_view.vds_group_id OR v_vds_group_id IS NULL) WHERE q_g_view.quota_id = v_id) sub WHERE v_allow_empty OR virtual_cpu IS NOT NULL OR mem_size_mb IS NOT NULL; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaVdsGroupByQuotaGuid(v_id UUID) RETURNS SETOF quota_vds_group_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT quota_vds_group_view.* FROM quota_vds_group_view WHERE quota_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteQuotaByQuotaGuid(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM quota WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteQuotaLimitationByQuotaGuid(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM quota_limitation WHERE quota_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateQuotaMetaData(v_id UUID, v_storage_pool_id UUID, v_quota_name VARCHAR(50), v_description VARCHAR(500), v_threshold_vds_group_percentage INTEGER, v_threshold_storage_percentage INTEGER, v_grace_vds_group_percentage INTEGER, v_grace_storage_percentage INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE quota SET storage_pool_id = v_storage_pool_id, quota_name = v_quota_name, description = v_description, _update_date = LOCALTIMESTAMP, threshold_vds_group_percentage = v_threshold_vds_group_percentage, threshold_storage_percentage = v_threshold_storage_percentage, grace_vds_group_percentage = v_grace_vds_group_percentage, grace_storage_percentage = v_grace_storage_percentage WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaByStoragePoolGuid(v_storage_pool_id UUID) RETURNS SETOF quota_global_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE (storage_pool_id = v_storage_pool_id or v_storage_pool_id IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaByQuotaGuid(v_id UUID) RETURNS SETOF quota_global_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE quota_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetQuotaByQuotaName(v_quota_name VARCHAR) RETURNS SETOF quota_global_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM quota_global_view WHERE quota_name = v_quota_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllThinQuotasByStorageId(v_storage_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered boolean) RETURNS SETOF quota_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT quota_id, storage_pool_id, storage_pool_name, quota_name, description, threshold_vds_group_percentage, threshold_storage_percentage, grace_vds_group_percentage, grace_storage_percentage, quota_enforcement_type FROM quota_limitations_view WHERE (storage_id = v_storage_id OR (is_global AND NOT is_empty AND storage_size_gb IS NOT null AND storage_pool_id IN (SELECT storage_pool_id FROM storage_pool_iso_map WHERE storage_id = v_storage_id))) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM permissions p JOIN engine_session_user_flat_groups u ON u.granted_id = p.ad_element_id WHERE u.engine_session_seq_id = v_engine_session_seq_id AND p.object_type_id = 17 AND -- quota object p.role_id = 'def0000a-0000-0000-0000-def00000000a' AND -- consume quota quota_id = p.object_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllThinQuotasByVDSGroupId(v_vds_group_id UUID, v_engine_session_seq_id INTEGER, v_is_filtered boolean) RETURNS SETOF quota_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT quota_id, storage_pool_id, storage_pool_name, quota_name, description, threshold_vds_group_percentage, threshold_storage_percentage, grace_vds_group_percentage, grace_storage_percentage, quota_enforcement_type FROM quota_limitations_view WHERE (vds_group_id = v_vds_group_id OR (is_global AND NOT is_empty AND virtual_cpu IS NOT null AND storage_pool_id IN (SELECT storage_pool_id FROM vds_groups WHERE vds_group_id = v_vds_group_id))) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM permissions p JOIN engine_session_user_flat_groups u ON u.granted_id = p.ad_element_id WHERE u.engine_session_seq_id = v_engine_session_seq_id AND p.object_type_id = 17 AND -- quota object p.role_id = 'def0000a-0000-0000-0000-def00000000a' AND -- consume quota quota_id = p.object_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION IsQuotaInUse(v_quota_id UUID) RETURNS boolean STABLE AS $BODY$ DECLARE result boolean := FALSE; BEGIN if EXISTS (SELECT quota_id FROM image_storage_domain_map WHERE quota_id = v_quota_id UNION SELECT quota_id FROM vm_static WHERE quota_id = v_quota_id) then result := TRUE; END if; return result; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertRepo_domain_file_meta_data(v_repo_domain_id UUID, v_repo_image_id VARCHAR(256), v_repo_image_name VARCHAR(256), v_size BIGINT, v_date_created TIMESTAMP WITH TIME ZONE, v_last_refreshed BIGINT, v_file_type INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO repo_file_meta_data(repo_domain_id, repo_image_id, repo_image_name, size, date_created, last_refreshed, file_type) VALUES(v_repo_domain_id, v_repo_image_id, v_repo_image_name, v_size, v_date_created, v_last_refreshed, v_file_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteRepo_domain_file_list(v_storage_domain_id UUID, v_file_type INTEGER DEFAULT NULL) RETURNS VOID AS $procedure$ BEGIN DELETE FROM repo_file_meta_data WHERE repo_domain_id = v_storage_domain_id AND (v_file_type IS NULL OR file_type = v_file_type); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetRepo_files_by_storage_domain(v_storage_domain_id UUID, v_file_type INTEGER DEFAULT NULL) RETURNS SETOF repo_file_meta_data STABLE AS $procedure$ BEGIN RETURN QUERY SELECT repo_file_meta_data.* FROM repo_file_meta_data WHERE repo_domain_id = v_storage_domain_id AND (v_file_type IS NULL OR repo_file_meta_data.file_type = v_file_type) ORDER BY repo_file_meta_data.last_refreshed; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS GetRepo_files_in_all_storage_pools_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE GetRepo_files_in_all_storage_pools_rs AS(storage_domain_id UUID, last_refreshed BIGINT, file_type INTEGER); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetRepo_files_in_all_storage_pools(v_storage_domain_type INTEGER, v_storage_pool_status INTEGER, v_vds_status INTEGER, v_storage_domain_status INTEGER) RETURNS SETOF GetRepo_files_in_all_storage_pools_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT distinct b.storage_domain_id,c.last_refreshed,b.file_type FROM storage_domain_file_repos b LEFT OUTER JOIN (SELECT storage_domain_id,file_type,min(last_refreshed) as last_refreshed FROM storage_domain_file_repos a Group by storage_domain_id,file_type) as c ON b.storage_domain_id = c.storage_domain_id AND b.file_type = c.file_type WHERE b.storage_domain_type = v_storage_domain_type and b.storage_pool_status = v_storage_pool_status and b.storage_domain_status = v_storage_domain_status and b.vds_status = v_vds_status; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertSnapshot( v_snapshot_id UUID, v_vm_id UUID, v_snapshot_type VARCHAR(32), v_status VARCHAR(32), v_description VARCHAR(4000), v_creation_date TIMESTAMP WITH TIME ZONE, v_app_list TEXT, v_vm_configuration TEXT, v_memory_volume VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO snapshots( snapshot_id, status, vm_id, snapshot_type, description, creation_date, app_list, vm_configuration, memory_volume) VALUES( v_snapshot_id, v_status, v_vm_id, v_snapshot_type, v_description, v_creation_date, v_app_list, v_vm_configuration, v_memory_volume); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateSnapshot( v_snapshot_id UUID, v_vm_id UUID, v_snapshot_type VARCHAR(32), v_status VARCHAR(32), v_description VARCHAR(4000), v_creation_date TIMESTAMP WITH TIME ZONE, v_app_list TEXT, v_vm_configuration TEXT, v_memory_volume VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN UPDATE snapshots SET status = v_status, vm_id = v_vm_id, snapshot_type = v_snapshot_type, description = v_description, creation_date = v_creation_date, app_list = v_app_list, vm_configuration = v_vm_configuration, memory_volume = v_memory_volume, _update_date = NOW() WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateSnapshotStatus( v_snapshot_id UUID, v_status VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE snapshots SET status = v_status WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateSnapshotId( v_snapshot_id UUID, v_new_snapshot_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE snapshots SET snapshot_id = v_new_snapshot_id WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteSnapshot(v_snapshot_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM snapshots WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromSnapshots() RETURNS SETOF snapshots STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM snapshots; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllSnapshotsByStorageDomainId(v_storage_id UUID) RETURNS SETOF snapshots STABLE AS $procedure$ BEGIN RETURN QUERY SELECT snapshots.* FROM snapshots JOIN images ON snapshots.snapshot_id = images.vm_snapshot_id JOIN image_storage_domain_map ON image_storage_domain_map.storage_domain_id = v_storage_id and image_storage_domain_map.image_id=images.image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotByVmIdAndType( v_vm_id UUID, v_snapshot_type VARCHAR(32), v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF snapshots STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM snapshots WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id)) ORDER BY creation_date ASC LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotByVmIdAndTypeAndStatus( v_vm_id UUID, v_snapshot_type VARCHAR(32), v_status VARCHAR(32)) RETURNS SETOF snapshots STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM snapshots WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type AND status = v_status ORDER BY creation_date ASC LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotByVmIdAndStatus( v_vm_id UUID, v_status VARCHAR(32)) RETURNS SETOF snapshots STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM snapshots WHERE vm_id = v_vm_id AND status = v_status ORDER BY creation_date ASC LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS GetAllFromSnapshotsByVmId_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE GetAllFromSnapshotsByVmId_rs AS (snapshot_id UUID, vm_id UUID, snapshot_type VARCHAR(32), status VARCHAR(32), description VARCHAR(4000), creation_date TIMESTAMP WITH TIME ZONE, app_list TEXT, memory_volume VARCHAR(255), vm_configuration TEXT, vm_configuration_available BOOLEAN); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetAllFromSnapshotsByVmId( v_vm_id UUID, v_user_id UUID, v_is_filtered BOOLEAN, v_fill_configuration BOOLEAN) RETURNS SETOF GetAllFromSnapshotsByVmId_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT snapshot_id, vm_id, snapshot_type, status, description, creation_date, app_list, memory_volume, CASE WHEN v_fill_configuration = TRUE THEN vm_configuration ELSE NULL END, vm_configuration IS NOT NULL AND LENGTH(vm_configuration) > 0 FROM snapshots WHERE vm_id = v_vm_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id)) ORDER BY creation_date ASC; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotBySnapshotId(v_snapshot_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF snapshots STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM snapshots WHERE snapshot_id = v_snapshot_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = (SELECT vm_id FROM snapshots where snapshot_id = v_snapshot_id))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotIdsByVmIdAndType( v_vm_id UUID, v_snapshot_type VARCHAR(32)) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT snapshot_id FROM snapshots WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type ORDER BY creation_date ASC; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetSnapshotIdsByVmIdAndTypeAndStatus( v_vm_id UUID, v_snapshot_type VARCHAR(32), v_status VARCHAR(32)) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT snapshot_id FROM snapshots WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type AND status = v_status ORDER BY creation_date ASC; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckIfSnapshotExistsByVmIdAndType( v_vm_id UUID, v_snapshot_type VARCHAR(32)) RETURNS SETOF booleanResultType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT EXISTS( SELECT * FROM snapshots WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckIfSnapshotExistsByVmIdAndStatus( v_vm_id UUID, v_status VARCHAR(32)) RETURNS SETOF booleanResultType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT EXISTS( SELECT * FROM snapshots WHERE vm_id = v_vm_id AND status = v_status); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckIfSnapshotExistsByVmIdAndSnapshotId( v_vm_id UUID, v_snapshot_id UUID) RETURNS SETOF booleanResultType STABLE AS $procedure$ BEGIN RETURN QUERY SELECT EXISTS( SELECT * FROM snapshots WHERE vm_id = v_vm_id AND snapshot_id = v_snapshot_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumOfSnapshotsByMemoryVolume( v_memory_volume VARCHAR(255)) RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT COUNT(*) FROM snapshots WHERE memory_volume = v_memory_volume; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateMemory( v_memory_volume VARCHAR(255), v_vm_id UUID, v_snapshot_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE snapshots SET memory_volume = v_memory_volume WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveMemoryFromSnapshotByVmIdAndType( v_vm_id UUID, v_snapshot_type VARCHAR(32)) RETURNS VOID AS $procedure$ BEGIN UPDATE snapshots SET memory_volume = NULL WHERE vm_id = v_vm_id AND snapshot_type = v_snapshot_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveMemoryFromSnapshotBySnapshotId( v_snapshot_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE snapshots SET memory_volume = NULL WHERE snapshot_id = v_snapshot_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* ---------------------------------------------------------------- Stored procedures for database operations on Storage Device related table: storage_device ----------------------------------------------------------------*/ Create or replace FUNCTION InsertStorageDevice(v_id UUID, v_name text, v_device_uuid VARCHAR(38), v_filesystem_uuid VARCHAR(38), v_vds_id UUID, v_description text, v_device_type VARCHAR(50), v_device_path text, v_filesystem_type VARCHAR(50), v_mount_point text, v_size BIGINT, v_is_free BOOLEAN, v_is_gluster_brick BOOLEAN) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_device(id, name, device_uuid, filesystem_uuid, vds_id, description, device_type, device_path, filesystem_type, mount_point, size, is_free, is_gluster_brick) VALUES (v_id, v_name, v_device_uuid, v_filesystem_uuid, v_vds_id, v_description, v_device_type, v_device_path, v_filesystem_type, v_mount_point, v_size, v_is_free, v_is_gluster_brick); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStorageDevice(v_id UUID, v_name text, v_device_uuid VARCHAR(38), v_filesystem_uuid VARCHAR(38), v_description text, v_device_type VARCHAR(50), v_device_path text, v_filesystem_type VARCHAR(50), v_mount_point text, v_size BIGINT, v_is_free BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_device SET name = v_name, device_uuid = v_device_uuid, filesystem_uuid = v_filesystem_uuid, description = v_description, device_type = v_device_type, device_path = v_device_path, filesystem_type = v_filesystem_type, mount_point = v_mount_point, size = v_size, is_free = v_is_free, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageDeviceById(v_id UUID) RETURNS SETOF storage_device STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_device WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageDevicesByVdsId(v_vds_id UUID) RETURNS SETOF storage_device STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_device WHERE vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteStorageDeviceById(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM storage_device WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateIsFreeFlagById(v_id UUID, v_is_free BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_device SET is_free = v_is_free, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertLUNs(v_LUN_id VARCHAR(50), v_physical_volume_id VARCHAR(50) , v_volume_group_id VARCHAR(50) , v_serial VARCHAR(4000) , v_lun_mapping INTEGER , v_vendor_id VARCHAR(50) , v_product_id VARCHAR(50) , v_device_size INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO LUNs(LUN_id, physical_volume_id, volume_group_id, serial, lun_mapping, vendor_id, product_id, device_size) VALUES(v_LUN_id, v_physical_volume_id, v_volume_group_id, v_serial, v_lun_mapping, v_vendor_id, v_product_id, v_device_size); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateLUNs(v_LUN_id VARCHAR(50), v_physical_volume_id VARCHAR(50) , v_volume_group_id VARCHAR(50) , v_serial VARCHAR(4000) , v_lun_mapping INTEGER , v_vendor_id VARCHAR(50) , v_product_id VARCHAR(50) , v_device_size INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE LUNs SET LUN_id = v_LUN_id, physical_volume_id = v_physical_volume_id, volume_group_id = v_volume_group_id, serial = v_serial, lun_mapping = v_lun_mapping, vendor_id = v_vendor_id, product_id = v_product_id, device_size = v_device_size WHERE LUN_id = v_LUN_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteLUN(v_LUN_id VARCHAR(50)) RETURNS VOID AS $procedure$ DECLARE v_val VARCHAR(50); BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select LUN_id INTO v_val FROM LUNs WHERE LUN_id = v_LUN_id FOR UPDATE; DELETE FROM LUNs WHERE LUN_id = v_LUN_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromLUNs() RETURNS SETOF luns_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM luns_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLUNsBystorage_server_connection(v_storage_server_connection VARCHAR(50)) RETURNS SETOF luns_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT luns_view.* FROM luns_view INNER JOIN LUN_storage_server_connection_map ON LUN_storage_server_connection_map.LUN_id = luns_view.LUN_id WHERE LUN_storage_server_connection_map.storage_server_connection = v_storage_server_connection; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLUNsByVolumeGroupId(v_volume_group_id VARCHAR(50)) RETURNS SETOF luns_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM luns_view WHERE volume_group_id = v_volume_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLUNByLUNId(v_LUN_id VARCHAR(50)) RETURNS SETOF luns_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM luns_view WHERE LUN_id = v_LUN_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertstorage_domain_dynamic(v_available_disk_size INTEGER , v_id UUID, v_used_disk_size INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_domain_dynamic(available_disk_size, id, used_disk_size) VALUES(v_available_disk_size, v_id, v_used_disk_size); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_domain_dynamic(v_available_disk_size INTEGER , v_id UUID, v_used_disk_size INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_domain_dynamic SET available_disk_size = v_available_disk_size,used_disk_size = v_used_disk_size, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStorageDomainExternalStatus( v_storage_id UUID, v_external_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_domain_dynamic SET external_status = v_external_status WHERE id = v_storage_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletestorage_domain_dynamic(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM storage_domain_dynamic WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromstorage_domain_dynamic() RETURNS SETOF storage_domain_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domain_dynamic; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domain_dynamicByid(v_id UUID) RETURNS SETOF storage_domain_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domain_dynamic WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertstorage_pool_iso_map(v_storage_id UUID, v_storage_pool_id UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_pool_iso_map(storage_id, storage_pool_id, status) VALUES(v_storage_id, v_storage_pool_id, v_status); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletestorage_pool_iso_map(v_storage_id UUID, v_storage_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM storage_pool_iso_map WHERE storage_id = v_storage_id AND storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromstorage_pool_iso_map() RETURNS SETOF storage_pool_iso_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool_iso_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_pool_iso_mapBystorage_idAndBystorage_pool_id(v_storage_id UUID,v_storage_pool_id UUID) RETURNS SETOF storage_pool_iso_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool_iso_map WHERE storage_id = v_storage_id AND storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_pool_iso_mapsBystorage_id(v_storage_id UUID) RETURNS SETOF storage_pool_iso_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool_iso_map WHERE storage_id = v_storage_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_pool_iso_mapsByBystorage_pool_id(v_storage_id UUID, v_storage_pool_id UUID) RETURNS SETOF storage_pool_iso_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT storage_pool_iso_map.* FROM storage_pool_iso_map INNER JOIN storage_domain_static on storage_pool_iso_map.storage_id = storage_domain_static.id WHERE storage_pool_id = v_storage_pool_id AND storage_domain_static.storage_type != 9; -- filter Cinder storage domains END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_pool_iso_map_status(v_storage_id UUID, v_storage_pool_id UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_pool_iso_map SET status = v_status WHERE storage_pool_id = v_storage_pool_id AND storage_id = v_storage_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertstorage_server_connections(v_connection VARCHAR(250), v_id VARCHAR(50), v_iqn VARCHAR(128) , v_port VARCHAR(50) , v_portal VARCHAR(50) , v_password text, v_storage_type INTEGER, v_user_name TEXT, v_mount_options VARCHAR(500), v_vfs_type VARCHAR(128), v_nfs_version VARCHAR(4), v_nfs_timeo smallint, v_nfs_retrans smallint) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_server_connections(connection, id, iqn, port,portal, password, storage_type, user_name,mount_options,vfs_type,nfs_version,nfs_timeo,nfs_retrans) VALUES(v_connection, v_id, v_iqn,v_port,v_portal, v_password, v_storage_type, v_user_name,v_mount_options,v_vfs_type,v_nfs_version,v_nfs_timeo,v_nfs_retrans); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_server_connections(v_connection VARCHAR(250), v_id VARCHAR(50), v_iqn VARCHAR(128) , v_password text, v_storage_type INTEGER, v_port VARCHAR(50) , v_portal VARCHAR(50) , v_user_name TEXT, v_mount_options VARCHAR(500), v_vfs_type VARCHAR(128), v_nfs_version VARCHAR(4), v_nfs_timeo smallint, v_nfs_retrans smallint) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_server_connections SET connection = v_connection,iqn = v_iqn,password = v_password,port = v_port, portal = v_portal,storage_type = v_storage_type,user_name = v_user_name,mount_options = v_mount_options, vfs_type = v_vfs_type, nfs_version = v_nfs_version, nfs_timeo = v_nfs_timeo, nfs_retrans = v_nfs_retrans WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletestorage_server_connections(v_id VARCHAR(50)) RETURNS VOID AS $procedure$ DECLARE v_val VARCHAR(50); BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM storage_server_connections WHERE id = v_id FOR UPDATE; DELETE FROM storage_server_connections WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByid(v_id VARCHAR(50)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByConnection(v_connection VARCHAR(250)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE connection = v_connection; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByIqn(v_iqn VARCHAR(128)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE iqn = v_iqn OR iqn IS NULL AND v_iqn IS NULL; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByIqnAndConnection(v_iqn VARCHAR(128) , v_connection VARCHAR(250)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE iqn = v_iqn and (connection = v_connection or connection is NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByKey(v_iqn VARCHAR(128) , v_connection VARCHAR(250), v_port VARCHAR(50) , v_portal VARCHAR(50) , v_username VARCHAR(50)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE (iqn = v_iqn or (iqn IS NULL AND v_iqn IS NULL)) AND (connection = v_connection) AND (port = v_port or (port IS NULL AND v_port IS NULL)) AND (portal = v_portal or (portal is NULL AND v_portal IS NULL)) AND (user_name = v_username or (user_name is NULL AND v_username IS NULL)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByStorageType(v_storage_type INTEGER) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE storage_type = v_storage_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllstorage_server_connections() RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageServerConnectionsByIds(v_ids TEXT) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE id = any(string_to_array(v_ids,',')::VARCHAR[]); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByVolumeGroupId(v_volume_group_id VARCHAR(50)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT storage_server_connections.* FROM LUN_storage_server_connection_map LUN_storage_server_connection_map INNER JOIN LUNs ON LUN_storage_server_connection_map.LUN_id = LUNs.LUN_id INNER JOIN storage_domain_static ON LUNs.volume_group_id = storage_domain_static.storage INNER JOIN storage_server_connections ON LUN_storage_server_connection_map.storage_server_connection = storage_server_connections.id WHERE (storage_domain_static.storage = v_volume_group_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageConnectionsByStorageTypeAndStatus(v_storage_pool_id UUID, v_storage_type integer, v_statuses varchar(20)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ DECLARE statuses int[]; BEGIN statuses := string_to_array(v_statuses,',')::integer[]; RETURN QUERY SELECT * FROM storage_server_connections WHERE (v_storage_type is NULL or storage_server_connections.storage_type = v_storage_type) AND (id in (select storage from storage_domains where storage_domains.storage_pool_id = v_storage_pool_id and storage_domains.status = any(statuses)) OR (id in (select lun_storage_server_connection_map.storage_server_connection FROM lun_storage_server_connection_map INNER JOIN luns ON lun_storage_server_connection_map.lun_id = luns.lun_id INNER JOIN storage_domains ON luns.volume_group_id = storage_domains.storage WHERE (storage_domains.storage_pool_id = v_storage_pool_id and storage_domains.status = any(statuses))))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNFSstorage_server_connectionsByStoragePoolId(v_storage_pool_id UUID) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT distinct storage_server_connections.* FROM storage_server_connections storage_server_connections INNER JOIN storage_domain_static ON storage_server_connections.id = storage_domain_static.storage INNER JOIN storage_pool_iso_map ON storage_pool_iso_map.storage_id = storage_domain_static.id WHERE (storage_pool_iso_map.storage_pool_id = v_storage_pool_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_server_connectionsByLunId(v_lunId VARCHAR(50)) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT storage_server_connections.* FROM storage_server_connections storage_server_connections INNER JOIN lun_storage_server_connection_map ON lun_storage_server_connection_map.storage_server_connection = storage_server_connections.id WHERE (lun_storage_server_connection_map.lun_id = v_lunId); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertLUN_storage_server_connection_map(v_LUN_id VARCHAR(50), v_storage_server_connection VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO LUN_storage_server_connection_map(LUN_id, storage_server_connection) VALUES(v_LUN_id, v_storage_server_connection); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateLUN_storage_server_connection_map(v_LUN_id VARCHAR(50), v_storage_server_connection VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteLUN_storage_server_connection_map(v_LUN_id VARCHAR(50), v_storage_server_connection VARCHAR(50)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM LUN_storage_server_connection_map WHERE LUN_id = v_LUN_id AND storage_server_connection = v_storage_server_connection; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromLUN_storage_server_connection_map() RETURNS SETOF LUN_storage_server_connection_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM LUN_storage_server_connection_map lUN_storage_server_connection_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetLUN_storage_server_connection_mapByLUNBystorage_server_conn(v_LUN_id VARCHAR(50),v_storage_server_connection VARCHAR(50)) RETURNS SETOF LUN_storage_server_connection_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM LUN_storage_server_connection_map lUN_storage_server_connection_map WHERE LUN_id = v_LUN_id AND storage_server_connection = v_storage_server_connection; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertStorageServerConnectionExtension( v_id UUID, v_vds_id UUID, v_iqn VARCHAR(128), v_user_name TEXT, v_password TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_server_connection_extension(id, vds_id, iqn, user_name, password) VALUES (v_id, v_vds_id, v_iqn, v_user_name, v_password); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStorageServerConnectionExtension( v_id UUID, v_vds_id UUID, v_iqn VARCHAR(128), v_user_name TEXT, v_password TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_server_connection_extension SET vds_id = v_vds_id, iqn = v_iqn, user_name = v_user_name, password = v_password WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteStorageServerConnectionExtension(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM storage_server_connection_extension WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageServerConnectionExtensionById(v_id UUID) RETURNS SETOF storage_server_connection_extension STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connection_extension WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageServerConnectionExtensionsByHostId(v_vds_id UUID) RETURNS SETOF storage_server_connection_extension STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connection_extension WHERE vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageServerConnectionExtensionsByHostIdAndTarget(v_vds_id UUID, v_iqn VARCHAR(128)) RETURNS SETOF storage_server_connection_extension STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connection_extension WHERE vds_id = v_vds_id and iqn = v_iqn; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromStorageServerConnectionExtensions() RETURNS SETOF storage_server_connection_extension STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connection_extension; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertstorage_pool(v_description VARCHAR(4000), v_free_text_comment text, v_id UUID, v_name VARCHAR(40), v_status INTEGER, v_is_local BOOLEAN, v_master_domain_version INTEGER, v_spm_vds_id UUID , v_compatibility_version VARCHAR(40), v_quota_enforcement_type INTEGER, v_mac_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_pool(description, free_text_comment, id, name, status, is_local, master_domain_version, spm_vds_id, compatibility_version, quota_enforcement_type, mac_pool_id) VALUES(v_description, v_free_text_comment, v_id, v_name, v_status, v_is_local, v_master_domain_version, v_spm_vds_id, v_compatibility_version, v_quota_enforcement_type, v_mac_pool_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_pool(v_description VARCHAR(4000), v_free_text_comment text, v_id UUID, v_name VARCHAR(40), v_status INTEGER, v_is_local BOOLEAN, v_storage_pool_format_type VARCHAR(50), v_master_domain_version INTEGER, v_spm_vds_id UUID , v_compatibility_version VARCHAR(40), v_quota_enforcement_type INTEGER, v_mac_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_pool SET description = v_description, free_text_comment = v_free_text_comment, name = v_name, is_local = v_is_local, status = v_status, storage_pool_format_type = v_storage_pool_format_type, master_domain_version = v_master_domain_version, spm_vds_id = v_spm_vds_id, compatibility_version = v_compatibility_version, _update_date = LOCALTIMESTAMP, quota_enforcement_type=v_quota_enforcement_type, mac_pool_id = v_mac_pool_id WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_pool_partial(v_description VARCHAR(4000), v_free_text_comment text, v_id UUID, v_name VARCHAR(40), v_is_local BOOLEAN, v_storage_pool_format_type VARCHAR(50), v_compatibility_version VARCHAR(40), v_quota_enforcement_type INTEGER, v_mac_pool_id UUID ) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_pool SET description = v_description, free_text_comment = v_free_text_comment, name = v_name, is_local = v_is_local, storage_pool_format_type = v_storage_pool_format_type, compatibility_version = v_compatibility_version, _update_date = LOCALTIMESTAMP, quota_enforcement_type = v_quota_enforcement_type, mac_pool_id = v_mac_pool_id WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_pool_status( v_id UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_pool SET status = v_status, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION IncreaseStoragePoolMasterVersion( v_id UUID) RETURNS INTEGER AS $procedure$ DECLARE v_master_domain_version INTEGER; BEGIN UPDATE storage_pool SET master_domain_version = master_domain_version + 1 WHERE id = v_id RETURNING master_domain_version into v_master_domain_version; RETURN v_master_domain_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletestorage_pool(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" select vm_guid INTO v_val FROM vm_static where vm_guid in (select vm_guid from vms where storage_pool_id = v_id) FOR UPDATE; DELETE FROM snapshots WHERE vm_id IN ( SELECT vm_guid FROM vms WHERE storage_pool_id = v_id); delete FROM vm_static where vm_guid in (select vm_guid from vms where storage_pool_id = v_id); -- Delete vm pools as empty pools are not supported -- Get (and keep) a shared lock with "right to upgrade to exclusive" select vm_pool_id INTO v_val FROM vm_pools where vm_pool_id in (select vm_pool_id from vm_pools_view where storage_pool_id = v_id) FOR UPDATE; DELETE FROM vm_pools WHERE vm_pool_id IN ( SELECT vm_pool_id FROM vm_pools_view WHERE storage_pool_id = v_id); -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM storage_pool WHERE id = v_id FOR UPDATE; DELETE FROM storage_pool WHERE id = v_id; -- delete StoragePool permissions -- DELETE FROM permissions where object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromstorage_pool(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool WHERE (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_storage_pool_permissions_view WHERE user_id = v_user_id AND entity_id = id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllByStatus(v_status INTEGER) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool WHERE status = v_status; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_poolByid(v_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool WHERE id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_storage_pool_permissions_view WHERE user_id = v_user_id AND entity_id = v_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_poolByName(v_name VARCHAR(40), v_is_case_sensitive BOOLEAN) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool WHERE name = v_name OR (NOT v_is_case_sensitive AND name ilike v_name); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_poolsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT storage_pool.* FROM storage_pool inner join storage_pool_iso_map on storage_pool.id = storage_pool_iso_map.storage_pool_id WHERE storage_pool_iso_map.storage_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmAndTemplatesIdsByStorageDomainId(v_storage_domain_id UUID, v_include_shareable BOOLEAN, v_active_only BOOLEAN) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vd.vm_id FROM vm_device vd INNER JOIN images_storage_domain_view i ON i.image_group_id = vd.device_id WHERE i.storage_id = v_storage_domain_id AND i.active = v_active_only AND i.shareable = v_include_shareable; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_poolsByVdsId(v_vdsId UUID) RETURNS SETOF storage_pool STABLE AS $procedure$ DECLARE v_clusterId UUID; BEGIN select vds_group_id INTO v_clusterId FROM Vds_static WHERE vds_id = v_vdsId; RETURN QUERY SELECT * FROM storage_pool WHERE storage_pool.id in(select storage_pool_id FROM vds_groups WHERE vds_group_id = v_clusterId); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_poolsByVdsGroupId(v_clusterId UUID) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_pool WHERE storage_pool.id in(select storage_pool_id FROM vds_groups WHERE vds_group_id = v_clusterId); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION LoadStorageDomainInfoByDomainId(v_storage_domain_id UUID) RETURNS SETOF storage_domains_ovf_info STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains_ovf_info ovf WHERE ovf.storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION LoadStorageDomainInfoByDiskId(v_disk_id UUID) RETURNS SETOF storage_domains_ovf_info STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains_ovf_info ovf WHERE ovf.ovf_disk_id = v_disk_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertStorageDomainOvfInfo(v_storage_domain_id UUID, v_status INTEGER, v_ovf_disk_id UUID, v_stored_ovfs_ids TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_domains_ovf_info (storage_domain_id, status, ovf_disk_id, stored_ovfs_ids) VALUES(v_storage_domain_id, v_status, v_ovf_disk_id, v_stored_ovfs_ids); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION LoadStorageDomainsForOvfIds(v_ovfs_ids TEXT) RETURNS SETOF UUID AS $procedure$ BEGIN RETURN QUERY SELECT ovf.storage_domain_id FROM storage_domains_ovf_info ovf WHERE string_to_array(ovf.stored_ovfs_ids,',') && string_to_array(v_ovfs_ids,','); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateStorageDomainOvfInfo(v_storage_domain_id UUID, v_status INTEGER, v_ovf_disk_id UUID, v_stored_ovfs_ids TEXT, v_last_updated TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_domains_ovf_info SET status = v_status, storage_domain_id = v_storage_domain_id, ovf_disk_id = v_ovf_disk_id, stored_ovfs_ids = v_stored_ovfs_ids, last_updated = v_last_updated WHERE ovf_disk_id = v_ovf_disk_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteStorageDomainOvfInfo(v_ovf_disk_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM storage_domains_ovf_info WHERE ovf_disk_id = v_ovf_disk_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateOvfUpdatedInfo(v_storage_domains_ids VARCHAR(5000), v_status INTEGER, v_except_status INTEGER) RETURNS VOID AS $procedure$ DECLARE curs_storages_ids CURSOR FOR SELECT * FROM fnSplitterUuid(v_storage_domains_ids); id UUID; BEGIN OPEN curs_storages_ids; LOOP FETCH curs_storages_ids INTO id; IF NOT FOUND THEN EXIT; END IF; UPDATE storage_domains_ovf_info SET status = v_status WHERE storage_domain_id = id AND status != v_except_status; END LOOP; CLOSE curs_storages_ids; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertstorage_domain_static(v_id UUID, v_storage VARCHAR(250), v_storage_name VARCHAR(250), v_storage_description VARCHAR(4000), v_storage_comment text, v_storage_type INTEGER, v_storage_domain_type INTEGER, v_storage_domain_format_type VARCHAR(50), v_last_time_used_as_master BIGINT, v_wipe_after_delete BOOLEAN, v_warning_low_space_indicator INTEGER, v_critical_space_action_blocker INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO storage_domain_static(id, storage,storage_name, storage_description, storage_comment, storage_type, storage_domain_type, storage_domain_format_type, last_time_used_as_master, wipe_after_delete, warning_low_space_indicator, critical_space_action_blocker) VALUES (v_id, v_storage, v_storage_name, v_storage_description, v_storage_comment, v_storage_type, v_storage_domain_type, v_storage_domain_format_type, v_last_time_used_as_master, v_wipe_after_delete, v_warning_low_space_indicator, v_critical_space_action_blocker); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_List_By_ImageId(v_image_id UUID) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE id in (SELECT storage_domain_id FROM image_storage_domain_map WHERE image_id = v_image_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatestorage_domain_static(v_id UUID, v_storage VARCHAR(250), v_storage_name VARCHAR(250), v_storage_description VARCHAR(4000), v_storage_comment text, v_storage_type INTEGER, v_storage_domain_type INTEGER, v_storage_domain_format_type INTEGER, v_last_time_used_as_master BIGINT, v_wipe_after_delete BOOLEAN, v_warning_low_space_indicator INTEGER, v_critical_space_action_blocker INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE storage_domain_static SET storage = v_storage, storage_name = v_storage_name, storage_type = v_storage_type, storage_domain_type = v_storage_domain_type, _update_date = LOCALTIMESTAMP, storage_domain_format_type = v_storage_domain_format_type, last_time_used_as_master = v_last_time_used_as_master, wipe_after_delete = v_wipe_after_delete, storage_description = v_storage_description, storage_comment = v_storage_comment, warning_low_space_indicator = v_warning_low_space_indicator, critical_space_action_blocker = v_critical_space_action_blocker WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletestorage_domain_static(v_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select id INTO v_val FROM storage_domain_static WHERE id = v_id FOR UPDATE; DELETE FROM storage_domain_static WHERE id = v_id; -- delete Storage permissions -- DELETE FROM permissions where object_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromstorage_domain_static() RETURNS SETOF storage_domain_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domain_static; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domain_staticByid(v_id UUID) RETURNS SETOF storage_domain_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domain_static WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domain_staticByName(v_name VARCHAR(250)) RETURNS SETOF storage_domain_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domain_static WHERE storage_name = v_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domain_staticByNameFiltered(v_name VARCHAR(250), v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF storage_domain_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domain_static sds WHERE storage_name = v_name AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_storage_domain_permissions_view WHERE user_id = v_user_id AND entity_id = sds.id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domain_staticBystorage_pool_id(v_storage_pool_id UUID) RETURNS SETOF storage_domain_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT storage_domain_static.* FROM storage_domain_static INNER JOIN storage_pool_iso_map ON storage_pool_iso_map.storage_id = storage_domain_static.id WHERE storage_pool_iso_map.storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS GetStorageDomainIdsByStoragePoolIdAndStatus_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE GetStorageDomainIdsByStoragePoolIdAndStatus_rs AS (storage_id UUID); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetStorageDomainIdsByStoragePoolIdAndStatus(v_storage_pool_id UUID, v_status INTEGER) RETURNS SETOF GetStorageDomainIdsByStoragePoolIdAndStatus_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT storage_id FROM storage_pool_iso_map INNER JOIN storage_domain_static on storage_pool_iso_map.storage_id = storage_domain_static.id WHERE storage_pool_id = v_storage_pool_id AND status = v_status AND storage_domain_static.storage_type != 9; -- filter Cinder storage domains END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_By_id(v_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF storage_domains_without_storage_pools STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains_without_storage_pools WHERE id = v_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_storage_domain_permissions_view WHERE user_id = v_user_id AND entity_id = v_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_by_storage_pool_id_with_permitted_action (v_user_id UUID, v_action_group_id integer, v_storage_pool_id UUID) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage_pool_id = v_storage_pool_id AND (SELECT get_entity_permissions(v_user_id, v_action_group_id, id, 11)) IS NOT NULL; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_By_id_and_by_storage_pool_id(v_id UUID, v_storage_pool_id UUID ) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE id = v_id and storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_By_storagePoolId(v_storage_pool_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage_pool_id = v_storage_pool_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_storage_domain_permissions_view WHERE user_id = v_user_id AND entity_id = id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domain_by_type_storagePoolId_and_status(v_storage_domain_type INTEGER, v_storage_pool_id UUID, v_status INTEGER) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage_pool_id = v_storage_pool_id AND storage_domain_type = v_storage_domain_type AND (v_status IS NULL OR status = v_status); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_By_connection(v_connection CHARACTER VARYING) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage IN ( SELECT id FROM storage_server_connections WHERE connection = v_connection); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromStorageDomainsByConnectionId(v_connection_id CHARACTER VARYING) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage = v_connection_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromstorage_domains(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT ON (id) * FROM storage_domains WHERE (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_storage_domain_permissions_view WHERE user_id = v_user_id AND entity_id = id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Remove_Entities_From_storage_domain(v_storage_domain_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN -- Creating a temporary table which will give all the images and the disks which resids on only the specified storage domain. (copied template disks on multiple storage domains will not be part of this table) CREATE TEMPORARY TABLE STORAGE_DOMAIN_MAP_TABLE AS select image_guid as image_id,disk_id from images_storage_domain_view where storage_id = v_storage_domain_id except select image_guid as image_id, disk_id from images_storage_domain_view where storage_id != v_storage_domain_id; exception when others then truncate table STORAGE_DOMAIN_MAP_TABLE; insert into STORAGE_DOMAIN_MAP_TABLE select image_guid as image_id,disk_id from images_storage_domain_view where storage_id = v_storage_domain_id except select image_guid as image_id, disk_id from images_storage_domain_view where storage_id != v_storage_domain_id; END; BEGIN -- All the VMs/Templates which have disks both on the specified domain and other domains. CREATE TEMPORARY TABLE ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE AS SELECT DISTINCT vm_static.vm_guid FROM vm_static INNER JOIN (-- Join vm_static only with VMs and Templates that have images on the storage domain v_storage_domain_id SELECT vm_static.vm_guid FROM vm_static INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN STORAGE_DOMAIN_MAP_TABLE ON i.image_guid = STORAGE_DOMAIN_MAP_TABLE.image_id) vm_guids_with_disks_on_storage_domain ON vm_static.vm_guid = vm_guids_with_disks_on_storage_domain.vm_guid -- With all the VMs which have images on the storage domain, get all of their images and check if there is an image on another storage domain. INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN image_storage_domain_map on i.image_guid = image_storage_domain_map.image_id WHERE image_storage_domain_map.storage_domain_id != v_storage_domain_id; exception when others then truncate table ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE; INSERT INTO ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE SELECT DISTINCT vm_static.vm_guid FROM vm_static INNER JOIN (SELECT vm_static.vm_guid FROM vm_static INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN STORAGE_DOMAIN_MAP_TABLE ON i.image_guid = STORAGE_DOMAIN_MAP_TABLE.image_id) vm_guids_with_disks_on_storage_domain ON vm_static.vm_guid = vm_guids_with_disks_on_storage_domain.vm_guid INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN image_storage_domain_map on i.image_guid = image_storage_domain_map.image_id WHERE image_storage_domain_map.storage_domain_id != v_storage_domain_id; END; BEGIN -- Templates with any images residing on only the specified storage domain CREATE TEMPORARY TABLE TEMPLATES_IDS_TEMPORARY_TABLE AS select vm_device.vm_id as vm_guid from images_storage_domain_view JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id JOIN STORAGE_DOMAIN_MAP_TABLE ON STORAGE_DOMAIN_MAP_TABLE.image_id = images_storage_domain_view.image_guid where entity_type = 'TEMPLATE' and storage_id = v_storage_domain_id AND vm_device.vm_id not in (SELECT vm_guid from ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE); exception when others then truncate table TEMPLATES_IDS_TEMPORARY_TABLE; insert into TEMPLATES_IDS_TEMPORARY_TABLE select vm_device.vm_id as vm_guid from images_storage_domain_view JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id JOIN STORAGE_DOMAIN_MAP_TABLE ON STORAGE_DOMAIN_MAP_TABLE.image_id = images_storage_domain_view.image_guid where entity_type = 'TEMPLATE' and storage_id = v_storage_domain_id AND vm_device.vm_id not in (SELECT vm_guid from ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE); END; -- Add also Template Versions based on the selected templates insert into TEMPLATES_IDS_TEMPORARY_TABLE select vm_guid from vm_static where vmt_guid in (select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE) and entity_type = 'TEMPLATE'; BEGIN -- Vms which resides on the storage domain CREATE TEMPORARY TABLE VM_IDS_TEMPORARY_TABLE AS select vm_id,vm_images_view.entity_type as entity_type from vm_images_view JOIN vm_device ON vm_device.device_id = vm_images_view.disk_id WHERE v_storage_domain_id in (SELECT * FROM fnsplitteruuid(storage_id)) AND vm_id not in (SELECT vm_guid from ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE); exception when others then truncate table VM_IDS_TEMPORARY_TABLE; insert into VM_IDS_TEMPORARY_TABLE select vm_id,vm_images_view.entity_type as entity_type from vm_images_view JOIN vm_device ON vm_device.device_id = vm_images_view.disk_id WHERE v_storage_domain_id in (SELECT * FROM fnsplitteruuid(storage_id)) AND vm_id not in (SELECT vm_guid from ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE); END; delete FROM permissions where object_id in (select vm_id as vm_guid from VM_IDS_TEMPORARY_TABLE where entity_type <> 'TEMPLATE'); delete FROM snapshots WHERE vm_id in (select vm_id as vm_guid from VM_IDS_TEMPORARY_TABLE); delete FROM image_storage_domain_map where storage_domain_id = v_storage_domain_id; delete FROM images where image_guid in (select image_id from STORAGE_DOMAIN_MAP_TABLE); delete FROM vm_interface where vmt_guid in(select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE); delete FROM permissions where object_id in (select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE); delete FROM vm_static where vm_guid in(select vm_id as vm_guid from VM_IDS_TEMPORARY_TABLE where entity_type <> 'TEMPLATE'); -- Delete devices which are related to VMs/Templates with Multiple Storage Domain (VMs/Templates which has not removed) delete FROM vm_device where device_id in (select disk_id from STORAGE_DOMAIN_MAP_TABLE); -- Delete pools and snapshots of pools based on templates from the storage domain to be removed delete FROM snapshots where vm_id in (select vm_guid FROM vm_static where vmt_guid in (select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE)); delete FROM vm_static where vmt_guid in (select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE); delete FROM vm_static where vm_guid in(select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE); -- Deletes the disks which the only storage domain they are reside on, is the storage domain. DELETE FROM base_disks WHERE disk_id IN (SELECT disk_id FROM STORAGE_DOMAIN_MAP_TABLE); -- Deletes the disks's permissions which the only storage domain they are reside on, is the storage domain. DELETE FROM permissions WHERE object_id IN (SELECT disk_id FROM STORAGE_DOMAIN_MAP_TABLE); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Force_Delete_storage_domain(v_storage_domain_id UUID) RETURNS VOID AS $procedure$ BEGIN PERFORM Remove_Entities_From_storage_domain(v_storage_domain_id); delete FROM permissions where object_id = v_storage_domain_id; delete FROM storage_domain_dynamic where id = v_storage_domain_id; delete FROM storage_domain_static where id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_List_By_storageDomainId(v_storage_domain_id UUID) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage_domains.id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_perms_get_storage_pools_with_permitted_action_on_vds_groups(v_user_id UUID, v_action_group_id integer, v_supports_virt_service boolean, v_supports_gluster_service boolean) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT sp.* FROM storage_pool sp WHERE sp.id in (SELECT vg.storage_pool_id FROM vds_groups vg WHERE (SELECT get_entity_permissions(v_user_id, v_action_group_id, vg.vds_group_id, 9)) IS NOT NULL AND ((v_supports_virt_service = TRUE AND vg.virt_service = TRUE) OR (v_supports_gluster_service = TRUE AND vg.gluster_service = TRUE)) ); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getstorage_domains_By_storage_pool_id_and_connection(v_storage_pool_id UUID, v_connection CHARACTER VARYING) RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE storage_pool_id = v_storage_pool_id AND storage IN ( SELECT id FROM storage_server_connections WHERE connection = v_connection); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetFailingStorage_domains() RETURNS SETOF storage_domains STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_domains WHERE recoverable AND status = 4; --inactive END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetFailingVdss() RETURNS SETOF vds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds WHERE recoverable AND status = 10; --non operational END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetStoragePoolsByClusterService( v_supports_virt_service BOOLEAN, v_supports_gluster_service BOOLEAN) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT sp.* FROM storage_pool SP WHERE EXISTS (SELECT 1 FROM vds_groups vg WHERE ((v_supports_virt_service = TRUE AND vg.virt_service = TRUE) OR (v_supports_gluster_service = TRUE AND vg.gluster_service = TRUE)) AND vg.storage_pool_id = sp.id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetStorageServerConnectionsForDomain(v_storage_domain_id UUID) RETURNS SETOF storage_server_connections STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM storage_server_connections WHERE EXISTS ( SELECT 1 FROM storage_domain_static WHERE storage_domain_static.id = v_storage_domain_id AND storage_domain_static.storage_type in (1,4,6) -- file storage domains - nfs,posix,local AND storage_server_connections.id = storage_domain_static.storage UNION ALL SELECT 1 FROM storage_domain_static JOIN luns ON storage_domain_static.storage = luns.volume_group_id JOIN lun_storage_server_connection_map ON luns.lun_id = lun_storage_server_connection_map.lun_id AND storage_server_connections.id = lun_storage_server_connection_map.storage_server_connection WHERE storage_domain_static.id = v_storage_domain_id AND storage_domain_static.storage_type = 3 -- storage type = iscsi ); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetDcIdByExternalNetworkId(v_external_id text) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT storage_pool_id FROM network WHERE provider_network_external_id = v_external_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetStorageTypesInPoolByPoolId(v_storage_pool_id UUID) RETURNS SETOF INTEGER STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT storage_type FROM storage_domains WHERE storage_pool_id = v_storage_pool_id AND storage_domain_type IN (0,1); -- 0 = MASTER, 1 = DATA END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumberOfImagesInStorageDomain(v_storage_domain_id UUID) RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT COUNT(*) FROM image_storage_domain_map WHERE storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllDataCentersByMacPoolId(v_id UUID) RETURNS SETOF storage_pool STABLE AS $procedure$ BEGIN RETURN QUERY SELECT sp.* FROM storage_pool sp WHERE sp.mac_pool_id=v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS Getsystem_statistics_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE Getsystem_statistics_rs AS (val INTEGER); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION Getsystem_statistics(v_entity VARCHAR(10), v_status VARCHAR(20)) RETURNS Getsystem_statistics_rs STABLE AS $procedure$ DECLARE v_i Getsystem_statistics_rs; v_sql VARCHAR(4000); v_sys_entity VARCHAR(10); BEGIN v_sql := NULL; v_sys_entity := upper(v_entity); if v_sys_entity = 'VM' then v_sql := 'select count(vm_guid) from vm_dynamic'; elsif v_sys_entity = 'HOST' then v_sql := 'select count(vds_id) from vds_dynamic'; elsif v_sys_entity = 'USER' then v_sql := 'select count(user_id) from users'; elsif v_sys_entity = 'TSD' then v_sql := 'select count(id) from storage_domain_static'; elsif v_sys_entity = 'ASD' then v_sql := 'select count(storage_id) from storage_pool_iso_map'; else raise 'Unknown entity type "%"', v_entity; end if; if v_status != '' then if v_sys_entity != 'USER' and v_sys_entity != 'TSD' then v_sql := coalesce(v_sql, '') || ' where status in (' || coalesce(v_status, '') || ')'; end if; end if; EXECUTE v_sql INTO v_i; RETURN v_i; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Inserttags(v_description VARCHAR(4000) , v_tag_id UUID , v_tag_name VARCHAR(50), v_parent_id UUID, v_readonly BOOLEAN , v_type INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO tags(tag_id,description, tag_name,parent_id,readonly,type) VALUES(v_tag_id,v_description, v_tag_name,v_parent_id,v_readonly,v_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatetags(v_description VARCHAR(4000) , v_tag_id UUID, v_tag_name VARCHAR(50), v_parent_id UUID, v_readonly BOOLEAN , v_type INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE tags SET description = v_description,tag_name = v_tag_name,parent_id = v_parent_id, readonly = v_readonly,type = v_type,_update_date = LOCALTIMESTAMP WHERE tag_id = v_tag_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletetags(v_tag_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select tag_id INTO v_val FROM tags WHERE tag_id = v_tag_id FOR UPDATE; DELETE FROM tags_user_group_map WHERE tag_id = v_tag_id; DELETE FROM tags_user_map WHERE tag_id = v_tag_id; DELETE FROM tags_vm_map WHERE tag_id = v_tag_id; DELETE FROM tags_vds_map WHERE tag_id = v_tag_id; DELETE FROM tags_vm_pool_map WHERE tag_id = v_tag_id; DELETE FROM tags WHERE tag_id = v_tag_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromtags() RETURNS SETOF tags STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags.* FROM tags; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GettagsBytag_id(v_tag_id UUID) RETURNS SETOF tags STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags.* FROM tags WHERE tag_id = v_tag_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GettagsByparent_id(v_parent_id UUID) RETURNS SETOF tags STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags.* FROM tags WHERE parent_id = v_parent_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GettagsBytag_name(v_tag_name VARCHAR(50)) RETURNS SETOF tags STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags.* FROM tags WHERE tag_name = v_tag_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Inserttags_user_group_map(v_group_id UUID, v_tag_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO tags_user_group_map(group_id, tag_id) VALUES(v_group_id, v_tag_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletetags_user_group_map(v_group_id UUID, v_tag_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM tags_user_group_map WHERE group_id = v_group_id AND tag_id = v_tag_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromtags_user_group_map() RETURNS SETOF tags_user_group_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_user_group_map.* FROM tags_user_group_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagUserGroupByGroupIdAndByTagId(v_group_id UUID, v_tag_id UUID) RETURNS SETOF tags_user_group_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_user_group_map.* FROM tags_user_group_map WHERE group_id = v_group_id AND tag_id = v_tag_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagsByUserGroupId(v_group_ids VARCHAR(4000)) RETURNS SETOF tags_user_group_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_user_group_map_view.* FROM tags_user_group_map_view WHERE group_id in(select * from fnSplitterUuid(v_group_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserGroupTagsByTagIds(v_tag_ids VARCHAR(4000)) RETURNS SETOF tags_user_group_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_user_group_map_view.* FROM tags_user_group_map_view WHERE tag_id in(select * from fnSplitterUuid(v_tag_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Inserttags_user_map(v_tag_id UUID, v_user_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO tags_user_map(tag_id, user_id) VALUES(v_tag_id, v_user_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletetags_user_map(v_tag_id UUID, v_user_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM tags_user_map WHERE tag_id = v_tag_id AND user_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromtags_user_map() RETURNS SETOF tags_user_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_user_map.* FROM tags_user_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagUserByTagIdAndByuserId(v_tag_id UUID, v_user_id UUID) RETURNS SETOF tags_user_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_user_map.* FROM tags_user_map WHERE tag_id = v_tag_id AND user_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagsByUserId(v_user_ids VARCHAR(4000)) RETURNS SETOF tags_user_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_user_map_view.* FROM tags_user_map_view WHERE user_id in(select * from fnSplitterUuid(v_user_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserTagsByTagIds(v_tag_ids VARCHAR(4000)) RETURNS SETOF tags_user_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_user_map_view.* FROM tags_user_map_view WHERE tag_id in(select * from fnSplitterUuid(v_tag_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Inserttags_vds_map(v_tag_id UUID, v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO tags_vds_map(tag_id, vds_id) VALUES(v_tag_id, v_vds_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletetags_vds_map(v_tag_id UUID, v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM tags_vds_map WHERE tag_id = v_tag_id AND vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromtags_vds_map() RETURNS SETOF tags_vds_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_vds_map.* FROM tags_vds_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagVdsBytagIdAndByVdsId(v_tag_id UUID, v_vds_id UUID) RETURNS SETOF tags_vds_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_vds_map.* FROM tags_vds_map WHERE tag_id = v_tag_id AND vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagsByVdsId(v_vds_ids VARCHAR(4000)) RETURNS SETOF tags_vds_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_vds_map_view.* FROM tags_vds_map_view WHERE vds_id in(select * from fnSplitterUuid(v_vds_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsTagsByTagIds(v_tag_ids VARCHAR(4000)) RETURNS SETOF tags_vds_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_vds_map_view.* FROM tags_vds_map_view WHERE tag_id in(select * from fnSplitterUuid(v_tag_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Inserttags_vm_map(v_tag_id UUID, v_vm_id UUID, v_DefaultDisplayType INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO tags_vm_map(tag_id, vm_id, DefaultDisplayType) VALUES(v_tag_id, v_vm_id, v_DefaultDisplayType); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletetags_vm_map(v_tag_id UUID, v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM tags_vm_map WHERE tag_id = v_tag_id AND vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromtags_vm_map() RETURNS SETOF tags_vm_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_vm_map.* FROM tags_vm_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagVmByTagIdAndByvmId(v_tag_id UUID, v_vm_id UUID) RETURNS SETOF tags_vm_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_vm_map.* FROM tags_vm_map WHERE tag_id = v_tag_id AND vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagsByVmId(v_vm_ids VARCHAR(4000)) RETURNS SETOF tags_vm_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_vm_map_view.* FROM tags_vm_map_view WHERE vm_id in(select * from fnSplitterUuid(v_vm_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTagsByTagId(v_tag_ids VARCHAR(4000)) RETURNS SETOF tags_vm_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_vm_map_view.* FROM tags_vm_map_view WHERE tag_id in(select * from fnSplitterUuid(v_tag_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmTagsDefaultDisplayType(v_tag_id UUID, v_vm_id UUID, v_DefaultDisplayType INTEGER) RETURNS VOID AS $procedure$ BEGIN update tags_vm_map set DefaultDisplayType = v_DefaultDisplayType where tags_vm_map.tag_id = v_tag_id and tags_vm_map.vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetnVmTagsByVmId(v_vm_id UUID) RETURNS SETOF tags_vm_map STABLE AS $procedure$ BEGIN RETURN QUERY select * from tags_vm_map where tags_vm_map.vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetnVmTagsByVmIdAndDefaultTag(v_vm_id UUID) RETURNS SETOF tags_vm_map STABLE AS $procedure$ BEGIN RETURN QUERY select tags_vm_map.* from tags_vm_map inner join tags on tags.tag_id = tags_vm_map.tag_id where tags_vm_map.vm_id = v_vm_id and tags.type = 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveAllVmTagsByVmId(v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN delete FROM tags_vm_map where vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Inserttags_vm_pool_map(v_tag_id UUID, v_vm_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO tags_vm_pool_map(tag_id, vm_pool_id) VALUES(v_tag_id, v_vm_pool_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Updatetags_vm_pool_map(v_tag_id INTEGER, v_vm_pool_id INTEGER) RETURNS VOID AS $procedure$ BEGIN END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletetags_vm_pool_map(v_tag_id UUID, v_vm_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM tags_vm_pool_map WHERE tag_id = v_tag_id AND vm_pool_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromtags_vm_pool_map() RETURNS SETOF tags_vm_pool_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_vm_pool_map.* FROM tags_vm_pool_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Gettags_vm_pool_mapBytag_idAndByvm_pool_id(v_tag_id UUID, v_vm_pool_id UUID) RETURNS SETOF tags_vm_pool_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT tags_vm_pool_map.* FROM tags_vm_pool_map WHERE tag_id = v_tag_id AND vm_pool_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTagsByVmpoolId(v_vm_pool_ids VARCHAR(4000)) RETURNS SETOF tags_vm_pool_map_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT tags_vm_pool_map_view.* FROM tags_vm_pool_map_view WHERE vm_pool_id in(select * from fnSplitterUuid(v_vm_pool_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertOVFDataForEntities(v_entity_guid UUID, v_entity_name VARCHAR(255), v_entity_type VARCHAR(32), v_architecture INTEGER, v_lowest_comp_version VARCHAR(40), v_storage_domain_id UUID, v_ovf_data TEXT, v_ovf_extra_data TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO unregistered_ovf_of_entities(entity_guid, entity_name, entity_type, architecture, lowest_comp_version, storage_domain_id, ovf_extra_data, ovf_data) VALUES (v_entity_guid, v_entity_name, v_entity_type, v_architecture, v_lowest_comp_version, v_storage_domain_id, v_ovf_extra_data, v_ovf_data); UPDATE unregistered_ovf_of_entities u SET ovf_data = vog.ovf_data FROM vm_ovf_generations vog WHERE vog.vm_guid = u.entity_guid AND u.entity_guid = v_entity_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION RemoveEntityFromUnregistered(v_entity_guid UUID, v_storage_domain_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM unregistered_ovf_of_entities WHERE entity_guid = v_entity_guid AND (storage_domain_id = v_storage_domain_id OR v_storage_domain_id IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllOVFEntitiesForStorageDomainByEntityType(v_storage_domain_id UUID, v_entity_type VARCHAR(20)) RETURNS SETOF unregistered_ovf_of_entities STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM unregistered_ovf_of_entities WHERE storage_domain_id = v_storage_domain_id AND (entity_type = v_entity_type OR v_entity_type IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetOVFDataByEntityIdAndStorageDomain(v_entity_guid UUID, v_storage_domain_id UUID) RETURNS SETOF unregistered_ovf_of_entities STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM unregistered_ovf_of_entities WHERE entity_guid = v_entity_guid AND (storage_domain_id = v_storage_domain_id OR v_storage_domain_id IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertUserProfile( v_profile_id UUID, v_user_id UUID, v_ssh_public_key_id UUID, v_ssh_public_key TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO user_profiles ( profile_id, user_id, ssh_public_key_id, ssh_public_key) VALUES( v_profile_id, v_user_id, v_ssh_public_key_id, v_ssh_public_key); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateUserProfile( v_profile_id UUID, v_user_id UUID, v_ssh_public_key_id UUID, v_ssh_public_key TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE user_profiles SET profile_id = v_profile_id, user_id = v_user_id, ssh_public_key_id = v_ssh_public_key_id, ssh_public_key = v_ssh_public_key WHERE profile_id = v_profile_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteUserProfile(v_profile_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM user_profiles WHERE profile_id = v_profile_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromUserProfiles() RETURNS SETOF user_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT user_profiles_view.* FROM user_profiles_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserProfileByUserId(v_user_id UUID) RETURNS SETOF user_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM user_profiles_view WHERE user_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserProfileByProfileId(v_profile_id UUID) RETURNS SETOF user_profiles_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM user_profiles_view WHERE profile_id = v_profile_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertUser(v_department VARCHAR(255) , v_domain VARCHAR(255), v_email VARCHAR(255) , v_name VARCHAR(255) , v_note VARCHAR(255) , v_surname VARCHAR(255) , v_user_id UUID, v_username VARCHAR(255), v_external_id TEXT, v_namespace VARCHAR(2048)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO users(department, domain, email, name, note, surname, user_id, username, external_id,namespace) VALUES(v_department, v_domain, v_email, v_name, v_note, v_surname, v_user_id, v_username, v_external_id, v_namespace); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateUserImpl( v_department VARCHAR(255) , v_domain VARCHAR(255), v_email VARCHAR(255) , v_name VARCHAR(255) , v_note VARCHAR(255) , v_surname VARCHAR(255) , v_user_id UUID, v_username VARCHAR(255), v_external_id TEXT, v_namespace VARCHAR(2048)) RETURNS INTEGER AS $procedure$ DECLARE updated_rows INT; BEGIN UPDATE users SET department = v_department,domain = v_domain, email = v_email,name = v_name,note = v_note, surname = v_surname, username = v_username, external_id = v_external_id, namespace = v_namespace, _update_date = CURRENT_TIMESTAMP WHERE external_id = v_external_id AND domain = v_domain; GET DIAGNOSTICS updated_rows = ROW_COUNT; RETURN updated_rows; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateUser( v_department VARCHAR(255) , v_domain VARCHAR(255), v_email VARCHAR(255) , v_name VARCHAR(255) , v_note VARCHAR(255) , v_surname VARCHAR(255) , v_user_id UUID, v_username VARCHAR(255), v_last_admin_check_status BOOLEAN, v_external_id TEXT, v_namespace VARCHAR(2048)) RETURNS VOID AS $procedure$ BEGIN PERFORM UpdateUserImpl(v_department, v_domain, v_email, v_name, v_note, v_surname, v_user_id, v_username, v_external_id, v_namespace); UPDATE users SET last_admin_check_status = v_last_admin_check_status WHERE domain = v_domain AND external_id = v_external_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertOrUpdateUser( v_department VARCHAR(255) , v_domain VARCHAR(255), v_email VARCHAR(255) , v_name VARCHAR(255) , v_note VARCHAR(255) , v_surname VARCHAR(255) , v_user_id UUID, v_username VARCHAR(255), v_external_id TEXT, v_namespace VARCHAR(2048)) RETURNS VOID AS $procedure$ DECLARE updated_rows INT; BEGIN SELECT UpdateUserImpl(v_department, v_domain, v_email, v_name, v_note, v_surname, v_user_id, v_username, v_external_id, v_namespace) into updated_rows; if (updated_rows = 0) THEN PERFORM InsertUser(v_department, v_domain, v_email, v_name, v_note, v_surname, v_user_id, v_username, v_external_id, v_namespace); End If; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteUser(v_user_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select user_id INTO v_val FROM users WHERE user_id = v_user_id FOR UPDATE; DELETE FROM tags_user_map WHERE user_id = v_user_id; DELETE FROM users WHERE user_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromUsers(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF users STABLE AS $procedure$ BEGIN RETURN QUERY SELECT users.* FROM users WHERE (NOT v_is_filtered OR EXISTS (SELECT 1 FROM users u, user_db_users_permissions_view p WHERE u.user_id = v_user_id AND u.user_id = p.ad_element_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserByUserId(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF users STABLE AS $procedure$ BEGIN RETURN QUERY SELECT users.* FROM users WHERE user_id = v_user_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM users u, user_db_users_permissions_view p WHERE u.user_id = v_user_id AND u.user_id = p.ad_element_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserByExternalId(v_domain VARCHAR(255), v_external_id TEXT) RETURNS SETOF users STABLE AS $procedure$ BEGIN RETURN QUERY SELECT users.* FROM users WHERE domain = v_domain AND external_id = v_external_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUserByUserNameAndDomain(v_username VARCHAR(255), v_domain VARCHAR(255)) RETURNS SETOF users STABLE AS $procedure$ BEGIN RETURN QUERY SELECT users.* FROM users WHERE username = v_username AND domain = v_domain; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetUsersByVmGuid(v_vm_guid UUID) RETURNS SETOF users STABLE AS $procedure$ BEGIN RETURN QUERY SELECT users.* FROM users inner join permissions on users.user_id = permissions.ad_element_id WHERE permissions.object_type_id = 2 and permissions.object_id = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateLastAdminCheckStatus(v_userIds VARCHAR(4000)) RETURNS VOID AS $procedure$ DECLARE v_id UUID; v_tempId VARCHAR(4000); myCursor cursor for select id from fnSplitter(v_userIds); v_result INTEGER; BEGIN -- get users and its groups -- get their permission based on ad_element_id. -- if one permissions role's type is ADMIN(1) then set the user last_admin_check_status to 1 OPEN myCursor; FETCH myCursor into v_tempId; WHILE FOUND LOOP v_id := CAST(v_tempId AS UUID); select count(*) INTO v_result from users where user_id in(select ad_element_id as user_id from permissions,roles where permissions.role_id = roles.id and ad_element_id in((select ad_groups.id from ad_groups,engine_sessions where engine_sessions.user_id = v_id and ad_groups.id in(select * from fnsplitteruuid(engine_sessions.group_ids)) union select v_id)) and (roles.role_type = 1 or permissions.role_id = '00000000-0000-0000-0000-000000000001')); update users set last_admin_check_status = case when v_result = 0 then FALSE else TRUE end where user_id = v_id; FETCH myCursor into v_tempId; END LOOP; CLOSE myCursor; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetSessionUserAndGroupsById(v_id UUID, v_engine_session_seq_id INTEGER) RETURNS SETOF idUuidType STABLE AS $procedure$ BEGIN RETURN QUERY select ad_groups.ID from ad_groups,engine_sessions where engine_sessions.id = v_engine_session_seq_id and ad_groups.id in(select * from fnsplitteruuid(engine_sessions.group_ids)) UNION select v_id UNION -- user is also member of 'Everyone' select 'EEE00000-0000-0000-0000-123456789EEE'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVdcOption(v_option_name VARCHAR(50), v_option_value VARCHAR(50), v_version VARCHAR(40), INOUT v_option_id INTEGER) AS $procedure$ BEGIN INSERT INTO vdc_options(OPTION_NAME, option_value, version) VALUES(v_option_name, v_option_value, v_version); v_option_id := CURRVAL('vdc_options_seq'); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdcOption(v_option_name VARCHAR(50), v_option_value VARCHAR(50), v_option_id INTEGER, v_version VARCHAR(40)) RETURNS VOID AS $procedure$ BEGIN UPDATE vdc_options SET OPTION_NAME = v_option_name,option_value = v_option_value,version = v_version WHERE option_id = v_option_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVdcOption(v_option_id INTEGER) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vdc_options WHERE option_id = v_option_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVdcOption() RETURNS SETOF vdc_options STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vdc_options.* FROM vdc_options; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdcOptionById(v_option_id INTEGER) RETURNS SETOF vdc_options STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vdc_options.* FROM vdc_options WHERE option_id = v_option_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdcOptionByName(v_option_name VARCHAR(50), v_version VARCHAR(40)) RETURNS SETOF vdc_options STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vdc_options.* FROM vdc_options WHERE OPTION_NAME = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVdsGroups( v_vds_group_id UUID, v_description VARCHAR(4000), v_free_text_comment text, v_name VARCHAR(40), v_cpu_name VARCHAR(255), v_storage_pool_id UUID , v_max_vds_memory_over_commit INTEGER, v_count_threads_as_cores BOOLEAN, v_compatibility_version VARCHAR(40), v_transparent_hugepages BOOLEAN, v_migrate_on_error INTEGER, v_virt_service BOOLEAN, v_gluster_service BOOLEAN, v_tunnel_migration BOOLEAN, v_emulated_machine VARCHAR(40), v_detect_emulated_machine BOOLEAN, v_trusted_service BOOLEAN, v_ha_reservation BOOLEAN, v_optional_reason BOOLEAN, v_maintenance_reason_required BOOLEAN, v_cluster_policy_id UUID, v_cluster_policy_custom_properties text, v_enable_balloon BOOLEAN, v_architecture INTEGER, v_optimization_type SMALLINT, v_spice_proxy VARCHAR(255), v_enable_ksm BOOLEAN, v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_required_rng_sources varchar(255), v_skip_fencing_if_sd_active BOOLEAN, v_skip_fencing_if_connectivity_broken BOOLEAN, v_hosts_with_broken_connectivity_threshold SMALLINT, v_fencing_enabled BOOLEAN, v_is_auto_converge BOOLEAN, v_is_migrate_compressed BOOLEAN, v_gluster_tuned_profile VARCHAR(50), v_ksm_merge_across_nodes BOOLEAN ) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vds_groups(vds_group_id,description, name, free_text_comment, cpu_name, storage_pool_id, max_vds_memory_over_commit, count_threads_as_cores, compatibility_version, transparent_hugepages, migrate_on_error, virt_service, gluster_service, tunnel_migration, emulated_machine, detect_emulated_machine, trusted_service, ha_reservation, optional_reason, maintenance_reason_required, cluster_policy_id, cluster_policy_custom_properties, enable_balloon, architecture, optimization_type, spice_proxy, enable_ksm, serial_number_policy, custom_serial_number, required_rng_sources, skip_fencing_if_sd_active, skip_fencing_if_connectivity_broken, hosts_with_broken_connectivity_threshold, fencing_enabled, is_auto_converge, is_migrate_compressed, gluster_tuned_profile, ksm_merge_across_nodes) VALUES(v_vds_group_id,v_description, v_name, v_free_text_comment, v_cpu_name, v_storage_pool_id, v_max_vds_memory_over_commit, v_count_threads_as_cores, v_compatibility_version, v_transparent_hugepages, v_migrate_on_error, v_virt_service, v_gluster_service, v_tunnel_migration, v_emulated_machine, v_detect_emulated_machine, v_trusted_service, v_ha_reservation, v_optional_reason, v_maintenance_reason_required, v_cluster_policy_id, v_cluster_policy_custom_properties, v_enable_balloon, v_architecture, v_optimization_type, v_spice_proxy, v_enable_ksm, v_serial_number_policy, v_custom_serial_number, v_required_rng_sources, v_skip_fencing_if_sd_active, v_skip_fencing_if_connectivity_broken, v_hosts_with_broken_connectivity_threshold, v_fencing_enabled, v_is_auto_converge, v_is_migrate_compressed, v_gluster_tuned_profile, v_ksm_merge_across_nodes); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsGroup(v_description VARCHAR(4000) , v_free_text_comment text, v_name VARCHAR(40), v_vds_group_id UUID, v_cpu_name VARCHAR(255) , v_storage_pool_id UUID , v_max_vds_memory_over_commit INTEGER, v_count_threads_as_cores BOOLEAN, v_compatibility_version VARCHAR(40), v_transparent_hugepages BOOLEAN , v_migrate_on_error INTEGER, v_virt_service BOOLEAN, v_gluster_service BOOLEAN, v_gluster_cli_based_snapshot_scheduled BOOLEAN, v_tunnel_migration BOOLEAN, v_emulated_machine VARCHAR(40), v_detect_emulated_machine BOOLEAN, v_trusted_service BOOLEAN, v_ha_reservation BOOLEAN, v_optional_reason BOOLEAN, v_maintenance_reason_required BOOLEAN, v_cluster_policy_id UUID, v_cluster_policy_custom_properties text, v_enable_balloon BOOLEAN, v_architecture INTEGER, v_optimization_type SMALLINT, v_spice_proxy VARCHAR(255), v_enable_ksm BOOLEAN, v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_required_rng_sources varchar(255), v_skip_fencing_if_sd_active BOOLEAN, v_skip_fencing_if_connectivity_broken BOOLEAN, v_hosts_with_broken_connectivity_threshold SMALLINT, v_fencing_enabled BOOLEAN, v_is_auto_converge BOOLEAN, v_is_migrate_compressed BOOLEAN, v_gluster_tuned_profile VARCHAR(50), v_ksm_merge_across_nodes BOOLEAN ) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_groups SET description = v_description, free_text_comment = v_free_text_comment, name = v_name,cpu_name = v_cpu_name, storage_pool_id = v_storage_pool_id,_update_date = LOCALTIMESTAMP, max_vds_memory_over_commit = v_max_vds_memory_over_commit, count_threads_as_cores = v_count_threads_as_cores, compatibility_version = v_compatibility_version,transparent_hugepages = v_transparent_hugepages, migrate_on_error = v_migrate_on_error, virt_service = v_virt_service, gluster_service = v_gluster_service, tunnel_migration = v_tunnel_migration, gluster_cli_based_snapshot_scheduled = v_gluster_cli_based_snapshot_scheduled, emulated_machine = v_emulated_machine, detect_emulated_machine = v_detect_emulated_machine, trusted_service = v_trusted_service, ha_reservation = v_ha_reservation , optional_reason = v_optional_reason, maintenance_reason_required = v_maintenance_reason_required, cluster_policy_id = v_cluster_policy_id, cluster_policy_custom_properties = v_cluster_policy_custom_properties, enable_balloon = v_enable_balloon, architecture = v_architecture, optimization_type = v_optimization_type, spice_proxy = v_spice_proxy, enable_ksm = v_enable_ksm, serial_number_policy = v_serial_number_policy, custom_serial_number = v_custom_serial_number, required_rng_sources = v_required_rng_sources, skip_fencing_if_sd_active = v_skip_fencing_if_sd_active, skip_fencing_if_connectivity_broken = v_skip_fencing_if_connectivity_broken, hosts_with_broken_connectivity_threshold = v_hosts_with_broken_connectivity_threshold, fencing_enabled = v_fencing_enabled, is_auto_converge = v_is_auto_converge, is_migrate_compressed = v_is_migrate_compressed, gluster_tuned_profile = v_gluster_tuned_profile, ksm_merge_across_nodes = v_ksm_merge_across_nodes WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVdsGroup(v_vds_group_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select vds_group_id INTO v_val FROM vds_groups WHERE vds_group_id = v_vds_group_id FOR UPDATE; DELETE FROM vds_groups WHERE vds_group_id = v_vds_group_id; -- delete VDS group permissions -- DELETE FROM permissions where object_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVdsGroups(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_groups_permissions_view WHERE user_id = v_user_id and entity_id = vds_group_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupByVdsGroupId(v_vds_group_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE vds_group_id = v_vds_group_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_groups_permissions_view WHERE user_id = v_user_id AND entity_id = v_vds_group_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupByVdsGroupName(v_vds_group_name VARCHAR(40), v_is_case_sensitive BOOLEAN) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE name = v_vds_group_name OR (NOT v_is_case_sensitive AND name ilike v_vds_group_name); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupForUserByVdsGroupName(v_vds_group_name VARCHAR(40), v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE name = v_vds_group_name AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_groups_permissions_view WHERE user_id = v_user_id AND entity_id = vds_group_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupsByStoragePoolId(v_storage_pool_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE storage_pool_id = v_storage_pool_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_groups_permissions_view WHERE user_id = v_user_id AND entity_id = vds_group_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupWithRunningVms(v_vds_group_id UUID) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE vds_group_id = v_vds_group_id and vds_group_id in(select vds_group_id from vms where vms.status NOT IN(0,13,14)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupsWithoutMigratingVms() RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE vds_group_id not in ( SELECT s.vds_group_id FROM vm_static s JOIN vm_dynamic d ON s.vm_guid = d.vm_guid WHERE d.status IN(5,6)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIsVdsGroupEmpty(v_vds_group_id UUID) RETURNS BOOLEAN AS $procedure$ BEGIN RETURN NOT EXISTS(SELECT 1 FROM vm_static WHERE vds_group_id = v_vds_group_id AND vm_guid != '00000000-0000-0000-0000-000000000000') AND NOT EXISTS(SELECT 1 FROM vds_static WHERE vds_group_id = v_vds_group_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_perms_get_vds_groups_with_permitted_action(v_user_id UUID, v_action_group_id integer) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE (SELECT 1 from get_entity_permissions(v_user_id, v_action_group_id, vds_groups_view.vds_group_id, 9)) IS NOT NULL; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetClustersHavingHosts() RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE EXISTS (SELECT 1 from vds_static WHERE vds_group_id = vds_groups_view.vds_group_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsGroupEmulatedMachine(v_vds_group_id UUID, v_emulated_machine varchar(40), v_detect_emulated_machine BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_groups SET emulated_machine = v_emulated_machine, detect_emulated_machine = v_detect_emulated_machine WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTrustedVdsGroups() RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE trusted_service; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupsByClusterPolicyId(v_cluster_policy_id UUID) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE cluster_policy_id = v_cluster_policy_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNumberOfVmsInCluster(v_vds_group_id UUID) RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT COUNT (vms.*) FROM vm_static vms WHERE vms.vds_group_id = v_vds_group_id AND vms.entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS host_vm_cluster_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE host_vm_cluster_rs AS (vds_group_id UUID,hosts bigint,vms bigint); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetHostsAndVmsForClusters(v_vds_group_ids UUID[]) RETURNS SETOF host_vm_cluster_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT groups.vds_group_id,(select COUNT(DISTINCT vds.vds_id) from vds_static vds where vds.vds_group_id = groups.vds_group_id) as host_count,(select COUNT(DISTINCT vms.vm_guid) from vm_static vms where vms.vds_group_id = groups.vds_group_id and vms.entity_type::text = 'VM'::text) as vm_count FROM vds_groups groups WHERE groups.vds_group_id = any(v_vds_group_ids) GROUP BY groups.vds_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsGroupsByServiceAndCompatibilityVersion(v_gluster_service BOOLEAN, v_virt_service BOOLEAN, v_compatibility_version VARCHAR(40)) RETURNS SETOF vds_groups_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_groups_view.* FROM vds_groups_view WHERE virt_service = v_virt_service AND gluster_service = v_gluster_service AND compatibility_version = v_compatibility_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpsertKdumpStatus( v_vds_id UUID, v_status VARCHAR(20), v_address VARCHAR(255)) RETURNS INT AS $procedure$ BEGIN UPDATE vds_kdump_status SET status = v_status, address = v_address WHERE vds_id = v_vds_id; IF NOT found THEN INSERT INTO vds_kdump_status( vds_id, status, address ) VALUES ( v_vds_id, v_status, v_address ); END IF; RETURN 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpsertKdumpStatusForIp( v_ip VARCHAR(20), v_status VARCHAR(20), v_address VARCHAR(255)) RETURNS INT AS $procedure$ DECLARE v_vds_id UUID; updated_rows INT; BEGIN updated_rows := 0; SELECT vds_id INTO v_vds_id FROM vds_interface WHERE addr = v_ip; IF v_vds_id IS NOT NULL THEN SELECT UpsertKdumpStatus( v_vds_id, v_status, v_address) INTO updated_rows; END IF; RETURN updated_rows; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION RemoveFinishedKdumpStatusForVds( v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vds_kdump_status WHERE vds_id = v_vds_id AND status = 'finished'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetKdumpStatusForVds( v_vds_id UUID) RETURNS SETOF vds_kdump_status STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds_kdump_status WHERE vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllUnfinishedVdsKdumpStatus() RETURNS SETOF vds_kdump_status STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds_kdump_status WHERE status <> 'finished'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Insertvds_spm_id_map(v_storage_pool_id UUID, v_vds_id UUID, v_vds_spm_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vds_spm_id_map(storage_pool_id, vds_id, vds_spm_id) VALUES(v_storage_pool_id, v_vds_id, v_vds_spm_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Deletevds_spm_id_map(v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vds_spm_id_map WHERE vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteByPoolvds_spm_id_map(v_vds_id UUID, v_storage_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vds_spm_id_map WHERE vds_id = v_vds_id AND storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromvds_spm_id_map() RETURNS SETOF vds_spm_id_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_spm_id_map.* FROM vds_spm_id_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getvds_spm_id_mapBystorage_pool_idAndByvds_spm_id(v_storage_pool_id UUID, v_vds_spm_id INTEGER) RETURNS SETOF vds_spm_id_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_spm_id_map.* FROM vds_spm_id_map WHERE storage_pool_id = v_storage_pool_id AND vds_spm_id = v_vds_spm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getvds_spm_id_mapBystorage_pool_id(v_storage_pool_id UUID) RETURNS SETOF vds_spm_id_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_spm_id_map.* FROM vds_spm_id_map WHERE storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION Getvds_spm_id_mapByvds_id(v_vds_id UUID) RETURNS SETOF vds_spm_id_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_spm_id_map.* FROM vds_spm_id_map WHERE vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVdsStatistics(v_cpu_idle DECIMAL(18,0) , v_cpu_load DECIMAL(18,0) , v_cpu_sys DECIMAL(18,0) , v_cpu_user DECIMAL(18,0) , v_usage_cpu_percent INTEGER , v_usage_mem_percent INTEGER , v_usage_network_percent INTEGER , v_vds_id UUID, v_mem_available BIGINT , v_mem_free BIGINT, v_mem_shared BIGINT , v_swap_free BIGINT , v_swap_total BIGINT , v_ksm_cpu_percent INTEGER , v_ksm_pages BIGINT , v_ksm_state BOOLEAN, v_anonymous_hugepages INTEGER, v_boot_time BIGINT, v_ha_score INTEGER, v_ha_configured BOOLEAN, v_ha_active BOOLEAN, v_ha_global_maintenance BOOLEAN, v_ha_local_maintenance BOOLEAN, v_cpu_over_commit_time_stamp TIMESTAMP WITH TIME ZONE ) RETURNS VOID AS $procedure$ BEGIN BEGIN INSERT INTO vds_statistics(cpu_idle, cpu_load, cpu_sys, cpu_user, usage_cpu_percent, usage_mem_percent, usage_network_percent, vds_id, mem_available, mem_free, mem_shared,swap_free,swap_total,ksm_cpu_percent,ksm_pages,ksm_state, anonymous_hugepages, boot_time, ha_score, ha_configured, ha_active, ha_global_maintenance, ha_local_maintenance,cpu_over_commit_time_stamp) VALUES(v_cpu_idle, v_cpu_load, v_cpu_sys, v_cpu_user, v_usage_cpu_percent, v_usage_mem_percent, v_usage_network_percent, v_vds_id, v_mem_available, v_mem_free, v_mem_shared,v_swap_free,v_swap_total,v_ksm_cpu_percent,v_ksm_pages,v_ksm_state, v_anonymous_hugepages, v_boot_time, v_ha_score, v_ha_configured, v_ha_active, v_ha_global_maintenance, v_ha_local_maintenance,v_cpu_over_commit_time_stamp); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsStatistics(v_cpu_idle DECIMAL(18,0) , v_cpu_load DECIMAL(18,0) , v_cpu_sys DECIMAL(18,0) , v_cpu_user DECIMAL(18,0) , v_usage_cpu_percent INTEGER , v_usage_mem_percent INTEGER , v_usage_network_percent INTEGER , v_vds_id UUID, v_mem_available BIGINT , v_mem_free BIGINT, v_mem_shared BIGINT , v_swap_free BIGINT , v_swap_total BIGINT , v_ksm_cpu_percent INTEGER , v_ksm_pages BIGINT , v_ksm_state BOOLEAN, v_anonymous_hugepages INTEGER, v_boot_time BIGINT, v_ha_score INTEGER, v_ha_configured BOOLEAN, v_ha_active BOOLEAN, v_ha_global_maintenance BOOLEAN, v_ha_local_maintenance BOOLEAN, v_cpu_over_commit_time_stamp TIMESTAMP WITH TIME ZONE) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE vds_statistics SET cpu_idle = v_cpu_idle,cpu_load = v_cpu_load,cpu_sys = v_cpu_sys, cpu_user = v_cpu_user,usage_cpu_percent = v_usage_cpu_percent,usage_mem_percent = v_usage_mem_percent, usage_network_percent = v_usage_network_percent, mem_available = v_mem_available, mem_free = v_mem_free, mem_shared = v_mem_shared, swap_free = v_swap_free,swap_total = v_swap_total,ksm_cpu_percent = v_ksm_cpu_percent, ksm_pages = v_ksm_pages,ksm_state = v_ksm_state, anonymous_hugepages = v_anonymous_hugepages, boot_time = v_boot_time, ha_score = v_ha_score, ha_configured = v_ha_configured, ha_active = v_ha_active, ha_global_maintenance = v_ha_global_maintenance, ha_local_maintenance = v_ha_local_maintenance, _update_date = LOCALTIMESTAMP, cpu_over_commit_time_stamp = v_cpu_over_commit_time_stamp WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVdsStatistics(v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM vds_statistics WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVdsStatistics() RETURNS SETOF vds_statistics STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_statistics.* FROM vds_statistics; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsStatisticsByVdsId(v_vds_id UUID) RETURNS SETOF vds_statistics STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_statistics.* FROM vds_statistics WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVdsDynamic(v_cpu_cores INTEGER , v_cpu_threads INTEGER , v_cpu_model VARCHAR(255) , v_cpu_speed_mh DECIMAL(18,0) , v_if_total_speed VARCHAR(40) , v_kvm_enabled BOOLEAN , v_mem_commited INTEGER , v_physical_mem_mb INTEGER , v_status INTEGER, v_vds_id UUID, v_vm_active INTEGER , v_vm_count INTEGER , v_vms_cores_count INTEGER , v_vm_migrating INTEGER , v_incoming_migrations INTEGER , v_outgoing_migrations INTEGER , v_reserved_mem INTEGER , v_guest_overhead INTEGER , v_rpm_version VARCHAR(255), v_software_version VARCHAR(40) , v_version_name VARCHAR(40) , v_build_name VARCHAR(40) , v_previous_status INTEGER , v_cpu_flags VARCHAR(4000) , v_pending_vcpus_count INTEGER , v_pending_vmem_size INTEGER , v_cpu_sockets INTEGER , v_net_config_dirty BOOLEAN , v_supported_cluster_levels VARCHAR(40) , v_supported_engines VARCHAR(40) , v_host_os VARCHAR(4000) , v_kvm_version VARCHAR(4000) , v_libvirt_version VARCHAR(4000) , v_spice_version VARCHAR(4000) , v_gluster_version VARCHAR(4000) , v_librbd1_version VARCHAR(4000) , v_glusterfs_cli_version VARCHAR(4000) , v_kernel_version VARCHAR(4000) , v_iscsi_initiator_name VARCHAR(4000) , v_transparent_hugepages_state INTEGER , v_hooks TEXT, v_hw_manufacturer VARCHAR(255), v_hw_product_name VARCHAR(255), v_hw_version VARCHAR(255), v_hw_serial_number VARCHAR(255), v_hw_uuid VARCHAR(255), v_hw_family VARCHAR(255), v_hbas TEXT, v_supported_emulated_machines TEXT, v_controlled_by_pm_policy BOOLEAN, v_kdump_status SMALLINT, v_selinux_enforce_mode INTEGER, v_auto_numa_balancing SMALLINT, v_is_numa_supported BOOLEAN, v_supported_rng_sources VARCHAR(255), v_is_live_snapshot_supported BOOLEAN, v_is_live_merge_supported BOOLEAN, v_online_cpus TEXT, v_is_update_available BOOLEAN, v_is_hostdev_enabled BOOLEAN) RETURNS VOID AS $procedure$ BEGIN BEGIN INSERT INTO vds_dynamic(cpu_cores, cpu_threads, cpu_model, cpu_speed_mh, if_total_speed, kvm_enabled, mem_commited, physical_mem_mb, status, vds_id, vm_active, vm_count, vm_migrating, incoming_migrations, outgoing_migrations, reserved_mem, guest_overhead, rpm_version, software_version, version_name, build_name, previous_status, cpu_flags, vms_cores_count, pending_vcpus_count, pending_vmem_size, cpu_sockets,net_config_dirty, supported_cluster_levels, supported_engines, host_os, kvm_version, libvirt_version, spice_version, gluster_version, librbd1_version, glusterfs_cli_version, kernel_version, iscsi_initiator_name, transparent_hugepages_state, hooks, hw_manufacturer, hw_product_name, hw_version, hw_serial_number, hw_uuid, hw_family, hbas, supported_emulated_machines, controlled_by_pm_policy, kdump_status, selinux_enforce_mode, auto_numa_balancing, is_numa_supported, supported_rng_sources, is_live_snapshot_supported, is_live_merge_supported, online_cpus, is_update_available, is_hostdev_enabled) VALUES(v_cpu_cores, v_cpu_threads, v_cpu_model, v_cpu_speed_mh, v_if_total_speed, v_kvm_enabled, v_mem_commited, v_physical_mem_mb, v_status, v_vds_id, v_vm_active, v_vm_count, v_vm_migrating, v_incoming_migrations, v_outgoing_migrations, v_reserved_mem, v_guest_overhead, v_rpm_version, v_software_version, v_version_name, v_build_name, v_previous_status, v_cpu_flags, v_vms_cores_count,v_pending_vcpus_count, v_pending_vmem_size, v_cpu_sockets, v_net_config_dirty, v_supported_cluster_levels, v_supported_engines, v_host_os, v_kvm_version, v_libvirt_version, v_spice_version, v_gluster_version, v_librbd1_version, v_glusterfs_cli_version, v_kernel_version, v_iscsi_initiator_name, v_transparent_hugepages_state, v_hooks, v_hw_manufacturer, v_hw_product_name, v_hw_version, v_hw_serial_number, v_hw_uuid, v_hw_family, v_hbas, v_supported_emulated_machines, v_controlled_by_pm_policy, v_kdump_status, v_selinux_enforce_mode, v_auto_numa_balancing, v_is_numa_supported, v_supported_rng_sources, v_is_live_snapshot_supported, v_is_live_merge_supported, v_online_cpus, v_is_update_available, v_is_hostdev_enabled); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION UpdateVdsDynamicPowerManagementPolicyFlag( v_vds_id UUID, v_controlled_by_pm_policy BOOLEAN ) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE vds_dynamic SET controlled_by_pm_policy = v_controlled_by_pm_policy WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsDynamic(v_cpu_cores INTEGER , v_cpu_threads INTEGER , v_cpu_model VARCHAR(255) , v_cpu_speed_mh DECIMAL(18,0) , v_if_total_speed VARCHAR(40) , v_kvm_enabled BOOLEAN , v_mem_commited INTEGER , v_physical_mem_mb INTEGER , v_status INTEGER, v_vds_id UUID, v_vm_active INTEGER , v_vm_count INTEGER , v_vms_cores_count INTEGER , v_vm_migrating INTEGER , v_incoming_migrations INTEGER , v_outgoing_migrations INTEGER , v_reserved_mem INTEGER , v_guest_overhead INTEGER , v_rpm_version VARCHAR(255), v_software_version VARCHAR(40) , v_version_name VARCHAR(40) , v_build_name VARCHAR(40) , v_previous_status INTEGER , v_cpu_flags VARCHAR(4000) , v_pending_vcpus_count INTEGER , v_pending_vmem_size INTEGER , v_cpu_sockets INTEGER , v_net_config_dirty BOOLEAN , v_supported_cluster_levels VARCHAR(40) , v_supported_engines VARCHAR(40) , v_host_os VARCHAR(4000) , v_kvm_version VARCHAR(4000) , v_libvirt_version VARCHAR(4000) , v_spice_version VARCHAR(4000) , v_gluster_version VARCHAR(4000) , v_librbd1_version VARCHAR(4000) , v_glusterfs_cli_version VARCHAR(4000) , v_kernel_version VARCHAR(4000) , v_iscsi_initiator_name VARCHAR(4000) , v_transparent_hugepages_state INTEGER , v_hooks TEXT, v_non_operational_reason INTEGER, v_hw_manufacturer VARCHAR(255), v_hw_product_name VARCHAR(255), v_hw_version VARCHAR(255), v_hw_serial_number VARCHAR(255), v_hw_uuid VARCHAR(255), v_hw_family VARCHAR(255), v_hbas TEXT, v_supported_emulated_machines TEXT, v_kdump_status SMALLINT, v_selinux_enforce_mode INTEGER, v_auto_numa_balancing SMALLINT, v_is_numa_supported BOOLEAN, v_supported_rng_sources VARCHAR(255), v_is_live_snapshot_supported BOOLEAN, v_is_live_merge_supported BOOLEAN, v_online_cpus TEXT, v_maintenance_reason TEXT, v_is_update_available BOOLEAN, v_is_hostdev_enabled BOOLEAN) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE vds_dynamic SET cpu_cores = v_cpu_cores,cpu_threads = v_cpu_threads, cpu_model = v_cpu_model,cpu_speed_mh = v_cpu_speed_mh, if_total_speed = v_if_total_speed,kvm_enabled = v_kvm_enabled, mem_commited = v_mem_commited,physical_mem_mb = v_physical_mem_mb, status = v_status,vm_active = v_vm_active,vm_count = v_vm_count, vm_migrating = v_vm_migrating, incoming_migrations = v_incoming_migrations, outgoing_migrations = v_outgoing_migrations, reserved_mem = v_reserved_mem, guest_overhead = v_guest_overhead,rpm_version = v_rpm_version, software_version = v_software_version, version_name = v_version_name,build_name = v_build_name,previous_status = v_previous_status, cpu_flags = v_cpu_flags, vms_cores_count = v_vms_cores_count,pending_vcpus_count = v_pending_vcpus_count, pending_vmem_size = v_pending_vmem_size, cpu_sockets = v_cpu_sockets,net_config_dirty = v_net_config_dirty, supported_cluster_levels = v_supported_cluster_levels, supported_engines = v_supported_engines,host_os = v_host_os, kvm_version = v_kvm_version,libvirt_version = v_libvirt_version,spice_version = v_spice_version, gluster_version = v_gluster_version, librbd1_version = v_librbd1_version, glusterfs_cli_version = v_glusterfs_cli_version, kernel_version = v_kernel_version,iscsi_initiator_name = v_iscsi_initiator_name, transparent_hugepages_state = v_transparent_hugepages_state, hooks = v_hooks, _update_date = LOCALTIMESTAMP,non_operational_reason = v_non_operational_reason, hw_manufacturer = v_hw_manufacturer, hw_product_name = v_hw_product_name, hw_version = v_hw_version, hw_serial_number = v_hw_serial_number, hw_uuid = v_hw_uuid, hw_family = v_hw_family, hbas = v_hbas, supported_emulated_machines = v_supported_emulated_machines, kdump_status = v_kdump_status, selinux_enforce_mode = v_selinux_enforce_mode, auto_numa_balancing = v_auto_numa_balancing, is_numa_supported = v_is_numa_supported, supported_rng_sources = v_supported_rng_sources, is_live_snapshot_supported = v_is_live_snapshot_supported, is_live_merge_supported = v_is_live_merge_supported, online_cpus = v_online_cpus, maintenance_reason = v_maintenance_reason, is_update_available = v_is_update_available, is_hostdev_enabled = v_is_hostdev_enabled WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVdsDynamic(v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM vds_dynamic WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVdsDynamic() RETURNS SETOF vds_dynamic STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_dynamic.* FROM vds_dynamic; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsDynamicByVdsId(v_vds_id UUID) RETURNS SETOF vds_dynamic STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_dynamic.* FROM vds_dynamic WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVdsStatic( v_free_text_comment text, v_vds_id UUID, v_host_name VARCHAR(255), v_vds_unique_id VARCHAR(128) , v_port INTEGER, v_protocol SMALLINT, v_vds_group_id UUID, v_vds_name VARCHAR(255), v_server_SSL_enabled BOOLEAN , v_vds_type INTEGER, v_vds_strength INTEGER, v_pm_enabled BOOLEAN, v_pm_proxy_preferences VARCHAR(255), v_pm_detect_kdump BOOLEAN, v_vds_spm_priority INTEGER, v_sshKeyFingerprint VARCHAR(128), v_console_address VARCHAR(255), v_ssh_port INTEGER, v_ssh_username VARCHAR(255), v_disable_auto_pm BOOLEAN, v_host_provider_id UUID) RETURNS VOID AS $procedure$ BEGIN IF v_vds_unique_id IS NULL OR NOT EXISTS(SELECT vds_name FROM vds_static WHERE vds_unique_id = v_vds_unique_id) then BEGIN INSERT INTO vds_static(vds_id,host_name, free_text_comment, vds_unique_id, port, protocol, vds_group_id, vds_name, server_SSL_enabled, vds_type,vds_strength,pm_enabled, pm_proxy_preferences, pm_detect_kdump, vds_spm_priority, sshKeyFingerprint, console_address, ssh_port, ssh_username, disable_auto_pm, host_provider_id) VALUES(v_vds_id,v_host_name, v_free_text_comment, v_vds_unique_id, v_port, v_protocol, v_vds_group_id, v_vds_name, v_server_SSL_enabled, v_vds_type,v_vds_strength,v_pm_enabled, v_pm_proxy_preferences, v_pm_detect_kdump, v_vds_spm_priority, v_sshKeyFingerprint, v_console_address, v_ssh_port, v_ssh_username, v_disable_auto_pm, v_host_provider_id); END; end if; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsStatic(v_host_name VARCHAR(255), v_free_text_comment text, v_vds_unique_id VARCHAR(128), v_port INTEGER, v_protocol SMALLINT, v_vds_group_id UUID, v_vds_id UUID, v_vds_name VARCHAR(255), v_server_SSL_enabled BOOLEAN , v_vds_type INTEGER, v_vds_strength INTEGER, v_pm_enabled BOOLEAN, v_pm_proxy_preferences VARCHAR(255), v_pm_detect_kdump BOOLEAN, v_otp_validity BIGINT, v_vds_spm_priority INTEGER, v_sshKeyFingerprint VARCHAR(128), v_console_address VARCHAR(255), v_ssh_port INTEGER, v_ssh_username VARCHAR(255), v_disable_auto_pm BOOLEAN, v_host_provider_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE vds_static SET host_name = v_host_name, free_text_comment = v_free_text_comment,vds_unique_id = v_vds_unique_id, port = v_port, protocol = v_protocol, vds_group_id = v_vds_group_id,vds_name = v_vds_name,server_SSL_enabled = v_server_SSL_enabled, vds_type = v_vds_type, _update_date = LOCALTIMESTAMP,vds_strength = v_vds_strength, pm_enabled = v_pm_enabled, pm_proxy_preferences = v_pm_proxy_preferences, pm_detect_kdump = v_pm_detect_kdump, otp_validity = v_otp_validity, vds_spm_priority = v_vds_spm_priority, sshKeyFingerprint = v_sshKeyFingerprint, host_provider_id = v_host_provider_id, console_address = v_console_address, ssh_port = v_ssh_port, ssh_username = v_ssh_username, disable_auto_pm = v_disable_auto_pm WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVdsStatic(v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM tags_vds_map WHERE vds_id = v_vds_id; -- Delete all Vds Alerts from the database PERFORM DeleteAuditLogAlertsByVdsID(v_vds_id); DELETE FROM vds_static WHERE vds_id = v_vds_id; -- delete VDS permissions -- DELETE FROM permissions where object_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVdsStatic() RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_static.* FROM vds_static; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsStaticByIp(v_ip VARCHAR(40)) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_static.* FROM vds_static vds_static, fence_agents fence_agents WHERE fence_agents.ip = v_ip AND fence_agents.vds_id = vds_static.vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsStaticByHostName(v_host_name VARCHAR(255)) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_static.* FROM vds_static WHERE host_name = v_host_name; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsStaticByVdsId(v_vds_id UUID) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_static.* FROM vds_static WHERE vds_id = v_vds_id; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsStaticByVdsName(v_host_name VARCHAR(255)) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_static.* FROM vds_static WHERE vds_name = v_host_name; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByUniqueID(v_vds_unique_id VARCHAR(128)) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE vds_unique_id = v_vds_unique_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsStaticByVdsGroupId(v_vds_group_id UUID) RETURNS SETOF vds_static STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_static.* FROM vds_static vds_static WHERE vds_group_id = v_vds_group_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetUpAndPrioritizedVds(v_storage_pool_id UUID) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds.* FROM vds vds, vds_groups vdsgroup WHERE (vds.status = 3) AND (vds.storage_pool_id = v_storage_pool_id) AND (vds_spm_priority IS NULL OR vds_spm_priority > -1) AND vds.vds_group_id = vdsgroup.vds_group_id AND vdsgroup.virt_service = true ORDER BY vds_spm_priority DESC, RANDOM(); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVds(v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_permissions_view WHERE user_id = v_user_id AND entity_id = vds_id)); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByVdsId(v_vds_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vds STABLE AS $procedure$ DECLARE v_columns text[]; BEGIN BEGIN if (v_is_filtered) then RETURN QUERY SELECT DISTINCT (rec).* FROM fn_db_mask_object('vds') as q (rec vds) WHERE (rec).vds_id = v_vds_id AND EXISTS (SELECT 1 FROM user_vds_permissions_view WHERE user_id = v_user_id AND entity_id = v_vds_id); else RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE vds_id = v_vds_id; end if; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsWithoutMigratingVmsByVdsGroupId(v_vds_group_id UUID) RETURNS SETOF vds STABLE AS $procedure$ BEGIN -- this sp returns all vds in given cluster that have no pending vms and no vms in migration states BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE vds_group_id = v_vds_group_id and pending_vcpus_count = 0 and vds.status = 3 and vds_id not in(select distinct RUN_ON_VDS from vm_dynamic where status in(5,6,11,12)); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVds(v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM tags_vds_map WHERE vds_id = v_vds_id; -- Delete all Vds Alerts from the database PERFORM DeleteAuditLogAlertsByVdsID(v_vds_id); DELETE FROM vds_statistics WHERE vds_id = v_vds_id; DELETE FROM vds_dynamic WHERE vds_id = v_vds_id; DELETE FROM vds_static WHERE vds_id = v_vds_id; DELETE FROM permissions where object_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByType(v_vds_type INTEGER) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE vds_type = v_vds_type; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByName(v_vds_name VARCHAR(255)) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE vds_name = v_vds_name; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByHostName(v_host_name VARCHAR(255)) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE host_name = v_host_name; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByVdsGroupId(v_vds_group_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vds STABLE AS $procedure$ BEGIN -- this sp returns all vds for a given cluster BEGIN if (v_is_filtered) then RETURN QUERY SELECT DISTINCT (rec).* FROM fn_db_mask_object('vds') as q (rec vds) WHERE (rec).vds_group_id = v_vds_group_id AND EXISTS (SELECT 1 FROM user_vds_permissions_view WHERE user_id = v_user_id AND entity_id = (rec).vds_id); else RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE vds_group_id = v_vds_group_id; end if; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByStoragePoolId(v_storage_pool_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT DISTINCT vds.* FROM vds WHERE storage_pool_id = v_storage_pool_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vds_permissions_view WHERE user_id = v_user_id AND entity_id = vds_id)); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getVdsForVdsGroupWithStatus(v_vds_group_id UUID, v_status integer) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds.* FROM vds WHERE (status = v_status) AND (vds_group_id = v_vds_group_id) ORDER BY vds.vds_id ASC; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getVdsByStoragePoolIdWithStatuses(v_storage_pool_id UUID, v_statuses VARCHAR(150)) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds.* FROM vds INNER JOIN vds_groups vdsgroup ON vds.vds_group_id = vdsgroup.vds_group_id WHERE (v_statuses IS NULL OR vds.status IN (SELECT * FROM fnSplitterInteger(v_statuses))) AND (vds.storage_pool_id = v_storage_pool_id) AND vdsgroup.virt_service = true; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION getHostsForStorageOperation(v_storage_pool_id UUID, v_local_fs_only BOOLEAN) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds.* FROM vds LEFT JOIN vds_groups vg ON vds.vds_group_id = vg.vds_group_id LEFT JOIN storage_pool sp ON vds.storage_pool_id = sp.id WHERE (v_storage_pool_id IS NULL OR vds.storage_pool_id = v_storage_pool_id) AND (vg.virt_service = true) AND (NOT v_local_fs_only OR sp.is_local = true) AND (v_storage_pool_id IS NOT NULL OR vds.status = 3); -- if DC is unspecified return only hosts with status = UP END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsDynamicStatus( v_vds_guid UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_dynamic SET status = v_status WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsDynamicStatusAndReasons( v_vds_guid UUID, v_status INTEGER, v_non_operational_reason INTEGER, v_maintenance_reason TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_dynamic SET status = v_status, non_operational_reason = v_non_operational_reason, maintenance_reason = v_maintenance_reason WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateHostExternalStatus( v_vds_guid UUID, v_external_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_dynamic SET external_status = v_external_status WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsDynamicNetConfigDirty( v_vds_guid UUID, v_net_config_dirty BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_dynamic SET net_config_dirty = v_net_config_dirty WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsDynamicIsUpdateAvailable( v_vds_guid UUID, v_is_update_available BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_dynamic SET is_update_available = v_is_update_available WHERE vds_id = v_vds_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsByNetworkId(v_network_id UUID) RETURNS SETOF vds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vds WHERE EXISTS ( SELECT 1 FROM vds_interface INNER JOIN network ON network.name = vds_interface.network_name INNER JOIN network_cluster ON network.id = network_cluster.network_id WHERE network_id = v_network_id AND vds.vds_group_id = network_cluster.cluster_id AND vds_interface.vds_id = vds.vds_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsWithoutNetwork(v_network_id UUID) RETURNS SETOF vds STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds.* FROM vds INNER JOIN network_cluster ON vds.vds_group_id = network_cluster.cluster_id WHERE network_cluster.network_id = v_network_id AND NOT EXISTS ( SELECT 1 FROM vds_interface INNER JOIN network ON network.name = vds_interface.network_name INNER JOIN network_cluster ON network.id = network_cluster.network_id WHERE network_cluster.network_id = v_network_id AND vds.vds_group_id = network_cluster.cluster_id AND vds_interface.vds_id = vds.vds_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateCpuFlags( v_vds_id UUID, v_cpu_flags VARCHAR(4000)) RETURNS VOID AS $procedure$ BEGIN UPDATE vds_dynamic SET cpu_flags = v_cpu_flags WHERE vds_id = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIdsOfHostsWithStatus(v_status integer) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vds_id FROM vds_dynamic WHERE status = v_status; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVdsCpuStatistics(v_vds_cpu_id UUID, v_vds_id UUID, v_cpu_core_id INTEGER, v_cpu_sys DECIMAL(18,0), v_cpu_user DECIMAL(18,0), v_cpu_idle DECIMAL(18,0), v_usage_cpu_percent INTEGER) RETURNS VOID AS $procedure$ BEGIN BEGIN INSERT INTO vds_cpu_statistics(vds_cpu_id, vds_id, cpu_core_id, cpu_sys, cpu_user, cpu_idle, usage_cpu_percent) VALUES(v_vds_cpu_id, v_vds_id, v_cpu_core_id, v_cpu_sys, v_cpu_user, v_cpu_idle, v_usage_cpu_percent); END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVdsCpuStatistics(v_vds_id UUID, v_cpu_core_id INTEGER, v_cpu_sys DECIMAL(18,0), v_cpu_user DECIMAL(18,0), v_cpu_idle DECIMAL(18,0), v_usage_cpu_percent INTEGER) RETURNS VOID AS $procedure$ BEGIN BEGIN UPDATE vds_cpu_statistics SET cpu_sys = v_cpu_sys, cpu_user = v_cpu_user, cpu_idle = v_cpu_idle, usage_cpu_percent = v_usage_cpu_percent WHERE vds_id = v_vds_id and cpu_core_id = v_cpu_core_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVdsCpuStatisticsByVdsId(v_vds_id UUID) RETURNS VOID AS $procedure$ BEGIN BEGIN DELETE FROM vds_cpu_statistics WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVdsCpuStatisticsByVdsId(v_vds_id UUID) RETURNS SETOF vds_cpu_statistics STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_cpu_statistics.* FROM vds_cpu_statistics WHERE vds_id = v_vds_id; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVdsCpuStatistics() RETURNS SETOF vds_cpu_statistics STABLE AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_cpu_statistics.* FROM vds_cpu_statistics; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getFirstUpRhelForVdsGroupId(v_vds_group_id UUID) RETURNS SETOF vds STABLE AS $procedure$ BEGIN BEGIN -- both centos and RHEL return RHEL as host_os RETURN QUERY select * from vds where (host_os like 'RHEL%' or host_os like 'oVirt Node%' or host_os like 'RHEV Hypervisor%') and status = 3 and vds_group_id = v_vds_group_id LIMIT 1; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetNamesOfHostsDedicatedToVm(v_vm_guid UUID) RETURNS SETOF character varying AS $procedure$ BEGIN BEGIN RETURN QUERY SELECT vds_name FROM vm_host_pinning_view WHERE vm_id = v_vm_guid; END; RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmDevice( v_device_id UUID, v_vm_id UUID, v_device varchar(30), v_type varchar(30), v_address varchar(255), v_boot_order int, v_spec_params text, v_is_managed boolean, v_is_plugged boolean, v_is_readonly boolean, v_alias varchar(255), v_custom_properties text, v_snapshot_id uuid, v_logical_name varchar(255), v_is_using_scsi_reservation boolean) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_device( device_id, vm_id , device , type, address , boot_order , spec_params, is_managed, is_plugged, is_readonly, alias, custom_properties, snapshot_id, logical_name, is_using_scsi_reservation) VALUES( v_device_id , v_vm_id , v_device , v_type , v_address , v_boot_order , v_spec_params, v_is_managed, v_is_plugged, v_is_readonly, v_alias, v_custom_properties, v_snapshot_id, v_logical_name, v_is_using_scsi_reservation); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmDevice( v_device_id UUID, v_vm_id UUID, v_device varchar(30), v_type varchar(30), v_address varchar(255), v_boot_order int, v_spec_params text, v_is_managed boolean, v_is_plugged boolean, v_is_readonly boolean, v_alias varchar(255), v_custom_properties text, v_snapshot_id uuid, v_logical_name varchar(255), v_is_using_scsi_reservation boolean) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_device SET device = v_device, type = v_type, address = v_address, boot_order = v_boot_order, spec_params = v_spec_params, is_managed = v_is_managed, is_plugged = v_is_plugged, is_readonly = v_is_readonly, alias = v_alias, custom_properties = v_custom_properties, snapshot_id = v_snapshot_id, logical_name = v_logical_name, is_using_scsi_reservation = v_is_using_scsi_reservation, _update_date = current_timestamp WHERE device_id = v_device_id and vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmDeviceRuntimeInfo( v_device_id UUID, v_vm_id UUID, v_address varchar(255), v_alias varchar(255)) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_device SET address = v_address, alias = v_alias, _update_date = current_timestamp WHERE device_id = v_device_id and vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmDeviceForHotPlugDisk( v_device_id UUID, v_vm_id UUID, v_is_plugged boolean) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_device SET is_plugged = v_is_plugged, _update_date = current_timestamp WHERE device_id = v_device_id and vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmDeviceBootOrder( v_device_id UUID, v_vm_id UUID, v_boot_order int) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_device SET boot_order = v_boot_order, _update_date = current_timestamp WHERE device_id = v_device_id and vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmDevice(v_device_id UUID, v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_device WHERE device_id = v_device_id AND (v_vm_id IS NULL or vm_id = v_vm_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION DeleteVmDevicesByVmIdAndType(v_vm_id UUID, v_type VARCHAR(30)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_device WHERE vm_id = v_vm_id AND type = v_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmDevice() RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_device_view; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmDeviceByDeviceId(v_device_id UUID, v_vm_id UUID) RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_device_view WHERE device_id = v_device_id AND (v_vm_id IS NULL OR vm_id = v_vm_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmDeviceByVmId(v_vm_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_device_view WHERE vm_id = v_vm_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id)) order by device_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmDeviceByVmIdAndType(v_vm_id UUID, v_type varchar(30)) RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_device_view WHERE vm_id = v_vm_id and type = v_type ORDER BY NULLIF(alias,'') NULLS LAST; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmDeviceByVmIdTypeAndDevice(v_vm_id UUID, v_type varchar(30), v_device varchar(30), v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_device_view WHERE vm_id = v_vm_id and type = v_type and device = v_device AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id UNION SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_id )) ORDER BY NULLIF(alias,'') NULLS LAST; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION GetVmUnmanagedDevicesByVmId(v_vm_id UUID) RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY select vm_device_view.* from vm_device_view where vm_id = v_vm_id and is_managed = false; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION isMemBalloonEnabled(v_vm_id UUID) RETURNS boolean STABLE AS $BODY$ declare result boolean := false; begin if exists (select 1 from vm_device where vm_id = v_vm_id and type = 'balloon' and device = 'memballoon') then result := true; end if; return result; end; $BODY$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION clearVmDeviceAddress(v_device_id UUID) RETURNS VOID AS $BODY$ begin update vm_device set address = '' where device_id = v_device_id; end; $BODY$ LANGUAGE 'plpgsql'; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION ExistsVmDeviceByVmIdAndType(v_vm_id UUID, v_type VARCHAR(30)) RETURNS BOOLEAN STABLE AS $procedure$ BEGIN RETURN EXISTS( SELECT 1 FROM vm_device WHERE vm_id = v_vm_id AND type = v_type); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmDeviceByType(v_type VARCHAR(30)) RETURNS SETOF vm_device_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_device_view WHERE type = v_type; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmIconByVmIconId(v_id UUID) RETURNS SETOF vm_icons STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icons WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmIcons() RETURNS SETOF vm_icons STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icons; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmIconsFiltered(v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vm_icons STABLE AS $procedure$ BEGIN IF v_is_filtered THEN RETURN QUERY -- icons associated with owned vms and templates SELECT DISTINCT vm_icons.* FROM (SELECT * FROM user_vm_template_permissions_view UNION SELECT * FROM user_vm_permissions_view) AS permissions, vm_static, vm_icons WHERE permissions.entity_id = vm_static.vm_guid AND vm_static.entity_type IN ('TEMPLATE', 'VM') AND (vm_icons.id = vm_static.small_icon_id OR vm_icons.id = vm_static.large_icon_id) AND permissions.user_id = v_user_id UNION -- predefined icons SELECT vm_icons.* FROM vm_icons, vm_icon_defaults WHERE vm_icon_defaults.small_icon_id = vm_icons.id OR vm_icon_defaults.large_icon_id = vm_icons.id; ELSE RETURN QUERY SELECT * FROM vm_icons; END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmIcon( v_id UUID, v_data_url TEXT) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_icons( id, data_url) VALUES ( v_id, v_data_url); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmIcon( v_id UUID, v_data_url TEXT) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_icons SET id = v_id, data_url = v_data_url WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmIcon(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_icons WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmIconByVmIconDataUrl(v_data_url TEXT) RETURNS SETOF vm_icons STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icons WHERE data_url = v_data_url; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmIconIfUnused(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_icons WHERE id = v_id AND NOT EXISTS (SELECT 1 FROM vm_icon_defaults WHERE vm_icon_defaults.small_icon_id = vm_icons.id OR vm_icon_defaults.large_icon_id = vm_icons.id) AND NOT EXISTS (SELECT 1 FROM vm_static WHERE vm_static.small_icon_id = vm_icons.id OR vm_static.large_icon_id = vm_icons.id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAllUnusedVmIcons() RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_icons WHERE NOT EXISTS (SELECT 1 FROM vm_icon_defaults WHERE vm_icon_defaults.small_icon_id = vm_icons.id OR vm_icon_defaults.large_icon_id = vm_icons.id) AND NOT EXISTS (SELECT 1 FROM vm_static WHERE vm_static.small_icon_id = vm_icons.id OR vm_static.large_icon_id = vm_icons.id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION IsVmIconExist(v_id UUID) RETURNS BOOLEAN STABLE AS $procedure$ BEGIN RETURN ( SELECT EXISTS( SELECT 1 FROM vm_icons WHERE id = v_id )); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmIconDefaultByVmIconDefaultId(v_id UUID) RETURNS SETOF vm_icon_defaults STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icon_defaults WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmIconDefaults() RETURNS SETOF vm_icon_defaults STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icon_defaults; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmIconDefault( v_id UUID, v_os_id INTEGER, v_small_icon_id UUID, v_large_icon_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_icon_defaults ( id, os_id, small_icon_id, large_icon_id) VALUES ( v_id, v_os_id, v_small_icon_id, v_large_icon_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmIconDefault( v_id UUID, v_os_id INTEGER, v_small_icon_id UUID, v_large_icon_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_icon_defaults SET id = v_id, os_id = v_os_id, small_icon_id = v_small_icon_id, large_icon_id = v_large_icon_id WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmIconDefault(v_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_icon_defaults WHERE id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmIconDefaultByVmIconDefaultLargeIconId(v_large_icon_id UUID) RETURNS SETOF vm_icon_defaults STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icon_defaults WHERE large_icon_id = v_large_icon_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmIconDefaultByVmIconDefaultOsId(v_os_id INTEGER) RETURNS SETOF vm_icon_defaults STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_icon_defaults WHERE os_id = v_os_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteAllFromVmIconDefaults() RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_icon_defaults; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllVmJobIds() RETURNS SETOF uuid STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_jobs.vm_job_id FROM vm_jobs; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmJobsByVmId(v_vm_id uuid) RETURNS SETOF vm_jobs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_jobs.* FROM vm_jobs WHERE vm_jobs.vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmJobsByVmAndImage(v_vm_id uuid, v_image_group_id uuid) RETURNS SETOF vm_jobs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_jobs.* FROM vm_jobs WHERE vm_jobs.vm_id = v_vm_id AND vm_jobs.image_group_id = v_image_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmJobs( v_vm_job_id UUID, v_vm_id UUID, v_job_state INTEGER, v_job_type INTEGER, v_block_job_type INTEGER, v_bandwidth INTEGER, v_cursor_cur BIGINT, v_cursor_end BIGINT, v_image_group_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_jobs SET vm_job_id=v_vm_job_id, vm_id=v_vm_id, job_state=v_job_state, job_type=v_job_type, block_job_type=v_block_job_type, bandwidth=v_bandwidth, cursor_cur=v_cursor_cur, cursor_end=v_cursor_end, image_group_id=v_image_group_id WHERE vm_job_id = v_vm_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmJobs(v_vm_job_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_jobs WHERE vm_job_id = v_vm_job_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmJobs( v_vm_job_id UUID, v_vm_id UUID, v_job_state INTEGER, v_job_type INTEGER, v_block_job_type INTEGER, v_bandwidth INTEGER, v_cursor_cur BIGINT, v_cursor_end BIGINT, v_image_group_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_jobs(vm_job_id, vm_id, job_state, job_type, block_job_type, bandwidth, cursor_cur, cursor_end, image_group_id) VALUES (v_vm_job_id, v_vm_id, v_job_state, v_job_type, v_block_job_type, v_bandwidth, v_cursor_cur, v_cursor_end, v_image_group_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVm_pool_map(v_vm_guid UUID, v_vm_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_pool_map(vm_guid, vm_pool_id) VALUES(v_vm_guid, v_vm_pool_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVm_pool_map(v_vm_guid UUID, v_vm_pool_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_pool_map SET vm_pool_id = v_vm_pool_id WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVm_pool_map(v_vm_guid UUID) RETURNS VOID AS $procedure$ DECLARE v_val VARCHAR(50); BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select vm_guid INTO v_val FROM vm_pool_map WHERE vm_guid = v_vm_guid FOR UPDATE; DELETE FROM vm_pool_map WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVm_pool_map() RETURNS SETOF vm_pool_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_pool_map.* FROM vm_pool_map; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVm_pool_mapByvm_pool_id(v_vm_pool_id UUID) RETURNS SETOF vm_pool_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_pool_map.* FROM vm_pool_map INNER JOIN vm_static ON vm_pool_map.vm_guid = vm_static.vm_guid WHERE vm_pool_id = v_vm_pool_id ORDER BY vm_static.VM_NAME; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getVmMapsInVmPoolByVmPoolIdAndStatus(v_vm_pool_id UUID, v_status INTEGER) RETURNS SETOF vm_pool_map STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_pool_id, vm_pool_map.vm_guid FROM vm_pool_map, vm_dynamic WHERE vm_pool_map.vm_guid = vm_dynamic.vm_guid AND vm_pool_id = v_vm_pool_id AND vm_dynamic.status = v_status; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVm_pools(v_vm_pool_description VARCHAR(4000), v_vm_pool_comment text, v_vm_pool_id UUID , v_vm_pool_name VARCHAR(255), v_vm_pool_type INTEGER, v_parameters VARCHAR(200), v_prestarted_vms INTEGER, v_vds_group_id UUID, v_max_assigned_vms_per_user SMALLINT, v_spice_proxy VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_pools(vm_pool_id,vm_pool_description, vm_pool_comment, vm_pool_name, vm_pool_type,parameters, prestarted_vms, vds_group_id, max_assigned_vms_per_user, spice_proxy) VALUES(v_vm_pool_id,v_vm_pool_description, v_vm_pool_comment, v_vm_pool_name,v_vm_pool_type,v_parameters, v_prestarted_vms, v_vds_group_id, v_max_assigned_vms_per_user, v_spice_proxy); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVm_pools(v_vm_pool_description VARCHAR(4000), v_vm_pool_comment text, v_vm_pool_id UUID, v_vm_pool_name VARCHAR(255), v_vm_pool_type INTEGER, v_parameters VARCHAR(200), v_prestarted_vms INTEGER, v_vds_group_id UUID, v_max_assigned_vms_per_user SMALLINT, v_spice_proxy VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_pools SET vm_pool_description = v_vm_pool_description, vm_pool_comment = v_vm_pool_comment, vm_pool_name = v_vm_pool_name, vm_pool_type = v_vm_pool_type,parameters = v_parameters, prestarted_vms = v_prestarted_vms, vds_group_id = v_vds_group_id, max_assigned_vms_per_user = v_max_assigned_vms_per_user, spice_proxy = v_spice_proxy WHERE vm_pool_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVm_pools(v_vm_pool_id UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select vm_pool_id INTO v_val FROM vm_pools WHERE vm_pool_id = v_vm_pool_id FOR UPDATE; DELETE FROM vm_pools WHERE vm_pool_id = v_vm_pool_id; -- delete VmPool permissions -- DELETE FROM permissions where object_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION SetVmPoolBeingDestroyed(v_vm_pool_id UUID, v_is_being_destroyed BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_pools SET is_being_destroyed = v_is_being_destroyed WHERE vm_pool_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS GetAllFromVm_pools_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** Create type GetAllFromVm_pools_rs AS ( vm_pool_id UUID, assigned_vm_count INTEGER, vm_running_count INTEGER, vm_pool_description VARCHAR(4000), vm_pool_comment text, vm_pool_name VARCHAR(255), vm_pool_type INTEGER, parameters VARCHAR(200), prestarted_vms INTEGER, vds_group_id UUID, vds_group_name VARCHAR(40), max_assigned_vms_per_user SMALLINT, spice_proxy VARCHAR(255), is_being_destroyed BOOLEAN ); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetAllFromVm_pools() RETURNS SETOF GetAllFromVm_pools_rs AS $procedure$ BEGIN -- BEGIN TRAN BEGIN CREATE TEMPORARY TABLE tt_VM_POOL_GROUP ( vm_pool_id UUID, assigned_vm_count INTEGER ) WITH OIDS; exception when others then truncate table tt_VM_POOL_GROUP; END; insert INTO tt_VM_POOL_GROUP(vm_pool_id, assigned_vm_count) select vm_pools_view.vm_pool_id, count(vm_pool_map.vm_pool_id) from vm_pools_view left join vm_pool_map on vm_pools_view.vm_pool_id = vm_pool_map.vm_pool_id group by vm_pools_view.vm_pool_id,vm_pool_map.vm_pool_id; BEGIN CREATE TEMPORARY TABLE tt_VM_POOL_RUNNING ( vm_pool_id UUID, vm_running_count INTEGER ) WITH OIDS; exception when others then truncate table tt_VM_POOL_RUNNING; END; insert INTO tt_VM_POOL_RUNNING(vm_pool_id, vm_running_count) select vm_pools_view.vm_pool_id, count(vm_pools_view.vm_pool_id) from vm_pools_view left join vm_pool_map on vm_pools_view.vm_pool_id = vm_pool_map.vm_pool_id left join vm_dynamic on vm_pool_map.vm_guid = vm_dynamic.vm_guid where vm_dynamic.status > 0 group by vm_pools_view.vm_pool_id; BEGIN CREATE TEMPORARY TABLE tt_VM_POOL_PRERESULT ( vm_pool_id UUID, assigned_vm_count INTEGER, vm_running_count INTEGER ) WITH OIDS; exception when others then truncate table tt_VM_POOL_PRERESULT; END; insert INTO tt_VM_POOL_PRERESULT(vm_pool_id, assigned_vm_count, vm_running_count) select pg.vm_pool_id, pg.assigned_vm_count, pr.vm_running_count from tt_VM_POOL_GROUP pg left join tt_VM_POOL_RUNNING pr on pg.vm_pool_id = pr.vm_pool_id; update tt_VM_POOL_PRERESULT set vm_running_count = 0 where vm_running_count is NULL; BEGIN CREATE TEMPORARY TABLE tt_VM_POOL_RESULT ( vm_pool_id UUID, assigned_vm_count INTEGER, vm_running_count INTEGER, vm_pool_description VARCHAR(4000), vm_pool_comment text, vm_pool_name VARCHAR(255), vm_pool_type INTEGER, parameters VARCHAR(200), prestarted_vms INTEGER, vds_group_id UUID, vds_group_name VARCHAR(40), max_assigned_vms_per_user SMALLINT, spice_proxy VARCHAR(255), is_being_destroyed BOOLEAN ) WITH OIDS; exception when others then truncate table tt_VM_POOL_RESULT; END; insert INTO tt_VM_POOL_RESULT(vm_pool_id, assigned_vm_count, vm_running_count, vm_pool_description, vm_pool_comment, vm_pool_name, vm_pool_type, parameters, prestarted_vms, vds_group_id, vds_group_name, max_assigned_vms_per_user, spice_proxy, is_being_destroyed) select ppr.vm_pool_id, ppr.assigned_vm_count, ppr.vm_running_count, p.vm_pool_description, p.vm_pool_comment, p.vm_pool_name, p.vm_pool_type, p.parameters, p.prestarted_vms, p.vds_group_id, p.vds_group_name, p.max_assigned_vms_per_user, p.spice_proxy, p.is_being_destroyed from tt_VM_POOL_PRERESULT ppr inner join vm_pools_view p on ppr.vm_pool_id = p.vm_pool_id; RETURN QUERY select * from tt_VM_POOL_RESULT; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVm_poolsByvm_pool_id(v_vm_pool_id UUID, v_user_id UUID, v_is_filtered BOOLEAN) RETURNS SETOF vm_pools_full_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_pools_full_view.* FROM vm_pools_full_view WHERE vm_pool_id = v_vm_pool_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_pool_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_pool_id)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVm_poolsByvm_pool_name(v_vm_pool_name VARCHAR(255)) RETURNS SETOF vm_pools_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_pools_view.* FROM vm_pools_view WHERE vm_pool_name = v_vm_pool_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllVm_poolsByUser_id(v_user_id UUID) RETURNS SETOF vm_pools_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vm_pools_view.* FROM users_and_groups_to_vm_pool_map_view INNER JOIN vm_pools_view ON users_and_groups_to_vm_pool_map_view.vm_pool_id = vm_pools_view.vm_pool_id WHERE (users_and_groups_to_vm_pool_map_view.user_id = v_user_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVm_poolsByAdGroup_names(v_ad_group_names VARCHAR(4000)) RETURNS SETOF vm_pools_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vm_pools_view.* FROM ad_groups INNER JOIN users_and_groups_to_vm_pool_map_view ON ad_groups.id = users_and_groups_to_vm_pool_map_view.user_id INNER JOIN vm_pools_view ON users_and_groups_to_vm_pool_map_view.vm_pool_id = vm_pools_view.vm_pool_id WHERE (ad_groups.name in(select Id from fnSplitter(v_ad_group_names))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmDataFromPoolByPoolId(v_pool_id uuid, v_user_id uuid, v_is_filtered boolean) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE vm_pool_id = v_pool_id AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_pool_permissions_view WHERE user_id = v_user_id AND entity_id = v_pool_id)) -- Limiting results to 1 since we only need a single VM from the pool to retrieve the pool data LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmDataFromPoolByPoolName(v_pool_name VARCHAR(4000), v_user_id uuid, v_is_filtered boolean) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE vm_pool_name = v_pool_name AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_pool_permissions_view WHERE user_id = v_user_id AND entity_id = vms.vm_guid)) -- Limiting results to 1 since we only need a single VM from the pool to retrieve the pool data LIMIT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllVm_poolsByUser_id_with_groups_and_UserRoles(v_user_id UUID) RETURNS SETOF vm_pools_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT pools.* FROM vm_pools_view pools INNER JOIN user_vm_pool_permissions_view ON user_id = v_user_id AND entity_id = pools.vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateOvfGenerations(v_vms_ids VARCHAR(5000), v_vms_db_generations VARCHAR(5000), v_ovf_data TEXT, v_ovf_data_seperator VARCHAR(10)) RETURNS VOID AS $procedure$ DECLARE curs_vmids CURSOR FOR SELECT * FROM fnSplitterUuid(v_vms_ids); curs_newovfgen CURSOR FOR SELECT * FROM fnSplitter(v_vms_db_generations); curs_newovfdata CURSOR FOR SELECT * FROM fnSplitterWithSeperator(v_ovf_data, v_ovf_data_seperator); id UUID; new_ovf_gen BIGINT; new_ovf_config TEXT; BEGIN OPEN curs_vmids; OPEN curs_newovfgen; OPEN curs_newovfdata; LOOP FETCH curs_vmids INTO id; FETCH curs_newovfgen INTO new_ovf_gen; FETCH curs_newovfdata INTO new_ovf_config; IF NOT FOUND THEN EXIT; END IF; UPDATE vm_ovf_generations SET ovf_generation = new_ovf_gen, ovf_data = new_ovf_config WHERE vm_guid = id; END LOOP; CLOSE curs_vmids; CLOSE curs_newovfgen; CLOSE curs_newovfdata; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION LoadOvfDataForIds(v_ids VARCHAR(5000)) RETURNS SETOF vm_ovf_generations STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_ovf_generations ovf WHERE ovf.vm_guid IN (SELECT * FROM fnSplitterUuid(v_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetIdsForOvfDeletion(v_storage_pool_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT ovf.vm_guid as vm_guid FROM vm_ovf_generations ovf WHERE ovf.storage_pool_id = v_storage_pool_id AND ovf.vm_guid NOT IN (SELECT vm_guid FROM vm_static); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetOvfGeneration(v_vm_id UUID) RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm.ovf_generation FROM vm_ovf_generations vm WHERE vm.vm_guid = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesIdsForOvfUpdate(v_storage_pool_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT templates.vmt_guid as vm_guid FROM vm_templates_view templates, vm_ovf_generations generations WHERE generations.vm_guid = templates.vmt_guid AND templates.db_generation > generations.ovf_generation AND templates.storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsIdsForOvfUpdate(v_storage_pool_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm.vm_guid as vm_guid FROM vms vm, vm_ovf_generations ovf_gen WHERE vm.vm_guid = ovf_gen.vm_guid AND vm.db_generation > ovf_gen.ovf_generation AND vm.storage_pool_id = v_storage_pool_id -- filter out external VMs if needed. AND vm.origin != 4; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteOvfGenerations(v_vms_ids VARCHAR(5000)) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_ovf_generations WHERE vm_guid IN (SELECT * FROM fnSplitterUuid(v_vms_ids)) -- needed here to ensure that vm with the same id hasn't been added by import vm/template command AND vm_guid NOT IN (SELECT vm_guid FROM vm_static); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmStatistics(v_cpu_sys DECIMAL(18,0) , v_cpu_user DECIMAL(18,0) , v_elapsed_time DECIMAL(18,0) , v_usage_cpu_percent INTEGER , v_usage_mem_percent INTEGER , v_migration_progress_percent INTEGER , v_usage_network_percent INTEGER , v_disks_usage TEXT, v_memory_usage_history TEXT , v_cpu_usage_history TEXT , v_network_usage_history TEXT , v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_statistics(cpu_sys, cpu_user, elapsed_time, usage_cpu_percent, usage_mem_percent, migration_progress_percent, usage_network_percent, disks_usage, vm_guid, memory_usage_history, cpu_usage_history, network_usage_history) VALUES(v_cpu_sys, v_cpu_user, v_elapsed_time, v_usage_cpu_percent, v_usage_mem_percent, v_migration_progress_percent, v_usage_network_percent, v_disks_usage, v_vm_guid, v_memory_usage_history, v_cpu_usage_history, v_network_usage_history); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmStatistics(v_cpu_sys DECIMAL(18,0) , v_cpu_user DECIMAL(18,0) , v_elapsed_time DECIMAL(18,0) , v_usage_cpu_percent INTEGER , v_migration_progress_percent INTEGER , v_usage_mem_percent INTEGER , v_usage_network_percent INTEGER , v_disks_usage TEXT , v_memory_usage_history TEXT , v_cpu_usage_history TEXT , v_network_usage_history TEXT , v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_statistics SET cpu_sys = v_cpu_sys,cpu_user = v_cpu_user,elapsed_time = v_elapsed_time, usage_cpu_percent = v_usage_cpu_percent,usage_mem_percent = v_usage_mem_percent, migration_progress_percent = v_migration_progress_percent, usage_network_percent = v_usage_network_percent,disks_usage = v_disks_usage, memory_usage_history = v_memory_usage_history, cpu_usage_history = v_cpu_usage_history, network_usage_history = v_network_usage_history, _update_date = LOCALTIMESTAMP WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmStatistics(v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_statistics WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmStatistics() RETURNS SETOF vm_statistics STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_statistics.* FROM vm_statistics; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmStatisticsByVmGuid(v_vm_guid UUID) RETURNS SETOF vm_statistics STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_statistics.* FROM vm_statistics WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmDynamic(v_app_list text , v_guest_cur_user_name VARCHAR(255) , v_console_cur_user_name VARCHAR(255) , v_console_user_id UUID, v_guest_os VARCHAR(255) , v_migrating_to_vds UUID , v_run_on_vds UUID , v_status INTEGER, v_vm_guid UUID, v_vm_host VARCHAR(255) , v_vm_ip VARCHAR(255) , v_vm_fqdn VARCHAR(255) , v_last_start_time TIMESTAMP WITH TIME ZONE , v_last_stop_time TIMESTAMP WITH TIME ZONE , v_vm_pid INTEGER , v_acpi_enable BOOLEAN , v_session INTEGER , v_kvm_enable BOOLEAN , v_boot_sequence INTEGER , v_utc_diff INTEGER , v_last_vds_run_on UUID , v_client_ip VARCHAR(255), v_guest_requested_memory INTEGER , v_exit_status INTEGER, v_pause_status INTEGER, v_exit_message VARCHAR(4000), v_guest_agent_nics_hash INTEGER, v_last_watchdog_event NUMERIC, v_last_watchdog_action VARCHAR(8), v_is_run_once BOOLEAN, v_cpu_name VARCHAR(255), v_emulated_machine VARCHAR(255), v_current_cd VARCHAR(4000), v_exit_reason INTEGER, v_guest_cpu_count INTEGER, v_spice_port INTEGER, v_spice_tls_port INTEGER, v_spice_ip varchar(32), v_vnc_port INTEGER, v_vnc_ip varchar(32), v_guest_agent_status INTEGER, v_guest_mem_free BIGINT, v_guest_mem_buffered BIGINT, v_guest_mem_cached BIGINT, v_guest_timezone_offset INTEGER, v_guest_timezone_name VARCHAR(255), v_guestos_arch INTEGER, v_guestos_codename VARCHAR(255), v_guestos_distribution VARCHAR(255), v_guestos_kernel_version VARCHAR(255), v_guestos_type VARCHAR(255), v_guestos_version VARCHAR(255) ) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_dynamic(app_list, guest_cur_user_name, console_cur_user_name, console_user_id, guest_os, migrating_to_vds, RUN_ON_VDS, status, vm_guid, vm_host, vm_ip, last_start_time, last_stop_time, vm_pid, acpi_enable, session, kvm_enable, boot_sequence, utc_diff, last_vds_run_on, client_ip, guest_requested_memory, exit_status,pause_status,exit_message, guest_agent_nics_hash, last_watchdog_event, last_watchdog_action, is_run_once, vm_fqdn, cpu_name, emulated_machine, current_cd, exit_reason, guest_cpu_count, spice_port, spice_tls_port, spice_ip, vnc_port, vnc_ip, guest_agent_status, guest_mem_buffered, guest_mem_cached, guest_mem_free, guest_timezone_offset, guest_timezone_name, guestos_arch, guestos_codename, guestos_distribution, guestos_kernel_version, guestos_type, guestos_version ) VALUES(v_app_list, v_guest_cur_user_name, v_console_cur_user_name, v_console_user_id, v_guest_os, v_migrating_to_vds, v_run_on_vds, v_status, v_vm_guid, v_vm_host, v_vm_ip, v_last_start_time, v_last_stop_time, v_vm_pid, v_acpi_enable, v_session, v_kvm_enable, v_boot_sequence, v_utc_diff, v_last_vds_run_on, v_client_ip, v_guest_requested_memory, v_exit_status, v_pause_status, v_exit_message, v_guest_agent_nics_hash, v_last_watchdog_event, v_last_watchdog_action, v_is_run_once, v_vm_fqdn, v_cpu_name, v_emulated_machine, v_current_cd, v_exit_reason, v_guest_cpu_count, v_spice_port, v_spice_tls_port, v_spice_ip, v_vnc_port, v_vnc_ip, v_guest_agent_status, v_guest_mem_buffered, v_guest_mem_cached, v_guest_mem_free, v_guest_timezone_offset, v_guest_timezone_name, v_guestos_arch, v_guestos_codename, v_guestos_distribution, v_guestos_kernel_version, v_guestos_type, v_guestos_version ); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmDynamic(v_app_list text , v_guest_cur_user_name VARCHAR(255) , v_console_cur_user_name VARCHAR(255) , v_console_user_id UUID, v_guest_os VARCHAR(255) , v_migrating_to_vds UUID , v_run_on_vds UUID , v_status INTEGER, v_vm_guid UUID, v_vm_host VARCHAR(255) , v_vm_ip VARCHAR(255) , v_vm_fqdn VARCHAR(255) , v_last_start_time TIMESTAMP WITH TIME ZONE , v_last_stop_time TIMESTAMP WITH TIME ZONE , v_vm_pid INTEGER , v_acpi_enable BOOLEAN , v_session INTEGER , v_kvm_enable BOOLEAN , v_boot_sequence INTEGER , v_utc_diff INTEGER , v_last_vds_run_on UUID , v_client_ip VARCHAR(255) , v_guest_requested_memory INTEGER , v_exit_status INTEGER, v_pause_status INTEGER, v_exit_message VARCHAR(4000), v_hash VARCHAR(30), v_guest_agent_nics_hash INTEGER, v_last_watchdog_event NUMERIC, v_last_watchdog_action VARCHAR(8), v_is_run_once BOOLEAN, v_cpu_name VARCHAR(255), v_emulated_machine VARCHAR(255), v_current_cd VARCHAR(4000), v_reason VARCHAR(4000), v_exit_reason INTEGER, v_guest_cpu_count INTEGER, v_spice_port INTEGER, v_spice_tls_port INTEGER, v_spice_ip varchar(32), v_vnc_port INTEGER, v_vnc_ip varchar(32), v_guest_agent_status INTEGER, v_guest_mem_buffered BIGINT, v_guest_mem_free BIGINT, v_guest_mem_cached BIGINT, v_guest_timezone_offset INTEGER, v_guest_timezone_name VARCHAR(255), v_guestos_arch INTEGER, v_guestos_codename VARCHAR(255), v_guestos_distribution VARCHAR(255), v_guestos_kernel_version VARCHAR(255), v_guestos_type VARCHAR(255), v_guestos_version VARCHAR(255) ) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_dynamic SET app_list = v_app_list,guest_cur_user_name = v_guest_cur_user_name, console_cur_user_name = v_console_cur_user_name, console_user_id = v_console_user_id, guest_os = v_guest_os,migrating_to_vds = v_migrating_to_vds,RUN_ON_VDS = v_run_on_vds, status = v_status,vm_host = v_vm_host,vm_ip = v_vm_ip,vm_fqdn = v_vm_fqdn, last_start_time = v_last_start_time, last_stop_time = v_last_stop_time, vm_pid = v_vm_pid,acpi_enable = v_acpi_enable, session = v_session, kvm_enable = v_kvm_enable,boot_sequence = v_boot_sequence, utc_diff = v_utc_diff,last_vds_run_on = v_last_vds_run_on,client_ip = v_client_ip, guest_requested_memory = v_guest_requested_memory, exit_status = v_exit_status, pause_status = v_pause_status,exit_message = v_exit_message, hash=v_hash, guest_agent_nics_hash = v_guest_agent_nics_hash, last_watchdog_event = v_last_watchdog_event, last_watchdog_action = v_last_watchdog_action, is_run_once = v_is_run_once, cpu_name = v_cpu_name, emulated_machine = v_emulated_machine, current_cd = v_current_cd, reason = v_reason, exit_reason = v_exit_reason, guest_cpu_count = v_guest_cpu_count, spice_port = v_spice_port, spice_tls_port = v_spice_tls_port, spice_ip = v_spice_ip, vnc_port = v_vnc_port, vnc_ip = v_vnc_ip, guest_agent_status = v_guest_agent_status, guest_mem_buffered = v_guest_mem_buffered, guest_mem_free = v_guest_mem_free, guest_mem_cached = v_guest_mem_cached, guest_timezone_offset = v_guest_timezone_offset, guest_timezone_name = v_guest_timezone_name, guestos_arch = v_guestos_arch, guestos_codename = v_guestos_codename, guestos_distribution = v_guestos_distribution, guestos_kernel_version = v_guestos_kernel_version, guestos_type = v_guestos_type, guestos_version = v_guestos_version WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateConsoleUserWithOptimisticLocking( v_vm_guid UUID, v_console_user_id UUID, v_guest_cur_user_name VARCHAR(255), v_console_cur_user_name VARCHAR(255), OUT v_updated BOOLEAN) AS $procedure$ BEGIN UPDATE vm_dynamic SET console_user_id = v_console_user_id, guest_cur_user_name = v_guest_cur_user_name, console_cur_user_name = v_console_cur_user_name WHERE vm_guid = v_vm_guid AND (console_user_id = v_console_user_id OR console_user_id IS NULL); v_updated := FOUND; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmDynamicStatus( v_vm_guid UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_dynamic SET status = v_status WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION ClearMigratingToVds(v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_dynamic SET migrating_to_vds = null WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmDynamic(v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_dynamic WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmDynamic() RETURNS SETOF vm_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_dynamic.* FROM vm_dynamic; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmDynamicByVmGuid(v_vm_guid UUID) RETURNS SETOF vm_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_dynamic.* FROM vm_dynamic WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmStatic(v_description VARCHAR(4000), v_free_text_comment text, v_mem_size_mb INTEGER, v_num_of_io_threads INTEGER, v_os INTEGER, v_vds_group_id UUID, v_vm_guid UUID, v_vm_name VARCHAR(255), v_vmt_guid UUID, v_creation_date TIMESTAMP WITH TIME ZONE, v_num_of_monitors INTEGER, v_single_qxl_pci BOOLEAN, v_allow_console_reconnect BOOLEAN, v_is_initialized BOOLEAN, v_num_of_sockets INTEGER, v_cpu_per_socket INTEGER, v_threads_per_cpu INTEGER, v_usb_policy INTEGER, v_time_zone VARCHAR(40) , v_auto_startup BOOLEAN, v_is_stateless BOOLEAN, v_is_smartcard_enabled BOOLEAN, v_is_delete_protected BOOLEAN, v_sso_method VARCHAR(32), v_dedicated_vm_for_vds text , v_fail_back BOOLEAN , v_vm_type INTEGER , v_nice_level INTEGER, v_cpu_shares INTEGER, v_default_boot_sequence INTEGER, v_default_display_type INTEGER, v_priority INTEGER, v_iso_path VARCHAR(4000) , v_origin INTEGER , v_initrd_url VARCHAR(4000) , v_kernel_url VARCHAR(4000) , v_kernel_params VARCHAR(4000) , v_migration_support INTEGER , v_predefined_properties VARCHAR(4000) , v_userdefined_properties VARCHAR(4000), v_min_allocated_mem INTEGER, v_quota_id UUID, v_cpu_pinning VARCHAR(4000), v_host_cpu_flags BOOLEAN, v_tunnel_migration BOOLEAN, v_vnc_keyboard_layout VARCHAR(16), v_is_run_and_pause BOOLEAN, v_created_by_user_id UUID, v_instance_type_id UUID, v_image_type_id UUID, v_original_template_id UUID, v_original_template_name VARCHAR(255), v_migration_downtime INTEGER, v_template_version_number INTEGER, v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_is_boot_menu_enabled BOOLEAN, v_numatune_mode VARCHAR(20), v_is_spice_file_transfer_enabled BOOLEAN, v_is_spice_copy_paste_enabled BOOLEAN, v_cpu_profile_id UUID, v_is_auto_converge BOOLEAN, v_is_migrate_compressed BOOLEAN, v_custom_emulated_machine VARCHAR(40), v_custom_cpu_name VARCHAR(40), v_small_icon_id UUID, v_large_icon_id UUID, v_console_disconnect_action VARCHAR(64)) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- lock template for child count update select vm_guid into v_val FROM vm_static WHERE vm_guid = v_vmt_guid for update; INSERT INTO vm_static(description, free_text_comment, mem_size_mb, num_of_io_threads, os, vds_group_id, vm_guid, VM_NAME, vmt_guid, creation_date, num_of_monitors, single_qxl_pci, allow_console_reconnect, is_initialized, num_of_sockets, cpu_per_socket, threads_per_cpu, usb_policy, time_zone, auto_startup, is_stateless, dedicated_vm_for_vds, fail_back, default_boot_sequence, vm_type, nice_level, cpu_shares, default_display_type, priority, iso_path, origin, initrd_url, kernel_url, kernel_params, migration_support, predefined_properties, userdefined_properties, min_allocated_mem, entity_type, quota_id, cpu_pinning, is_smartcard_enabled, is_delete_protected, sso_method, host_cpu_flags, tunnel_migration, vnc_keyboard_layout, is_run_and_pause, created_by_user_id, instance_type_id, image_type_id, original_template_id, original_template_name, migration_downtime, template_version_number, serial_number_policy, custom_serial_number, is_boot_menu_enabled, numatune_mode, is_spice_file_transfer_enabled, is_spice_copy_paste_enabled, cpu_profile_id, is_auto_converge, is_migrate_compressed, custom_emulated_machine, custom_cpu_name, small_icon_id, large_icon_id, console_disconnect_action) VALUES(v_description, v_free_text_comment, v_mem_size_mb, v_num_of_io_threads, v_os, v_vds_group_id, v_vm_guid, v_vm_name, v_vmt_guid, v_creation_date, v_num_of_monitors, v_single_qxl_pci, v_allow_console_reconnect, v_is_initialized, v_num_of_sockets, v_cpu_per_socket, v_threads_per_cpu, v_usb_policy, v_time_zone, v_auto_startup, v_is_stateless, v_dedicated_vm_for_vds, v_fail_back, v_default_boot_sequence, v_vm_type, v_nice_level, v_cpu_shares, v_default_display_type, v_priority, v_iso_path, v_origin, v_initrd_url, v_kernel_url, v_kernel_params, v_migration_support, v_predefined_properties, v_userdefined_properties, v_min_allocated_mem, 'VM', v_quota_id, v_cpu_pinning, v_is_smartcard_enabled, v_is_delete_protected, v_sso_method, v_host_cpu_flags, v_tunnel_migration, v_vnc_keyboard_layout, v_is_run_and_pause, v_created_by_user_id, v_instance_type_id, v_image_type_id, v_original_template_id, v_original_template_name, v_migration_downtime, v_template_version_number, v_serial_number_policy, v_custom_serial_number, v_is_boot_menu_enabled, v_numatune_mode, v_is_spice_file_transfer_enabled, v_is_spice_copy_paste_enabled, v_cpu_profile_id, v_is_auto_converge, v_is_migrate_compressed, v_custom_emulated_machine, v_custom_cpu_name, v_small_icon_id, v_large_icon_id, v_console_disconnect_action); -- perform deletion from vm_ovf_generations to ensure that no record exists when performing insert to avoid PK violation. DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vm_guid AND v_origin != 4; INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) SELECT v_vm_guid, storage_pool_id FROM vds_groups vg WHERE vg.vds_group_id = v_vds_group_id AND v_origin != 4; -- add connections to dedicated hosts PERFORM InsertDedicatedHostsToVm(v_vm_guid, v_dedicated_vm_for_vds); -- set child_count for the template UPDATE vm_static SET child_count = child_count+1 where vm_guid = v_vmt_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION IncrementDbGeneration(v_vm_guid UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET db_generation = db_generation + 1 WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetDbGeneration(v_vm_guid UUID) RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT db_generation FROM vm_static WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION IncrementDbGenerationForAllInStoragePool(v_storage_pool_id UUID) RETURNS VOID AS $procedure$ DECLARE curs CURSOR FOR SELECT vms.vm_guid FROM vm_static vms WHERE vms.vds_group_id IN (SELECT vgs.vds_group_id FROM vds_groups vgs WHERE vgs.storage_pool_id=v_storage_pool_id) ORDER BY vm_guid; id UUID; BEGIN OPEN curs; LOOP FETCH curs INTO id; IF NOT FOUND THEN EXIT; END IF; UPDATE vm_static SET db_generation = db_generation + 1 WHERE vm_guid = id; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsAndTemplatesIdsWithoutAttachedImageDisks(v_storage_pool_id UUID, v_shareable BOOLEAN) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vs.vm_guid FROM vm_static vs WHERE vs.vm_guid NOT IN (SELECT DISTINCT vd.vm_id FROM vm_device vd INNER JOIN base_disks i ON i.disk_id = vd.device_id AND vd.snapshot_id IS NULL WHERE i.disk_storage_type in (0, 2) -- Filter VMs with Images (0) or Cinder (2) disks. AND i.shareable = v_shareable) AND vs.vds_group_id IN (SELECT vg.vds_group_id FROM vds_groups vg, storage_pool sp WHERE vg.storage_pool_id = v_storage_pool_id); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmStatic(v_description VARCHAR(4000) , v_free_text_comment text, v_mem_size_mb INTEGER, v_num_of_io_threads INTEGER, v_os INTEGER, v_vds_group_id UUID, v_vm_guid UUID, v_vm_name VARCHAR(255), v_vmt_guid UUID, v_creation_date TIMESTAMP WITH TIME ZONE, v_num_of_monitors INTEGER, v_single_qxl_pci BOOLEAN, v_allow_console_reconnect BOOLEAN, v_is_initialized BOOLEAN, v_num_of_sockets INTEGER, v_cpu_per_socket INTEGER, v_threads_per_cpu INTEGER, v_usb_policy INTEGER, v_time_zone VARCHAR(40) , v_auto_startup BOOLEAN, v_is_stateless BOOLEAN, v_is_smartcard_enabled BOOLEAN, v_is_delete_protected BOOLEAN, v_sso_method VARCHAR(32), v_dedicated_vm_for_vds text , v_fail_back BOOLEAN , v_vm_type INTEGER , v_nice_level INTEGER, v_cpu_shares INTEGER, v_default_boot_sequence INTEGER, v_default_display_type INTEGER, v_priority INTEGER, v_iso_path VARCHAR(4000) , v_origin INTEGER , v_initrd_url VARCHAR(4000) , v_kernel_url VARCHAR(4000) , v_kernel_params VARCHAR(4000) , v_migration_support INTEGER , v_predefined_properties VARCHAR(4000), v_userdefined_properties VARCHAR(4000), v_min_allocated_mem INTEGER, v_quota_id UUID, v_cpu_pinning VARCHAR(4000), v_host_cpu_flags BOOLEAN, v_tunnel_migration BOOLEAN, v_vnc_keyboard_layout VARCHAR(16), v_is_run_and_pause BOOLEAN, v_created_by_user_id UUID, v_instance_type_id UUID, v_image_type_id UUID, v_original_template_id UUID, v_original_template_name VARCHAR(255), v_migration_downtime INTEGER, v_template_version_number INTEGER, v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_is_boot_menu_enabled BOOLEAN, v_numatune_mode VARCHAR(20), v_is_spice_file_transfer_enabled BOOLEAN, v_is_spice_copy_paste_enabled BOOLEAN, v_cpu_profile_id UUID, v_is_auto_converge BOOLEAN, v_is_migrate_compressed BOOLEAN, v_custom_emulated_machine VARCHAR(40), v_custom_cpu_name VARCHAR(40), v_small_icon_id UUID, v_large_icon_id UUID, v_provider_id UUID, v_console_disconnect_action VARCHAR(64)) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET description = v_description, free_text_comment = v_free_text_comment ,mem_size_mb = v_mem_size_mb, num_of_io_threads = v_num_of_io_threads, os = v_os,vds_group_id = v_vds_group_id, VM_NAME = v_vm_name,vmt_guid = v_vmt_guid, creation_date = v_creation_date,num_of_monitors = v_num_of_monitors,single_qxl_pci = v_single_qxl_pci, allow_console_reconnect = v_allow_console_reconnect, is_initialized = v_is_initialized, num_of_sockets = v_num_of_sockets,cpu_per_socket = v_cpu_per_socket,threads_per_cpu = v_threads_per_cpu, usb_policy = v_usb_policy,time_zone = v_time_zone,auto_startup = v_auto_startup, is_stateless = v_is_stateless,dedicated_vm_for_vds = v_dedicated_vm_for_vds, fail_back = v_fail_back,vm_type = v_vm_type, nice_level = v_nice_level, cpu_shares = v_cpu_shares, _update_date = LOCALTIMESTAMP,default_boot_sequence = v_default_boot_sequence, default_display_type = v_default_display_type, priority = v_priority,iso_path = v_iso_path,origin = v_origin, initrd_url = v_initrd_url,kernel_url = v_kernel_url, kernel_params = v_kernel_params,migration_support = v_migration_support, predefined_properties = v_predefined_properties,userdefined_properties = v_userdefined_properties, min_allocated_mem = v_min_allocated_mem, quota_id = v_quota_id, cpu_pinning = v_cpu_pinning, is_smartcard_enabled = v_is_smartcard_enabled, is_delete_protected = v_is_delete_protected, sso_method = v_sso_method, host_cpu_flags = v_host_cpu_flags, tunnel_migration = v_tunnel_migration, vnc_keyboard_layout = v_vnc_keyboard_layout, is_run_and_pause = v_is_run_and_pause, created_by_user_id = v_created_by_user_id, instance_type_id = v_instance_type_id, image_type_id = v_image_type_id, original_template_id = v_original_template_id, original_template_name = v_original_template_name, migration_downtime = v_migration_downtime, template_version_number = v_template_version_number, serial_number_policy = v_serial_number_policy, custom_serial_number = v_custom_serial_number, is_boot_menu_enabled = v_is_boot_menu_enabled, numatune_mode = v_numatune_mode, is_spice_file_transfer_enabled = v_is_spice_file_transfer_enabled, is_spice_copy_paste_enabled = v_is_spice_copy_paste_enabled, cpu_profile_id = v_cpu_profile_id, is_auto_converge = v_is_auto_converge, is_migrate_compressed = v_is_migrate_compressed, custom_emulated_machine = v_custom_emulated_machine, custom_cpu_name = v_custom_cpu_name, small_icon_id = v_small_icon_id, large_icon_id = v_large_icon_id, provider_id = v_provider_id, console_disconnect_action = v_console_disconnect_action WHERE vm_guid = v_vm_guid AND entity_type = 'VM'; -- Update connections to dedicated hosts PERFORM UpdateDedicatedHostsToVm(v_vm_guid, v_dedicated_vm_for_vds); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmStatic(v_vm_guid UUID, v_remove_permissions boolean) RETURNS VOID AS $procedure$ DECLARE v_val UUID; v_vmt_guid UUID; BEGIN -- store vmt_guid for setting the child_count SELECT vm_static.vmt_guid INTO v_vmt_guid FROM vm_static WHERE vm_guid = v_vm_guid; -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select vm_guid INTO v_val FROM vm_static WHERE vm_guid = v_vm_guid FOR UPDATE; DELETE FROM vm_static WHERE vm_guid = v_vm_guid AND entity_type = 'VM'; -- delete VM permissions -- if v_remove_permissions then DELETE FROM permissions where object_id = v_vm_guid; end if; -- set the child_count for the template UPDATE vm_static SET child_count = child_count - 1 WHERE vm_guid = v_vmt_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmStatic() RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static WHERE entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmStaticWithoutIcon() RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static WHERE entity_type = 'VM' AND (small_icon_id IS NULL OR large_icon_id IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateOriginalTemplateName( v_original_template_id UUID, v_original_template_name VARCHAR(255)) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET original_template_name = v_original_template_name WHERE original_template_id = v_original_template_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmStaticByVmGuid(v_vm_guid UUID) RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static WHERE vm_guid = v_vm_guid AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS GetNamesOfVmStaticDedicatedToVds_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE GetNamesOfVmStaticDedicatedToVds_rs AS (vm_name CHARACTER VARYING); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetNamesOfVmStaticDedicatedToVds(v_vds_id UUID) RETURNS SETOF GetNamesOfVmStaticDedicatedToVds_rs STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_name FROM vm_static WHERE dedicated_vm_for_vds LIKE '%'||v_vds_id::text||'%' AND migration_support = 2 AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmStaticByStoragePoolId(v_sp_id uuid) RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static INNER JOIN vds_groups ON vm_static.vds_group_id = vds_groups.vds_group_id LEFT OUTER JOIN storage_pool ON vm_static.vds_group_id = vds_groups.vds_group_id and vds_groups.storage_pool_id = storage_pool.id WHERE v_sp_id = storage_pool.id AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmStaticByName(v_vm_name VARCHAR(255)) RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static WHERE VM_NAME = v_vm_name AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmStaticByVdsGroup(v_vds_group_id UUID) RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static WHERE vds_group_id = v_vds_group_id AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmStaticWithFailbackByVdsId(v_vds_id UUID) RETURNS SETOF vm_static STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_static.* FROM vm_static WHERE dedicated_vm_for_vds LIKE '%'||v_vds_id::text||'%' and fail_back = TRUE AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVms(v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vms STABLE AS $procedure$ BEGIN IF v_is_filtered THEN RETURN QUERY SELECT vms.* FROM vms INNER JOIN user_vm_permissions_view ON vms.vm_guid = user_vm_permissions_view.entity_id WHERE user_id = v_user_id ORDER BY vm_guid; ELSE RETURN QUERY SELECT DISTINCT vms.* FROM vms ORDER BY vm_guid; END IF; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmsForUserAndActionGroup(v_user_id UUID, v_action_group_id INTEGER) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms, user_vm_permissions_view, permissions_view, engine_session_user_flat_groups WHERE vms.vm_guid = user_vm_permissions_view.entity_id AND user_vm_permissions_view.user_id = v_user_id AND engine_session_user_flat_groups.user_id = user_vm_permissions_view.user_id -- check the user has permission on any parent for this vm id and Object type 2 (vm) AND permissions_view.object_id IN (SELECT id FROM fn_get_entity_parents(vms.vm_guid, 2)) AND permissions_view.ad_element_id = engine_session_user_flat_groups.granted_id AND permissions_view.role_id IN (SELECT role_id FROM roles_groups WHERE action_group_id = v_action_group_id) ORDER BY vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByIds(v_vms_ids VARCHAR(5000)) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm.* FROM vms vm WHERE vm.vm_guid IN (SELECT * from fnSplitterUuid(v_vms_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmByVmGuid(v_vm_guid UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms WHERE vm_guid = v_vm_guid AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = v_vm_guid)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmByVmNameForDataCenter(v_data_center_id UUID, v_vm_name VARCHAR(255), v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms WHERE vm_name = v_vm_name AND (v_data_center_id is null OR storage_pool_id = v_data_center_id) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_permissions_view WHERE user_id = v_user_id AND entity_id = vms.vm_guid)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByVmtGuid(v_vmt_guid UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms WHERE vmt_guid = v_vmt_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByUserId(v_user_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY select vms.* from vms inner join permissions on vms.vm_guid = permissions.object_id WHERE permissions.ad_element_id = v_user_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByInstanceTypeId(v_instance_type_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY select vms.* from vms WHERE instance_type_id = v_instance_type_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByUserIdWithGroupsAndUserRoles(v_user_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* from vms inner join permissions_view as perms on vms.vm_guid = perms.object_id WHERE (perms.ad_element_id = v_user_id or perms.ad_element_id in(select id from getUserAndGroupsById(v_user_id))) and perms.role_type = 2; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsRunningOnVds(v_vds_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms WHERE run_on_vds = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsMigratingToVds(v_vds_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms WHERE migrating_to_vds = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsRunningOnOrMigratingToVds(v_vds_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN -- use migrating_to_vds column when the VM is in status Migrating From RETURN QUERY SELECT DISTINCT V.* FROM VMS V WHERE V.RUN_ON_VDS=V_VDS_ID OR (V.STATUS = 5 AND V.MIGRATING_TO_VDS=V_VDS_ID) ORDER BY V.VM_NAME; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllForStoragePool(v_storage_pool_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vms WHERE storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateGuestAgentStatus( v_vm_guid UUID, v_guest_agent_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_dynamic SET guest_agent_status = v_guest_agent_status WHERE vm_guid = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsDynamicRunningOnVds(v_vds_id UUID) RETURNS SETOF vm_dynamic STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_dynamic.* FROM vm_dynamic WHERE RUN_ON_VDS = v_vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVm(v_vm_guid UUID) RETURNS VOID AS $procedure$ DECLARE v_vmt_guid UUID; BEGIN select vm_static.vmt_guid INTO v_vmt_guid FROM vm_static WHERE vm_guid = v_vm_guid; UPDATE vm_static SET child_count =(SELECT COUNT(*) FROM vm_static WHERE vmt_guid = v_vmt_guid) -1 WHERE vm_guid = v_vmt_guid; DELETE FROM tags_vm_map WHERE vm_id = v_vm_guid; DELETE FROM snapshots WHERE vm_id = v_vm_guid; DELETE FROM vm_statistics WHERE vm_guid = v_vm_guid; DELETE FROM vm_dynamic WHERE vm_guid = v_vm_guid; DELETE FROM vm_static WHERE vm_guid = v_vm_guid; DELETE FROM permissions where object_id = v_vm_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByAdGroupNames(v_ad_group_names VARCHAR(250)) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY select distinct vms.* from vms inner join permissions on vms.vm_guid = permissions.object_id inner join ad_groups on ad_groups.id = permissions.ad_element_id WHERE (ad_groups.name in(select Id from fnSplitter(v_ad_group_names))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByDiskId(v_disk_guid UUID) RETURNS SETOF vms_with_plug_info STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms_with_plug_info.* FROM vms_with_plug_info WHERE device_id = v_disk_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllVMsWithDisksOnOtherStorageDomain(v_storage_domain_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms INNER JOIN (SELECT vm_static.vm_guid FROM vm_static INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN (SELECT image_id FROM image_storage_domain_map WHERE image_storage_domain_map.storage_domain_id = v_storage_domain_id) isd_map ON i.image_guid = isd_map.image_id WHERE entity_type = 'VM') vms_with_disks_on_storage_domain ON vms.vm_guid = vms_with_disks_on_storage_domain.vm_guid INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN image_storage_domain_map on i.image_guid = image_storage_domain_map.image_id WHERE image_storage_domain_map.storage_domain_id != v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetActiveVmsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id inner join image_storage_domain_map on i.image_guid = image_storage_domain_map.image_id WHERE status <> 0 AND is_plugged = TRUE AND image_storage_domain_map.storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid INNER JOIN images ON images.image_group_id = vd.device_id AND images.active = TRUE inner join image_storage_domain_map on images.image_guid = image_storage_domain_map.image_id where image_storage_domain_map.storage_domain_id = v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getAllVmsRelatedToQuotaId(v_quota_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE quota_id = v_quota_id UNION SELECT DISTINCT vms.* FROM vms INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid INNER JOIN images ON images.image_group_id = vd.device_id AND images.active = TRUE INNER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid WHERE image_storage_domain_map.quota_id = v_quota_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateIsInitialized(v_vm_guid UUID, v_is_initialized BOOLEAN) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET is_initialized = v_is_initialized WHERE vm_guid = v_vm_guid AND entity_type = 'VM'; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** DROP TYPE IF EXISTS GetOrderedVmGuidsForRunMultipleActions_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE GetOrderedVmGuidsForRunMultipleActions_rs AS (vm_guid UUID); ************************** CREATE TYPE ********* QUERY ********** Create or replace FUNCTION GetOrderedVmGuidsForRunMultipleActions(v_vm_guids VARCHAR(4000)) RETURNS SETOF GetOrderedVmGuidsForRunMultipleActions_rs STABLE AS $procedure$ DECLARE v_ordered_guids GetOrderedVmGuidsForRunMultipleActions_rs; BEGIN FOR v_ordered_guids IN EXECUTE 'SELECT vm_guid from vm_static where vm_guid in( ' || v_vm_guids || ' ) AND entity_type = ''VM'' order by auto_startup desc,priority desc, migration_support desc' LOOP RETURN NEXT v_ordered_guids; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByNetworkId(v_network_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vms WHERE EXISTS ( SELECT 1 FROM vm_interface INNER JOIN vnic_profiles ON vnic_profiles.id = vm_interface.vnic_profile_id WHERE vnic_profiles.network_id = v_network_id AND vm_interface.vm_guid = vms.vm_guid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByVnicProfileId(v_vnic_profile_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vms WHERE EXISTS ( SELECT 1 FROM vm_interface WHERE vm_interface.vnic_profile_id = v_vnic_profile_id AND vm_interface.vm_guid = vms.vm_guid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByVdsGroupId(v_vds_group_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmsByVmPoolId(v_vm_pool_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE vm_pool_id = v_vm_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetFailedAutoStartVms() RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE auto_startup = TRUE and status = 0 and exit_status = 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetRunningVmsByClusterId(v_cluster_id UUID) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vms.* FROM vms WHERE run_on_vds IS NOT NULL AND vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInitByVmId(v_vm_id UUID) RETURNS SETOF vm_init STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_init.* FROM vm_init WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmInitByids(v_vm_init_ids TEXT) RETURNS SETOF vm_init STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_init WHERE vm_init.vm_id IN (SELECT * from fnSplitterUuid(v_vm_init_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmInit( v_vm_id UUID, v_host_name TEXT, v_domain TEXT, v_authorized_keys TEXT, v_regenerate_keys BOOLEAN, v_time_zone VARCHAR(40), v_dns_servers TEXT, v_dns_search_domains TEXT, v_networks TEXT, v_password TEXT, v_winkey VARCHAR(30), v_custom_script TEXT, v_input_locale VARCHAR(256), v_ui_language VARCHAR(256), v_system_locale VARCHAR(256), v_user_locale VARCHAR(256), v_user_name VARCHAR(256), v_active_directory_ou VARCHAR(256), v_org_name VARCHAR(256)) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_init SET host_name=v_host_name, domain=v_domain, authorized_keys=v_authorized_keys, regenerate_keys=v_regenerate_keys, time_zone=v_time_zone, dns_servers=v_dns_servers, dns_search_domains=v_dns_search_domains, networks=v_networks, password=v_password, winkey=v_winkey, custom_script=v_custom_script, input_locale=v_input_locale, ui_language=v_ui_language, system_locale=v_system_locale, user_locale=v_user_locale, user_name=v_user_name, active_directory_ou=v_active_directory_ou, org_name=v_org_name WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmInit(v_vm_id UUID) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_init WHERE vm_id = v_vm_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmInit( v_vm_id UUID, v_host_name TEXT, v_domain TEXT, v_authorized_keys TEXT, v_regenerate_keys BOOLEAN, v_time_zone VARCHAR(40), v_dns_servers TEXT, v_dns_search_domains TEXT, v_networks TEXT, v_password TEXT, v_winkey VARCHAR(30), v_custom_script TEXT, v_input_locale VARCHAR(256), v_ui_language VARCHAR(256), v_system_locale VARCHAR(256), v_user_locale VARCHAR(256), v_user_name VARCHAR(256), v_active_directory_ou VARCHAR(256), v_org_name VARCHAR(256)) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_init(vm_id, host_name, domain, authorized_keys, regenerate_keys, time_zone, dns_servers, dns_search_domains, networks, password, winkey, custom_script, input_locale, ui_language, system_locale, user_locale, user_name, active_directory_ou, org_name) VALUES(v_vm_id, v_host_name, v_domain, v_authorized_keys, v_regenerate_keys, v_time_zone, v_dns_servers, v_dns_search_domains, v_networks, v_password, v_winkey, v_custom_script, v_input_locale, v_ui_language, v_system_locale, v_user_locale, v_user_name, v_active_directory_ou, v_org_name); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmIdsForVersionUpdate(v_base_template_id UUID) RETURNS SETOF UUID STABLE AS $procedure$ BEGIN RETURN QUERY select vs.vm_guid from vm_static vs natural join vm_dynamic where (vmt_guid = v_base_template_id or vmt_guid in (select vm_guid from vm_static where vmt_guid = v_base_template_id)) and template_version_number is null and entity_type='VM' and status=0 and (is_stateless = TRUE or (exists (select * from vm_pool_map where vm_guid = vs.vm_guid) and not exists (SELECT * FROM snapshots WHERE vm_id = vs.vm_guid AND snapshot_type = 'STATELESS'))); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmCpuProfileIdForClusterId(v_cluster_id UUID, v_cpu_profile_id UUID) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET cpu_profile_id = v_cpu_profile_id WHERE vds_group_id = v_cluster_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertDedicatedHostsToVm(v_vm_guid UUID, v_dedicated_vm_for_vds text) RETURNS VOID AS $procedure$ BEGIN INSERT INTO vm_host_pinning_map(vm_id, vds_id) SELECT v_vm_guid, vds_id FROM fnSplitterUuid(v_dedicated_vm_for_vds) as vds_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateDedicatedHostsToVm(v_vm_guid UUID, v_dedicated_vm_for_vds text) RETURNS VOID AS $procedure$ BEGIN DELETE FROM vm_host_pinning_map WHERE vm_id = v_vm_guid; PERFORM InsertDedicatedHostsToVm(v_vm_guid, v_dedicated_vm_for_vds); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmsByCpuProfileIds(v_cpu_profile_ids UUID[]) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE cpu_profile_id = ANY(v_cpu_profile_ids); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllVmsRelatedToDiskProfiles(v_disk_profile_ids UUID[]) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid INNER JOIN images ON images.image_group_id = vd.device_id AND images.active = TRUE INNER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid WHERE image_storage_domain_map.disk_profile_id = ANY(v_disk_profile_ids); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmsByOrigin(v_origins INT[]) RETURNS SETOF vms STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vms.* FROM vms WHERE origin = ANY(v_origins); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION InsertVmTemplate(v_child_count INTEGER, v_creation_date TIMESTAMP WITH TIME ZONE, v_description VARCHAR(4000) , v_free_text_comment text, v_mem_size_mb INTEGER, v_num_of_io_threads INTEGER, v_name VARCHAR(40), v_num_of_sockets INTEGER, v_cpu_per_socket INTEGER, v_threads_per_cpu INTEGER, v_os INTEGER, v_vmt_guid UUID, v_vds_group_id UUID, v_num_of_monitors INTEGER, v_single_qxl_pci BOOLEAN, v_allow_console_reconnect BOOLEAN, v_status INTEGER, v_usb_policy INTEGER, v_time_zone VARCHAR(40) , v_fail_back BOOLEAN , v_vm_type INTEGER , v_nice_level INTEGER, v_cpu_shares INTEGER, v_default_boot_sequence INTEGER, v_default_display_type INTEGER, v_priority INTEGER, v_auto_startup BOOLEAN, v_is_stateless BOOLEAN, v_is_smartcard_enabled BOOLEAN, v_is_delete_protected BOOLEAN, v_sso_method VARCHAR(32), v_is_disabled BOOLEAN, v_iso_path VARCHAR(4000) , v_origin INTEGER , v_initrd_url VARCHAR(4000) , v_kernel_url VARCHAR(4000) , v_kernel_params VARCHAR(4000) , v_quota_id UUID, v_migration_support integer, v_dedicated_vm_for_vds text, v_tunnel_migration BOOLEAN, v_vnc_keyboard_layout VARCHAR(16), v_min_allocated_mem INTEGER, v_is_run_and_pause BOOLEAN, v_created_by_user_id UUID, v_template_type VARCHAR(40), v_migration_downtime INTEGER, v_base_template_id UUID, v_template_version_name VARCHAR(40), v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_is_boot_menu_enabled BOOLEAN, v_is_spice_file_transfer_enabled BOOLEAN, v_is_spice_copy_paste_enabled BOOLEAN, v_cpu_profile_id UUID, v_numatune_mode VARCHAR(20), v_is_auto_converge BOOLEAN, v_is_migrate_compressed BOOLEAN, v_predefined_properties VARCHAR(4000), v_userdefined_properties VARCHAR(4000), v_custom_emulated_machine VARCHAR(40), v_custom_cpu_name VARCHAR(40), v_small_icon_id UUID, v_large_icon_id UUID, v_console_disconnect_action VARCHAR(64)) RETURNS VOID AS $procedure$ DECLARE v_template_version_number INTEGER; BEGIN -- get current max version and use next SELECT max(template_version_number) + 1 into v_template_version_number from vm_static where vmt_guid = v_base_template_id and entity_type = 'TEMPLATE'; -- if no versions exist it might return null, so this is a new base template if v_template_version_number is null then v_template_version_number = 1; end if; INSERT INTO vm_static( child_count, creation_date, description, free_text_comment, mem_size_mb, num_of_io_threads, vm_name, num_of_sockets, cpu_per_socket, threads_per_cpu, os, vm_guid, vds_group_id, num_of_monitors, single_qxl_pci, allow_console_reconnect, template_status, usb_policy, time_zone, fail_back, vm_type, nice_level, cpu_shares, default_boot_sequence, default_display_type, priority, auto_startup, is_stateless, iso_path, origin, initrd_url, kernel_url, kernel_params, entity_type, quota_id, migration_support, is_disabled, dedicated_vm_for_vds, is_smartcard_enabled, is_delete_protected, sso_method, tunnel_migration, vnc_keyboard_layout, min_allocated_mem, is_run_and_pause, created_by_user_id, migration_downtime, template_version_number, vmt_guid, template_version_name, serial_number_policy, custom_serial_number, is_boot_menu_enabled, is_spice_file_transfer_enabled, is_spice_copy_paste_enabled, cpu_profile_id, numatune_mode, is_auto_converge, is_migrate_compressed, predefined_properties, userdefined_properties, custom_emulated_machine, custom_cpu_name, small_icon_id, large_icon_id, console_disconnect_action) VALUES( v_child_count, v_creation_date, v_description, v_free_text_comment, v_mem_size_mb, v_num_of_io_threads, v_name, v_num_of_sockets, v_cpu_per_socket, v_threads_per_cpu, v_os, v_vmt_guid, v_vds_group_id, v_num_of_monitors, v_single_qxl_pci, v_allow_console_reconnect, v_status, v_usb_policy, v_time_zone, v_fail_back, v_vm_type, v_nice_level, v_cpu_shares, v_default_boot_sequence, v_default_display_type, v_priority, v_auto_startup, v_is_stateless, v_iso_path, v_origin, v_initrd_url, v_kernel_url, v_kernel_params, v_template_type, v_quota_id, v_migration_support, v_is_disabled, v_dedicated_vm_for_vds, v_is_smartcard_enabled, v_is_delete_protected, v_sso_method, v_tunnel_migration, v_vnc_keyboard_layout, v_min_allocated_mem, v_is_run_and_pause, v_created_by_user_id, v_migration_downtime, v_template_version_number, v_base_template_id, v_template_version_name, v_serial_number_policy, v_custom_serial_number, v_is_boot_menu_enabled, v_is_spice_file_transfer_enabled, v_is_spice_copy_paste_enabled, v_cpu_profile_id, v_numatune_mode, v_is_auto_converge, v_is_migrate_compressed, v_predefined_properties, v_userdefined_properties, v_custom_emulated_machine, v_custom_cpu_name, v_small_icon_id, v_large_icon_id, v_console_disconnect_action); -- perform deletion from vm_ovf_generations to ensure that no record exists when performing insert to avoid PK violation. DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vmt_guid; INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) VALUES (v_vmt_guid, (SELECT storage_pool_id FROM vds_groups vg WHERE vg.vds_group_id = v_vds_group_id)); -- add connections to dedicated hosts PERFORM InsertDedicatedHostsToVm(v_vmt_guid, v_dedicated_vm_for_vds); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmTemplate(v_child_count INTEGER, v_creation_date TIMESTAMP WITH TIME ZONE, v_description VARCHAR(4000) , v_free_text_comment text, v_mem_size_mb INTEGER, v_num_of_io_threads INTEGER, v_name VARCHAR(40), v_num_of_sockets INTEGER, v_cpu_per_socket INTEGER, v_threads_per_cpu INTEGER, v_os INTEGER, v_vmt_guid UUID, v_vds_group_id UUID, v_num_of_monitors INTEGER, v_single_qxl_pci BOOLEAN, v_allow_console_reconnect BOOLEAN, v_status INTEGER, v_usb_policy INTEGER, v_time_zone VARCHAR(40) , v_fail_back BOOLEAN , v_vm_type INTEGER , v_nice_level INTEGER, v_cpu_shares INTEGER, v_default_boot_sequence INTEGER, v_default_display_type INTEGER, v_priority INTEGER, v_auto_startup BOOLEAN, v_is_stateless BOOLEAN, v_is_smartcard_enabled BOOLEAN, v_is_delete_protected BOOLEAN, v_sso_method VARCHAR(32), v_is_disabled BOOLEAN, v_iso_path VARCHAR(4000) , v_origin INTEGER , v_initrd_url VARCHAR(4000) , v_kernel_url VARCHAR(4000) , v_kernel_params VARCHAR(4000), v_quota_id UUID, v_migration_support integer, v_dedicated_vm_for_vds text, v_tunnel_migration BOOLEAN, v_vnc_keyboard_layout VARCHAR(16), v_min_allocated_mem INTEGER, v_is_run_and_pause BOOLEAN, v_created_by_user_id UUID, v_template_type VARCHAR(40), v_migration_downtime INTEGER, v_template_version_name VARCHAR(40), v_serial_number_policy SMALLINT, v_custom_serial_number VARCHAR(255), v_is_boot_menu_enabled BOOLEAN, v_is_spice_file_transfer_enabled BOOLEAN, v_is_spice_copy_paste_enabled BOOLEAN, v_cpu_profile_id UUID, v_numatune_mode VARCHAR(20), v_is_auto_converge BOOLEAN, v_is_migrate_compressed BOOLEAN, v_predefined_properties VARCHAR(4000), v_userdefined_properties VARCHAR(4000), v_custom_emulated_machine VARCHAR(40), v_custom_cpu_name VARCHAR(40), v_small_icon_id UUID, v_large_icon_id UUID, v_console_disconnect_action VARCHAR(64)) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET child_count = v_child_count,creation_date = v_creation_date,description = v_description, free_text_comment = v_free_text_comment, mem_size_mb = v_mem_size_mb, num_of_io_threads = v_num_of_io_threads, vm_name = v_name,num_of_sockets = v_num_of_sockets, cpu_per_socket = v_cpu_per_socket, threads_per_cpu = v_threads_per_cpu, os = v_os, vds_group_id = v_vds_group_id,num_of_monitors = v_num_of_monitors, single_qxl_pci = v_single_qxl_pci, allow_console_reconnect = v_allow_console_reconnect, template_status = v_status,usb_policy = v_usb_policy,time_zone = v_time_zone, fail_back = v_fail_back, vm_type = v_vm_type, nice_level = v_nice_level, cpu_shares = v_cpu_shares, default_boot_sequence = v_default_boot_sequence, default_display_type = v_default_display_type, priority = v_priority,auto_startup = v_auto_startup,is_stateless = v_is_stateless, iso_path = v_iso_path,origin = v_origin,initrd_url = v_initrd_url, kernel_url = v_kernel_url,kernel_params = v_kernel_params, _update_date = CURRENT_TIMESTAMP, quota_id = v_quota_id, migration_support = v_migration_support, dedicated_vm_for_vds = v_dedicated_vm_for_vds, is_smartcard_enabled = v_is_smartcard_enabled, is_delete_protected = v_is_delete_protected, sso_method = v_sso_method, is_disabled = v_is_disabled, tunnel_migration = v_tunnel_migration, vnc_keyboard_layout = v_vnc_keyboard_layout, min_allocated_mem = v_min_allocated_mem, is_run_and_pause = v_is_run_and_pause, created_by_user_id = v_created_by_user_id, migration_downtime = v_migration_downtime, template_version_name = v_template_version_name, serial_number_policy = v_serial_number_policy, custom_serial_number = v_custom_serial_number, is_boot_menu_enabled = v_is_boot_menu_enabled, is_spice_file_transfer_enabled = v_is_spice_file_transfer_enabled, is_spice_copy_paste_enabled = v_is_spice_copy_paste_enabled, cpu_profile_id = v_cpu_profile_id, numatune_mode = v_numatune_mode, is_auto_converge = v_is_auto_converge, is_migrate_compressed = v_is_migrate_compressed, predefined_properties = v_predefined_properties,userdefined_properties = v_userdefined_properties, custom_emulated_machine = v_custom_emulated_machine, custom_cpu_name = v_custom_cpu_name, small_icon_id = v_small_icon_id, large_icon_id = v_large_icon_id, console_disconnect_action = v_console_disconnect_action WHERE vm_guid = v_vmt_guid AND entity_type = v_template_type; -- update template versions to new name update vm_static set vm_name = v_name where vm_guid <> v_vmt_guid and vmt_guid = v_vmt_guid and entity_type = v_template_type; -- Update connections to dedicated hosts PERFORM UpdateDedicatedHostsToVm(v_vmt_guid, v_dedicated_vm_for_vds); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION UpdateVmTemplateStatus( v_vmt_guid UUID, v_status INTEGER) RETURNS VOID AS $procedure$ BEGIN UPDATE vm_static SET template_status = v_status WHERE vm_guid = v_vmt_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION DeleteVmTemplates(v_vmt_guid UUID) RETURNS VOID AS $procedure$ DECLARE v_val UUID; BEGIN -- Get (and keep) a shared lock with "right to upgrade to exclusive" -- in order to force locking parent before children select vm_guid INTO v_val FROM vm_static WHERE vm_guid = v_vmt_guid FOR UPDATE; DELETE FROM vm_static WHERE vm_guid = v_vmt_guid; -- delete Template permissions -- DELETE FROM permissions where object_id = v_vmt_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllFromVmTemplates(v_user_id UUID, v_is_filtered boolean, v_entity_type VARCHAR(32)) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates WHERE entity_type = v_entity_type AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = vmt_guid)) ORDER BY name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesWithoutIcon() RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_template.* FROM vm_templates_view AS vm_template WHERE entity_type = 'TEMPLATE' AND (small_icon_id IS NULL OR large_icon_id IS NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTemplateCount() RETURNS SETOF BIGINT STABLE AS $procedure$ BEGIN RETURN QUERY SELECT count (vm_templates.*) FROM vm_templates_view vm_templates; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesByIds(v_vm_templates_ids VARCHAR(5000)) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates WHERE vm_templates.vmt_guid IN (SELECT * FROM fnSplitterUuid(v_vm_templates_ids)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION getAllVmTemplatesRelatedToQuotaId(v_quota_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates WHERE quota_id = v_quota_id UNION SELECT DISTINCT vm_templates.* FROM vm_templates_view vm_templates INNER JOIN vm_device vd ON vd.vm_id = vm_templates.vmt_guid INNER JOIN images ON images.image_group_id = vd.device_id AND images.active = TRUE INNER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid WHERE image_storage_domain_map.quota_id = v_quota_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplateByVmtGuid(v_vmt_guid UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates WHERE vmt_guid = v_vmt_guid AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = v_vmt_guid)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplateByVmtName(v_storage_pool_id UUID, v_vmt_name VARCHAR(255), v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates WHERE name = v_vmt_name AND (v_storage_pool_id is null OR storage_pool_id = v_storage_pool_id OR storage_pool_id is null) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = vmt_guid)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplateByVdsGroupId(v_vds_group_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates WHERE vds_group_id = v_vds_group_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesByStoragePoolId(v_storage_pool_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vm_templates.* FROM vm_templates_view vm_templates where vm_templates.storage_pool_id = v_storage_pool_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesByImageId(v_image_guid UUID) RETURNS SETOF vm_templates_with_plug_info STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_templates_with_plug_info t WHERE t.image_guid = v_image_guid; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesByStorageDomainId(v_storage_domain_id UUID, v_user_id UUID, v_is_filtered boolean) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT vm_templates.* FROM vm_templates_view vm_templates INNER JOIN vm_device vd ON vd.vm_id = vm_templates.vmt_guid INNER JOIN images i ON i.image_group_id = vd.device_id AND i.active = TRUE where i.image_guid in(select image_id from image_storage_domain_map where storage_domain_id = v_storage_domain_id) AND (NOT v_is_filtered OR EXISTS (SELECT 1 FROM user_vm_template_permissions_view WHERE user_id = v_user_id AND entity_id = vm_templates.vmt_guid)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_perms_get_templates_with_permitted_action(v_user_id UUID, v_action_group_id integer) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates_view.* FROM vm_templates_view, user_vm_template_permissions_view WHERE vm_templates_view.vmt_guid = user_vm_template_permissions_view.entity_id AND user_vm_template_permissions_view.user_id = v_user_id AND (SELECT get_entity_permissions(v_user_id, v_action_group_id, vm_templates_view.vmt_guid, 4) IS NOT NULL); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesByNetworkId(v_network_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_templates_view WHERE EXISTS ( SELECT 1 FROM vm_interface INNER JOIN vnic_profiles ON vnic_profiles.id = vm_interface.vnic_profile_id WHERE vnic_profiles.network_id = v_network_id AND vm_interface.vmt_guid = vm_templates_view.vmt_guid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetVmTemplatesByVnicProfileId(v_vnic_profile_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * FROM vm_templates_view WHERE EXISTS ( SELECT 1 FROM vm_interface WHERE vm_interface.vnic_profile_id = v_vnic_profile_id AND vm_interface.vmt_guid = vm_templates_view.vmt_guid); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTemplateVersionsForBaseTemplate(v_base_template_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * from vm_templates_view where base_template_id = v_base_template_id and vmt_guid != v_base_template_id order by template_version_number desc; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetTemplateWithLatestVersionInChain(v_template_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT * from vm_templates_view where base_template_id = (select vmt_guid from vm_static where vm_guid = v_template_id) order by template_version_number desc limit 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION GetAllVmTemplatesWithDisksOnOtherStorageDomain(v_storage_domain_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT DISTINCT templates.* FROM vm_templates_view templates INNER JOIN (SELECT vm_static.vm_guid FROM vm_static INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN (SELECT image_id FROM image_storage_domain_map WHERE image_storage_domain_map.storage_domain_id = v_storage_domain_id) isd_map ON i.image_guid = isd_map.image_id WHERE entity_type = 'TEMPLATE') vms_with_disks_on_storage_domain ON templates.vmt_guid = vms_with_disks_on_storage_domain.vm_guid INNER JOIN vm_device vd ON vd.vm_id = templates.vmt_guid INNER JOIN images i ON i.image_group_id = vd.device_id INNER JOIN image_storage_domain_map on i.image_guid = image_storage_domain_map.image_id WHERE image_storage_domain_map.storage_domain_id != v_storage_domain_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetVmTemplatesByCpuProfileId(v_cpu_profile_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates_view.* FROM vm_templates_view WHERE cpu_profile_id = v_cpu_profile_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION GetAllVmTemplatesRelatedToDiskProfile(v_disk_profile_id UUID) RETURNS SETOF vm_templates_view STABLE AS $procedure$ BEGIN RETURN QUERY SELECT vm_templates.* FROM vm_templates_view vm_templates INNER JOIN vm_device vd ON vd.vm_id = vm_templates.vmt_guid INNER JOIN images ON images.image_group_id = vd.device_id AND images.active = TRUE INNER JOIN image_storage_domain_map ON image_storage_domain_map.image_id = images.image_guid WHERE image_storage_domain_map.disk_profile_id = v_disk_profile_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (not exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin insert into vdc_options (option_name, option_value, version) values (v_option_name, v_option_value, v_version); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value_all_versions(v_option_name varchar(100)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name)) then begin delete from vdc_options where option_name ilike v_option_name; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_value(v_option_name varchar(100), v_version text) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)))) then begin delete from vdc_options where option_name ilike v_option_name and version in (select ID from fnSplitter(v_version)); end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_delete_config_for_version(v_version text) returns void AS $procedure$ BEGIN delete from vdc_options where version in (select ID from fnSplitter(v_version)); END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_config_value(v_option_name varchar(100), v_option_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin update vdc_options set option_value = v_option_value where option_name ilike v_option_name and version = v_version; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_update_default_config_value(v_option_name varchar(100),v_default_option_value varchar(4000),v_option_value varchar(4000),v_version varchar(40),v_ignore_default_value_case boolean) returns void AS $procedure$ begin if (exists (select 1 from vdc_options where option_name ilike v_option_name and version = v_version)) then begin if (v_ignore_default_value_case) then update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value ilike v_default_option_value and version = v_version; else update vdc_options set option_value = v_option_value where option_name ilike v_option_name and option_value = v_default_option_value and version = v_version; end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_rename_config_key(v_old_option_name varchar(100),v_new_option_name varchar(100),v_version varchar(40)) returns void AS $procedure$ DECLARE v_current_option_value varchar(4000); begin if (exists (select 1 from vdc_options where option_name ilike v_old_option_name and version = v_version)) then v_current_option_value:=option_value from vdc_options where option_name ilike v_old_option_name and version = v_version; update vdc_options set option_name = v_new_option_name, option_value = v_current_option_value where option_name ilike v_old_option_name and version = v_version; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'public' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'public' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'public' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'public' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'public' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'public' and table_name ilike v_table and column_name ilike v_column and table_schema = 'public' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION attach_user_to_role ( v_user_name VARCHAR(255), v_domain VARCHAR(255), v_namespace VARCHAR(255), v_domain_entry_id text, v_role_name VARCHAR(255) ) RETURNS void AS $BODY$ DECLARE selected_user_id uuid; input_role_id uuid; BEGIN select roles.id into input_role_id from roles where roles.name = v_role_name; -- The external identifier is the user identifier converted to an array of -- bytes: insert into users(user_id,external_id, namespace,name,domain,username,last_admin_check_status) select uuid_generate_v1(), v_domain_entry_id, v_namespace, v_user_name, v_domain, v_user_name,true where not exists (select 1 from users where domain = v_domain and external_id = v_domain_entry_id); select user_id from users where domain = v_domain and external_id = v_domain_entry_id into selected_user_id; insert into permissions(id,role_id,ad_element_id,object_id,object_type_id) select uuid_generate_v1(), input_role_id, selected_user_id, getGlobalIds('system'), 1 where not exists(select role_id,ad_element_id,object_id,object_type_id from permissions where role_id = input_role_id and ad_element_id = selected_user_id and object_id= getGlobalIds('system') and object_type_id = 1); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_add_action_group_to_role(v_role_id UUID, v_action_group_id INTEGER) RETURNS VOID AS $procedure$ BEGIN INSERT INTO roles_groups(role_id,action_group_id) SELECT v_role_id, v_action_group_id WHERE NOT EXISTS (SELECT 1 FROM roles_groups WHERE role_id = v_role_id AND action_group_id = v_action_group_id); RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_split_config_value(v_option_name character varying, v_old_option_value character varying, v_new_option_value character varying, v_update_from_version character varying) RETURNS void AS $BODY$ declare v_old_value varchar(4000); v_cur cursor for select distinct version from vdc_options where version <> 'general' order by version; v_version varchar(40); v_index integer; v_count integer; v_total_count integer; v_version_count integer; begin v_total_count := count(version) from vdc_options where option_name = v_option_name; v_old_value := option_value from vdc_options where option_name = v_option_name and version = 'general'; v_version_count := count(distinct version) from vdc_options where version <> 'general'; if (v_total_count <= v_version_count) then begin if (v_old_value IS NULL) then v_old_value := v_old_option_value; end if; v_count := count(distinct version) from vdc_options where version <> 'general'; v_index := 1; open v_cur; loop fetch v_cur into v_version; exit when not found; -- We shouldn't update if already exists if (not exists (select 1 from vdc_options where option_name = v_option_name and version = v_version)) then -- Might not work well for versions such as 3.10, but we currently don't have any if (v_version >= v_update_from_version) then insert into vdc_options (option_name, option_value, version) values (v_option_name, v_new_option_value, v_version); else insert into vdc_options (option_name, option_value, version) values (v_option_name, v_old_value, v_version); end if; end if; v_index := v_index +1; end loop; close v_cur; delete from vdc_options where option_name = v_option_name and version = 'general'; end; end if; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_grant_action_group_to_all_roles_filter(v_action_group_id integer, uuid[]) RETURNS void AS $BODY$ declare v_role_id_to_filter alias for $2; begin insert into roles_groups (role_id, action_group_id) select distinct role_id, v_action_group_id from roles_groups rg where not ARRAY [role_id] <@ v_role_id_to_filter and not exists (select 1 from roles_groups where role_id = rg.role_id and action_group_id = v_action_group_id); END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_column_to_object_white_list(v_object_name varchar(128), v_column_name varchar(128)) returns void AS $procedure$ begin if (not exists (select 1 from object_column_white_list where object_name = v_object_name and column_name = v_column_name)) then begin -- verify that there is such object in db if exists (select 1 from information_schema.columns where table_schema = 'public' and table_name = v_object_name and column_name = v_column_name) then insert into object_column_white_list (object_name, column_name) values (v_object_name, v_column_name); end if; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'public' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_disk(v_id UUID) returns void AS $procedure$ declare OK integer; LOCKED integer; begin OK:=1; LOCKED:=2; update images set imagestatus = OK where imagestatus = LOCKED and image_group_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_snapshot(v_id UUID) returns void AS $procedure$ declare OK varchar; LOCKED varchar; begin OK:='OK'; LOCKED:='LOCKED'; update snapshots set status = OK where status = LOCKED and snapshot_id = v_id; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_entity(v_object_type varchar(10), v_name varchar(255), v_recursive boolean) returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; v_id UUID; begin DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; --unlock images and snapshots if recursive flag is set if (v_recursive) then update images set imagestatus = OK where imagestatus = LOCKED and image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED and vm_id = v_id; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_unlock_all() returns void AS $procedure$ declare DOWN integer; OK integer; LOCKED integer; TEMPLATE_OK integer; TEMPLATE_LOCKED integer; IMAGE_LOCKED integer; SNAPSHOT_OK varchar; SNAPSHOT_LOCKED varchar; BEGIN DOWN:=0; OK:=1; LOCKED:=2; TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; SNAPSHOT_OK:='OK'; SNAPSHOT_LOCKED:='LOCKED'; update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED; update vm_dynamic set status = DOWN where status = IMAGE_LOCKED; update images set imagestatus = OK where imagestatus = LOCKED; update snapshots set status = SNAPSHOT_OK where status ilike SNAPSHOT_LOCKED; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** /* Displays DC id , DC name, SPM Host id , SPM Host name and number of async tasks awaiting. 1) create a record type with DC name, DC id, SPM host id, SPM host name, count 2) get all distinct DC ids from async_tasks table 3) Run a cursor for each result in 2) a) get DC name b) get SPM Host id & name if available c) get count of tasks return current record 4) return set of generated records */ DROP TYPE IF EXISTS async_tasks_info_rs CASCADE; ************************** DROP TYPE ********* QUERY ********** CREATE TYPE async_tasks_info_rs AS ( dc_id uuid, dc_name character varying, spm_host_id uuid, spm_host_name character varying, task_count integer ); ************************** CREATE TYPE ********* QUERY ********** create or replace FUNCTION fn_db_get_async_tasks() returns SETOF async_tasks_info_rs STABLE AS $procedure$ DECLARE v_record async_tasks_info_rs; -- selects storage_pool_id uuid found in async_tasks v_tasks_cursor cursor for select distinct storage_pool_id from async_tasks; begin OPEN v_tasks_cursor; FETCH v_tasks_cursor into v_record.dc_id; WHILE FOUND LOOP -- get dc_name and SPM Host id v_record.dc_name := name from storage_pool where id = v_record.dc_id; v_record.spm_host_id := spm_vds_id from storage_pool where id = v_record.dc_id; -- get Host name if we have non NULL SPM Host if (v_record.spm_host_id IS NOT NULL) then v_record.spm_host_name := vds_name from vds_static where vds_id = v_record.spm_host_id; else v_record.spm_host_name:=''; end if; -- get tasks count for this DC v_record.task_count := count(*) from async_tasks where position (cast(v_record.dc_id as varchar) in action_parameters) > 0; -- return the record RETURN NEXT v_record; FETCH v_tasks_cursor into v_record.dc_id; END LOOP; CLOSE v_tasks_cursor; -- return full set of generated records RETURN; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_csv_config_value(v_option_name varchar(100), v_value varchar(4000), v_version varchar(40)) returns void AS $procedure$ DECLARE v varchar[]; e varchar; v_result varchar; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(option_value, ',') from vdc_options where option_name = v_option_name and version = v_version; FOR e in select unnest(v) LOOP IF (e != v_value) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; UPDATE vdc_options set option_value = v_result where option_name = v_option_name and version = v_version; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_remove_uuid_from_csv(v_csv_text text, v_uuid uuid) returns text STABLE AS $procedure$ DECLARE v uuid[]; e uuid; v_result text; v_sep varchar(1); BEGIN v_result := ''; v_sep := ''; v := string_to_array(v_csv_text, ','); FOR e in select unnest(v) LOOP IF (e != v_uuid) THEN v_result := v_result || v_sep || e; v_sep := ','; END IF; END LOOP; IF (v_result = '') THEN v_result := null; END IF; return v_result; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_add_object_column_white_list_table() RETURNS void AS $function$ BEGIN -- This table holds the column white list per object IF EXISTS (SELECT * FROM pg_tables WHERE tablename ILIKE 'object_column_white_list') THEN truncate table object_column_white_list; ELSE CREATE TABLE object_column_white_list ( object_name varchar(128) NOT NULL, column_name varchar(128) NOT NULL, CONSTRAINT pk_object_column_white_list PRIMARY KEY(object_name,column_name) ) WITH OIDS; END IF; -- this table holds generated sql per object and is truncated upon upgrade to reflect schema changes IF EXISTS (SELECT * FROM pg_tables WHERE tablename ILIKE 'object_column_white_list_sql') THEN truncate table object_column_white_list_sql; ELSE CREATE TABLE object_column_white_list_sql ( object_name varchar(128) NOT NULL, sql text NOT NULL, CONSTRAINT pk_object_column_white_list_sql PRIMARY KEY(object_name) ) WITH OIDS; END IF; ----------------------------------- -- Initial white list settings --- ----------------------------------- -- vds view ----------------------------------- -- A new added column will not be displayed for the user unless added specifically. insert into object_column_white_list(object_name,column_name) (select 'vds', column_name from information_schema.columns where table_schema = 'public' and table_name = 'vds' and column_name in ( 'vds_group_id', 'vds_group_name', 'vds_group_description', 'vds_id', 'vds_name', 'ip', 'vds_unique_id', 'host_name', 'port', 'vds_strength', 'server_ssl_enabled', 'vds_type', 'pm_enabled', 'pm_proxy_preferences', 'vds_spm_priority', 'hooks', 'status', 'cpu_cores', 'cpu_model', 'cpu_speed_mh', 'if_total_speed', 'kvm_enabled', 'physical_mem_mb', 'pending_vcpus_count', 'pending_vmem_size', 'mem_commited', 'vm_active', 'vm_count', 'vm_migrating', 'incoming_migrations', 'outgoing_migrations', 'vms_cores_count', 'cpu_over_commit_time_stamp', 'hypervisor_type', 'net_config_dirty', 'max_vds_memory_over_commit', 'storage_pool_id', 'storage_pool_name', 'reserved_mem', 'guest_overhead', 'software_version', 'version_name', 'build_name', 'previous_status', 'cpu_idle', 'cpu_load', 'cpu_sys', 'cpu_user', 'usage_mem_percent', 'usage_cpu_percent', 'usage_network_percent', 'mem_available', 'mem_shared', 'swap_free', 'swap_total', 'ksm_cpu_percent', 'ksm_pages', 'ksm_state', 'cpu_flags', 'vds_group_cpu_name', 'cpu_sockets', 'vds_spm_id', 'otp_validity', 'spm_status', 'supported_cluster_levels', 'supported_engines', 'vds_group_compatibility_version', 'vds_group_virt_service', 'vds_group_gluster_service', 'host_os', 'kvm_version', 'libvirt_version', 'spice_version', 'kernel_version', 'iscsi_initiator_name', 'transparent_hugepages_state', 'anonymous_hugepages', 'non_operational_reason', 'recoverable', 'sshkeyfingerprint', 'count_threads_as_cores', 'cpu_threads', 'hw_manufacturer', 'hw_product_name', 'hw_version', 'hw_serial_number', 'hw_uuid', 'hw_family', 'ssh_port', 'ssh_username', 'boot_time', 'pm_detect_kdump', 'protocol')); -- pm_options are missing END; $function$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SELECT * FROM __temp_add_object_column_white_list_table(); ************************** ********* QUERY ********** DROP FUNCTION __temp_add_object_column_white_list_table(); ************************** DROP FUNCTION ********* QUERY ********** select fn_db_add_column_to_object_white_list('vds', 'selinux_enforce_mode'); ************************** ********* QUERY ********** select fn_db_add_column_to_object_white_list('vds', 'auto_numa_balancing'); ************************** ********* QUERY ********** select fn_db_add_column_to_object_white_list('vds', 'is_numa_supported'); ************************** ********* QUERY ********** select fn_db_add_column_to_object_white_list('vds', 'is_live_snapshot_supported'); ************************** ********* QUERY ********** select fn_db_add_column_to_object_white_list('vds', 'protocol'); ************************** ********* QUERY ********** select fn_db_add_column_to_object_white_list('vds', 'supported_emulated_machines'); ************************** ********* QUERY ********** /****************************************************************************************************** Snapshot Materialized Views Definitions Section ******************************************************************************************************/ /****************************************************************************************************** Snapshot Materialized Views Index Definitions Section ******************************************************************************************************/ /****************************************************************************************************** If your Snapshot Materialized View is my_mt you should create Stored Procedures: MtDropmy_mtIndexes - Drops indexes on my_mt MtCreatemy_mtIndexes - Creates needed indexes on my_mt ******************************************************************************************************/ ************************** ********* QUERY ********** CREATE OR REPLACE FUNCTION __temp_set_default_cluster_for_registration() RETURNS void AS $BODY$ BEGIN IF EXISTS (select 1 from vds_groups where name ilike 'Default') THEN update vdc_options set option_value = (select vds_group_id from vds_groups where name ilike 'Default') where option_name = 'AutoRegistrationDefaultVdsGroupID' and version = 'general'; ELSE -- Default cluster name was changed from 'Default' to something else -- taking the first cluster we found as default update vdc_options set option_value = (select vds_group_id from vds_groups LIMIT 1) where option_name = 'AutoRegistrationDefaultVdsGroupID' and version = 'general'; END IF; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select __temp_set_default_cluster_for_registration(); ************************** ********* QUERY ********** drop function __temp_set_default_cluster_for_registration(); ************************** DROP FUNCTION ********* QUERY ********** select RefreshAllMaterializedViews(true); ************************** ********* QUERY ********** ************************** 2016-07-12 18:25:42 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.executeRaw:878 execute-result: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'], rc=0 2016-07-12 18:25:42 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:936 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'] stdout: Creating schema engine@localhost:5432/engine Creating fresh schema Creating tables... Creating functions... Creating common functions... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00000_insert_schema_version.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00200_insert_ad_groups.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00300_insert_storage_pool.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00340_insert_policy_units.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00350_insert_cluster_policies.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00360_insert_cluster_policy_units.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00400_insert_vds_groups.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00500_insert_roles.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00600_insert_permissions.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00700_insert_roles_groups.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00800_insert_images.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/00900_insert_network.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01000_insert_network_cluster.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01100_insert_vm_static.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01200_insert_vm_device.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01300_insert_vm_ovf_generations.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01400_insert_action_version_map.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01500_insert_event_map.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01600_insert_dwh_history_timekeeping.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01700_insert_gluster_service_types.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01800_insert_gluster_services.sql ... Inserting data from /usr/share/ovirt-engine/dbscripts/data/01900_insert_vnic_profiles.sql ... Saving custom users permissions on database objects... upgrade script detected a change in Config, View or Stored Procedure... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade/0000_config.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade/0010_custom.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade/0020_add_materialized_views_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade/0030_materialized_views_extensions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/pre_upgrade/0040_extend_installed_by_column.sql'... Dropping materialized views... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0010_add_instance_type_to_vm.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0020_add_instance_permissions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0030_add_ha_score_to_vds_statistics.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0040_add_ha_policy_units.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0050_move_rename_of_other_linux_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0060_add_snapshot_id_column_to_vm_device.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0070_index_network_by_external_id.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0080_add_brick_status_change_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0090_move_quota_id.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0100_add_cluster_host_permissions_to_gluster_admin_role.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0110_change_policy_names.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0120_add_gluster_version_to_vds_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0130_add_start_time_idx_job.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0140_add_sso_method_to_vm_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0150_gluster_async_tasks_finished_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0160_create_read_only_admin_role.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0170_add_architecture_name_column.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0180_add_vds_group_optimization_field.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0190_gluster_async_tasks_stop_remove-brick_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0200_gluster_async_tasks_fromcli_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0210_replace_storage_type_all_with_unknown.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0220_add_console_events.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0230_vm_down_error_and_vds_initiated_run_fail_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0240_gluster_async_tasks_notfound_fromcli_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0250_rename_user_and_group_status_to_active.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0260_add_external_id_to_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0270_add_task_id_idx_gluster_bricks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0280_add_original_template_to_vm_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0290_add_spice_proxy_to_vds_groups_and_vm_pools.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0300_add_label_column_to_networks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0310_add_labels_column_to_vds_interfaces.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0320_move_anonymousHugePages.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0330_add_admin_operations_action_groups_and_roles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0340_add_network_labels_action_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0350_relax_network_qos_constraints.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0360_add_qos_id_to_network.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0370_add_qos_overridden_to_vds_interface.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0380_add_last_stop_time_to_vm_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0390_add_ha_reservation.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0400_add_var_on_dwh_status.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0410_add_even_guest_distribution_policy.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0420_add_vds_pm_flags.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0430_add_power_management_to_cluster_policy.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0440_create_affinity_group_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0450_add_affinity_group_action_group.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0460_add_affinity_group_filter_and_weight.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0470_add_reboot_command.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0480_add_vm_migration_downtime.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0490_add_enable_ksm_to_vds_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0500_add_iscsi_bond.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0510_set_proxy_preferences_default.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0520_add_tables_for_gluster_volume_and_brick_details.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0530_gluster_refresh_gluster_volume_details-event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0540_remove_storage_pool_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0550_add_template_version_to_vm_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0560_add_vm_init_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0570_add_all_basic_filters_to_even_guest_policy.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0580_add_restart_different_host_event.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0590_change_storage_server_connections_password_length.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0600_add_current_cd_to_vm_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0610_map_vds_detected_to_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0620_remove_directory_suffix_from_login_name.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0630_fix_admin_internal_permissions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_04_0640_fix_even_guest_distribution_parameters.sql'... Skipping upgrade script /usr/share/ovirt-engine/dbscripts/upgrade/03_05_0010_add_tables_for_gluster_volume_and_brick_details.sql, already installed by 03040520 Skipping upgrade script /usr/share/ovirt-engine/dbscripts/upgrade/03_05_0020_gluster_refresh_gluster_volume_details-event_map.sql, already installed by 03040530 Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0030_add_ha_columns_to_vds_statistics.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0040_add_ha_maintenance_events.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0050_event_notification_methods.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0060_event_map_vds_failure.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0070_fix_event_notfication_method.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0080_add_missing_manipulate_users_permissions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0090_delete_network_labels_action_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0100_allow_values_higher_9_for_cpuovercommit.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0110_add_vm_serial_number_policy.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0120_add_storage_domain_ovf.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0130_add_ovf_data_column.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0140_add_install_vds_upgrade_ovirt_node_action_group.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0150_remove_import_export_permission_from_user_instance_manager_role.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0160_add_host_interface_high_network_use_event.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0170_add_boot_time_to_vds_statistics.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0180_vm_init_add_sysprep_locale.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0190_vm_init_add_user_name.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0200_vm_init_add_active_directory_ou.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0210_change_group_ids.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0220_update_user_ids.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0230_add_host_interface_status_change_events.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0240_change_external_id_to_string.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0250_add_reason_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0260_add_exit_reason_to_vm_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0270_update_template_version_naming.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0280_add_vm_boot_menu.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0290_drop_vds_group_id_constraint_from_vm_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0300_add_host_kdump_detection.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0310_add_host_kdump_status.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0320_add_vds_interface_custom_properties.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0330_nullify_external_network_labels.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0340_add_migration_progress_percent_to_vm_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0350_add_display_network_change_events.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0360_add_audit_log_operation_action_group_and_roles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0370_add_base_interface_column_to_vds_interfaces.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0380_reintroduce_powersaving_variables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0390_add_guest_cpu_count_to_vm_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0400_index_for_snapshot_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0410_add_selinux_to_vds_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0420_generalize_messaging_broker_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0430_add_numa_tables_and_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0440_add_create_and_update_dates_to_users_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0450_set_default_value_for_numa_tune_mode.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0460_set_display_migration_cluster_network.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0470_update_vm_static_child_count.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0480_add_org_name_for_sysprep.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0490_remove_duplicate_smartcards.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0500_add_rng_device_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0510_unregistered_ovf_of_entities.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0520_fix_description_of_balancing_policy_units.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0530_remove_unused_event.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0540_add_spice_transfer_toggle.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0550_add_live_snapshot_support.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0560_aaa_add_namespace.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0570_deprecate_broken_snapshots.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0580_add_default_instance_types.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0590_set_default_time_zone.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0600_drop_images_fk.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0610_add_command_entity_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0620_lowercase_default_cluster_policies_names.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0630_add_host_protocol.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0640_add_external_variable.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0650_add_vds_kdump_status.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0660_remove_command_from_async_tasks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0670_add_cmd_entity_callback_enabled.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0680_add_cmd_entity_callback_notified.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0690_add_cmd_entity_return_value.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0700_create_vm_jobs_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0710_add_manipulate_permissions_for_template_admin.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0720_index_for_stoarge_domain_id_in_unregistered_ovf_of_entities.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0730_drop_disk_image_dynamic_fk.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0740_min_allocated_memory_on_instance_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_05_0750_delete_orphand_disk_image_dynamic_records.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0010_update_haswell_vds_to_new_name.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0020_add_job_step_ids_to_command_entities.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0030_set_name_for_internal_user.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0040_modify_default_value_of_numa_tune_mode.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0050_update_blank_template_origin_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0060_add_executed_to_command_entities.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0070_update_sgio_for_readonly_disks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0080_reset_rng_sources.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0090_add_mac_pool_ranges_to_storage_pool.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0100_add_provider_host_id_vdsstatic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0110_add_permissions_to_mac_pools.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0120_skip_fencing_when_sd_is_alive.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0130_add_live_merge_supported.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0140_rename_async_tasks_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0150_clear_address_for_unplugged_disks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0160_add_dwh_hostname_and_uuid.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0170_add_qos_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0180_add_disk_profiles_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0190_add_disk_profile_action_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0200_remove_active_column_from_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0210_skip_fencing_when_connectivity_broken.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0220_add_history_data_to_vm_statistics.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0230_disable_fencing_in_cluster.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0240_update_disk_bootable_shareable.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0250_disk_profile_for_disk_image.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0260_remove_external_network_labels.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0270_convert_cow_preallocated_to_cow_sparse.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0280_add_cpu_limit_to_qos_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0290_add_cpu_profiles_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0300_add_cpu_profile_id_to_vm_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0310_change_virtio_serial_to_managed_device.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0320_remove_blank_template_cpu_profile.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0330_refactor_network_qos.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0340_add_vds_activate_manual_ha_to_event_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0350_async_tasks_add_root_command_id.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0360_remove_install_vds_upgrade_ovirt_node_action_group.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0370_gluster_georep_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0380_set_time_drift_validation.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0390_add_logical_name_to_vm_device.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0400_clear_numa_node_distance.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0410_move_cpu_over_commit_to_vds_stats.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0420_set_interleave_default_value_for_numa_tune_mode.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0430_add_migrate_to_server_failed_event.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0440_create_index_on_images.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0450_create_index_on_vm_device.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0460_remove_vm_init_for_blank_template.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0470_medium_instance_type_has_two_cpus.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0480_add_idx_gluster_georep_slavevolname.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0490_create_default_disk_profiles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0500_add_user_id_to_async_tasks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0510_add_online_cpu_list.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0520_add_vm_auto_convergence.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0530_add_foreign_keys_to_async_tasks_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0540_add_cluster_parameters_override_to_vm.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0550_add_cluster_parameters_override_policy_unit.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0560_add_host_network_qos_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0570_revert_async_tasks_fk.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0580_insert_granular_vm_roles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0590_add_graphics_info_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0600_fix_external_events_role_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0610_fix_admin_internal_constant_sync.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0620_create_fence_agents_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0630_add_wipe_after_delete_to_storage_domain_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0640_add_migration_policy_unit.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0650_add_authentication_url.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0660_add_index_image_storage_domain_map.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0670_add_engine_sessions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0680_remove_groups_roles_from_users.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0690_render_event_map_optional.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0700_move_hibernation_volumes_to_active_snapshots.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0710_remove_deprecated_display_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0720_adjust_default_display_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0730_adjust_blank_template_video_card.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0740_add_guest_agent_status_to_vm_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0750_attach_disk_profile_permission.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0760_add_gluster_volume_snapshot_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0770_add_vm_run_time_permissions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0780_qos_name_uniqueness.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0790_change_prepare_to_hibernate_to_up.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0800_add_LSM_action_group_id.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0810_insert_quartz_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0820_add_snapshot_count_to_gluster_volume.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0830_add_host_device_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0840_add_management_to_network_cluster.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0850_update_management_network_vdc_option.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0860_add_total_rx_tx_statistics.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0870_add_gluster_volume_snapshot_schedule_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0880_add_snapshot_scheduled_flag_to_gluster_volume.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0890_add_user_id_to_command_entities.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0900_add_gluster_config_master_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0910_insert_config_description.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0920_gluster_geo_rep_alter_config_value_column.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0930_add_delete_contraint_vm_interface_statistics.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0940_drop_vm_dynamic_guest_last_logxxx_time_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0950_add_idx_gluster_georep_slavehostname.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0960_add_storage_device_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0970_add_maintenance_reason_to_vds_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0980_add_maintenance_reason_required_to_vds_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_0990_georep_drop_constraint_config_key.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1000_add_disperse_and_redundancy_count_to_gluster_volume.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1010_add_in_out_migrations.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1020_add_vm_dynamic_guest_mem_cached_buffered.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1030_change_options_to_text.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1040_add_gluster_to_network_cluster.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1050_add_network_gluster_bricks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1060_add_alternateprobed_gluster_server.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1070_add_iface_column_to_host_device_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1080_add_passthrough_to_vnic_profiles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1090_decouple_blank_from_cluster.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1100_add_host_nic_vfs_config_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1110_add_vfs_config_networks_and_labels_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1120_add_creation_date_to_permissions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1130_add_disk_storage_type_column_to_base_disks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1140_add_cinder_volume_type_column_to_base_disks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1150_change_supported_emulated_machines_to_text.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1160_rename_blank_to_default.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1170_add_username_column_to_georep_session.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1180_add_user_profiles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1190_update_repo_file_metadata_size.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1200_set_third_party_storage_size_to_NA.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1210_add_vm_host_device_commands.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1220_change_lengthy_varchar_to_text_in_storage_device_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1230_add_backup_awareness.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1240_revert_03061210_add_vm_host_device_commands.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1250_add_is_brick_flag-to_storage_device_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1260_add_tuned_profile_column_to_vds_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1270_add_uses_scsi_reservation.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1280_fix_constraint_gluster_brick_network.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1290_add_index_on_status_to_vds_dynamic.sql'... Skipping upgrade script /usr/share/ovirt-engine/dbscripts/upgrade/03_06_1300_again_add_vm_host_device_commands.sql, already installed by 03061210 Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1310_add_vm_icons_vm_icon_defaults_tables.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1320_attach_edit_userprofile_permission.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1330_backup_extensions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1340_change_vm_device_column_length.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1350_add_cmd_associated_entities_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1360_add_updates_available_to_vds_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1370_add_thresholds_to_storage_domain_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1380_index_audit_log_by_gluster_volume_id.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1390_add_cluster_features_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1400_add_provider_id_to_vms.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1410_alter_georep_session_details.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1420_add_memory_balancing_vars.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1430_add_num_of_io_threads_to_vm_static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1440_fix_bool_fence_agents_options.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1450_add_vm_static_console_disconnect_action.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1460_add_network_attachment.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1470_vmdynamic_add_timezone_and_guestosinfo.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1480_change_guest_mem_free_to_bigint.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1490_update_lastSync_in_dwh_history_timekeeping.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1500_add_column_volume_classification.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1510_add_host_external_status.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1520_add_brickInfo_audit_log_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1530_add_host_passthrough_flag.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1540_libvirt_secrets.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1550_insert_and_update_config_description.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1560_add_spec_param_to_console_devices.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1570_add_sd_external_status.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1580_add_gluster_cli_based_snapshot_scheduled_column_to_vds_groups.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1590_add_host_device_policy_unit.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1600_add_ksm_with_numa_awareness.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1610_unique_vds_id_name_vds_interface.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1620_add_domain_import_export_permissions_for_admins.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1630_update_config_option.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1640_change_storage_connections_user_name_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1650_add_additional_properties_to_providers.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1660_multiple_preferred_hosts_as_text.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1670_unique_vds_id_network_name_vds_interface.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1680_do_not_reference_network_boot_protocol_enum_with_numbers.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1690_add_librbd1_version_to_vds_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1700_reintoduce_async_tasks_fk.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1710_add_login_export_import_admin.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1720_vm_pools_add_is_being_destroyed.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1730_rename_vdcfault_to_enginefault.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1740_revert_async_tasks_fk.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1750_pinning_to_multiple_hosts_connection_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1760_host_sshfingerprint.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1770_change_vds_dynamic_hooks_to_text.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1780_create_storage_server_connection_extension_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1790_add_glusterfs_cli_version_to_vds_dynamic.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1800_remove_power8e_cpu_type.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1810_add_ssh_public_key_id_to_user_profiles_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1820_fix_display_type_numbers.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1830_add_configure_mac_pool_role_to_data_center_admin.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1840_remove_deprecated_vdc_options.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1850_remove_custom_properties_from_vds_interface.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1860_add_type_spec_param_to_console_devices.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1870_delete_deprecated_config_values.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1880_add_index_to_fk_columns.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1890_bump_cluster_machine_type_to_72.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1900_add_connect_to_serial_console_action_group.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1910_remove_deprecated_config_value.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1920_set_mgmt_network_in_network_cluster.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1930_change_cpu_name_ibm_power_8.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1940_index_base_disks.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1950_enable_ballon_for_blank_template.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1960_add_vm_static_threads_per_cpu.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1970_add_cmd_entity_parent_command_id.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1980_fix_invalid_macs.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_1990_chance_min_allocated_mem_of_blank.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2000_fix_migratedowntime_option.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2010_add_profile_perms_to_import_export.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2020_add_cpu_pinning_filter.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2030-add-index-on-origin-in-vm-static.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2040_attach_cpu_profile_permissions.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2050_create_index_cpu_profiles.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2060_set_timezone_priority_for_he.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2070_add_in_cluster_upgrade_policy_units.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2080_add_in_cluster_upgrade_policy.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2090_add_attach_disk_profile_permissions_to_power_user_role.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2100_add_index_event_notification_hist.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/03_06_2110_add_host_device_is_assignable.sql'... Creating views... Creating stored procedures... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/action_version_map_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/ad_groups_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/affinity_groups_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/all_disks_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/async_tasks_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/audit_log_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/base_disks_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/bookmarks_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/business_entity_snapshot_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/cluster_features_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/cluster_policy_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/command_entities_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/common_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/cpu_profiles_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/custom_actions_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/disk_image_dynamic_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/disk_images_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/disk_lun_map_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/disk_profiles_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/dwh_history_timekeeping_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/dwh_translation_tables_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/engine_backup_log_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/engine_sessions_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/event_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/external_variable_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/fence_agents_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_georep_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_hooks_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_server_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_services_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_volume_snapshot_schedule_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_volume_snapshot_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/gluster_volumes_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/host_device_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/images_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/image_storage_domain_map_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/inst_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/iscsi_bonds_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/job_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/libvirt_secrets_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/mac_pools_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/materialized_views_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/multi_level_administration_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/network_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/numa_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/policy_unit_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/providers_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/qos_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/quota_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/repo_files_meta_data_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/snapshots_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/storage_device_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/storages_san_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/storages_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/system_statistics_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/tags_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/tags_vm_pool_map_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/unregistered_OVF_data_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/user_profiles_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/user_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vdc_option_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vds_groups_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vds_kdump_status_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vds_spm_id_map_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vds_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vm_device_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vm_icons_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vm_jobs_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vm_pool_maps_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vm_pools_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vms_sp.sql... Creating stored procedures from /usr/share/ovirt-engine/dbscripts/vm_templates_sp.sql... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade/0010_add_object_column_white_list_table.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade/0020_create_materialized_views.sql'... Running upgrade sql script '/usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade/0030_set_default_cluster_for_registration.sql'... Refreshing materialized views... Applying custom users permissions on database objects... 2016-07-12 18:25:42 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:941 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'] stderr: 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.db.connection.Plugin._connection 2016-07-12 18:25:42 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:25:42 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/connection=connection:'' 2016-07-12 18:25:42 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/statement=Statement:'' 2016-07-12 18:25:42 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.appmode.Plugin._misc 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select version, option_value from vdc_options where option_name = %(name)s ', args: {'name': 'AutoRegistrationDefaultVdsGroupID'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'version': 'general', 'option_value': '00000002-0002-0002-0002-0000000003df'}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select inst_update_service_type( %(clusterId)s, %(virt)s, %(gluster)s ) ', args: {'virt': True, 'clusterId': '00000002-0002-0002-0002-0000000003df', 'gluster': False} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'inst_update_service_type': ''}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select fn_db_update_config_value( 'ApplicationMode', %(mode)s, 'general' ) ', args: {'mode': '1'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'fn_db_update_config_value': ''}] 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.domain_type.Plugin._misc 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select inst_update_default_storage_pool_type (%(is_local)s) ', args: {'is_local': False} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'inst_update_default_storage_pool_type': ''}] 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.iso_domain.Plugin._add_iso_domain_to_db 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.options.Plugin._miscAlways 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'ProductRPMVersion'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'ProductRPMVersion', 'value': '3.6.6.2-0.1.el6'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.options.Plugin._miscNewDatabase 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'SSLEnabled'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'SSLEnabled', 'value': 'true'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'EncryptHostCommunication'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'EncryptHostCommunication', 'value': 'true'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'EncryptHostCommunication'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'EncryptHostCommunication', 'value': 'true'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'ConfigDir'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'ConfigDir', 'value': '/etc/ovirt-engine'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'DataDir'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'DataDir', 'value': '/usr/share'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'WebSocketProxy'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'WebSocketProxy', 'value': 'rhev.lab.localdomain:6100'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.public_glance_repository.Plugin._misc 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.storage.Plugin._updateSANWipeAfterDelete 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'SANWipeAfterDelete'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'SANWipeAfterDelete', 'value': 'false'} 2016-07-12 18:25:42 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:25:42 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._misc 2016-07-12 18:25:42 INFO otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc aaajdbc._setupSchema:97 Creating/refreshing Engine 'internal' domain database schema 2016-07-12 18:25:42 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:828 execute: ['/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-e', 'aaa_jdbc', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'], executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'DBFUNC_DB_PGPASSFILE': '/tmp/tmpmJJtRQ', 'previous': 'N'} ********* QUERY ********** select 1; ************************** 1 ********* QUERY ********** copy ( SELECT COUNT(schema_name) FROM information_schema.schemata WHERE schema_name = 'aaa_jdbc' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** CREATE SCHEMA aaa_jdbc AUTHORIZATION engine; ************************** CREATE SCHEMA ********* QUERY ********** copy ( select count(*) as count from pg_catalog.pg_tables where tablename = 'schema_version' and schemaname = 'aaa_jdbc' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select count(*) from pg_language where lanname='plpgsql' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** ALTER DATABASE "engine" SET client_min_messages=ERROR; ************************** ALTER DATABASE ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** CREATE SEQUENCE schema_version_seq; ************************** CREATE SEQUENCE ********* QUERY ********** CREATE TABLE schema_version ( id integer DEFAULT nextval('schema_version_seq'::regclass) NOT NULL, version character varying(10) NOT NULL, script character varying(255) NOT NULL, checksum character varying(128), installed_by character varying(63), started_at timestamp without time zone DEFAULT now(), ended_at timestamp without time zone, state character varying(15) NOT NULL, current boolean NOT NULL, comment text DEFAULT ''::text, PRIMARY KEY(id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE settings( id SERIAL, uuid VARCHAR(512) UNIQUE NOT NULL, name VARCHAR(512) NOT NULL, description TEXT NOT NULL, value VARCHAR(1024) NOT NULL, PRIMARY KEY(id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE users( id SERIAL, uuid VARCHAR(512) UNIQUE NOT NULL, name VARCHAR(512) UNIQUE NOT NULL, password VARCHAR(1024) NOT NULL, password_valid_to TIMESTAMP NOT NULL, login_allowed VARCHAR(1024) NOT NULL, nopasswd INTEGER NOT NULL, disabled INTEGER NOT NULL, unlock_time TIMESTAMP NOT NULL, last_successful_login TIMESTAMP NOT NULL, last_unsuccessful_login TIMESTAMP NOT NULL, consecutive_failures INTEGER NOT NULL, valid_from TIMESTAMP NOT NULL, valid_to TIMESTAMP NOT NULL, PRIMARY KEY(id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE user_password_history( id SERIAL, user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, password VARCHAR(1024) NOT NULL, changed TIMESTAMP NOT NULL, PRIMARY KEY(id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE user_attributes( id SERIAL, user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, name VARCHAR(512) NOT NULL, value VARCHAR(1024) NOT NULL, PRIMARY KEY(id), UNIQUE (user_id,name) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE failed_logins( id SERIAL, user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, minute_start TIMESTAMP NOT NULL, count INTEGER NOT NULL, PRIMARY KEY(id), UNIQUE (user_id,minute_start) ); ************************** CREATE TABLE ********* QUERY ********** CREATE INDEX failed_logins_index ON failed_logins (minute_start); ************************** CREATE INDEX ********* QUERY ********** CREATE TABLE groups( id SERIAL, name VARCHAR(512) UNIQUE NOT NULL, uuid VARCHAR(512) UNIQUE NOT NULL, PRIMARY KEY(id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE group_attributes( id SERIAL, group_id INTEGER NOT NULL REFERENCES groups(id) ON DELETE CASCADE, name VARCHAR(512) NOT NULL, value VARCHAR(1024) NOT NULL, PRIMARY KEY(id), UNIQUE (group_id,name) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE user_groups( id SERIAL, user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, in_group_id INTEGER NOT NULL REFERENCES groups(id), PRIMARY KEY(id), UNIQUE(user_id, in_group_id) ); ************************** CREATE TABLE ********* QUERY ********** CREATE TABLE group_groups( id SERIAL, group_id INTEGER NOT NULL REFERENCES groups(id) ON DELETE CASCADE, in_group_id INTEGER NOT NULL REFERENCES groups(id), PRIMARY KEY(id), UNIQUE(group_id,in_group_id) ); ************************** CREATE TABLE ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'aaa_jdbc' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'aaa_jdbc' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'aaa_jdbc' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_schema || '.' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'aaa_jdbc' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'aaa_jdbc' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and table_schema = 'aaa_jdbc' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'aaa_jdbc' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** INSERT INTO schema_version(version,script,checksum,installed_by,ended_at,state,current) values ('01000000','upgrade/01_00_0000_set_version.sql','0','engine',now(),'INSTALLED',true); ************************** INSERT 0 1 ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** INSERT INTO settings(uuid, name, value, description) VALUES ('bb90c43c-45cb-4af9-8c3e-4f6dee6ba60b', 'MAX_LOGIN_MINUTES', 60 * 24 * 7, 'session global maximum in minutes. -1 = no limit \n actual value subject to user validity and user allowed hours'), ('0ae5affd-15e5-4bb1-9910-f091b64b7197', 'PRESENT_WELCOME_MESSAGE', FALSE, 'present traditional unix welcome message'), ('df496823-6814-4720-a302-c723f629f847', 'MESSAGE_OF_THE_DAY', '', 'message for all users'), ('ecf6d62a-10f8-4fad-b401-75c9d0788955', 'MESSAGE_SEPARATOR', '\n', ''), ('1a496c2f-02d7-4057-bfeb-23019d3941ae', 'MINIMUM_RESPONSE_SECONDS', 5, 'never respond to authentication requests in less then X seconds'), ('d9fce842-1906-40c0-b8d0-f01d2454623b', 'MAX_FAILURES_PER_MINUTE', 20, 'allow only X bad attempts in a minute. does not lock'), ('d03f5b67-5dca-4730-b1ac-01a6e8f31f25', 'MAX_FAILURES_SINCE_SUCCESS', 5, 'lock after X consecutive failures'), ('3b1e221c-21d2-45c9-95c5-2f71deec3b9f', 'MAX_FAILURES_PER_INTERVAL', 20, 'lock after X failures in interval. see INTERVAL_HOURS'), ('756f2a73-be20-4103-b82f-f41dae35f8bf', 'INTERVAL_HOURS', 24, 'determines the number of hours constituting an interval. see MAX_FAILURES_PER_INTERVAL'), ('78b5138a-d52b-464d-a2a7-5fed55bdf7b3', 'LOCK_MINUTES', 60, 'lock for X minutes'), ('8669297e-cfd7-45e3-80cd-a464c90694d7', 'PBE_ALGORITHM', 'PBKDF2WithHmacSHA1', 'Algorithm name. see http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html'), ('fa528912-4f3a-4c3a-8e93-561e92d785e8', 'PBE_ITERATIONS', 2000, 'Iterations'), ('8aa785db-bd8e-4ddd-9590-185b8a870f6f', 'PBE_KEY_SIZE', 256, 'Key Size'), ('dc3e2fb4-cbcc-4f5c-9b06-5db9ec534aa8','PASSWORD_EXPIRATION_DAYS', 180, 'upon expired password change, new password is valid to X days'), ('69d5cec2-bd1a-42e1-84f0-05627ee476b3','PASSWORD_EXPIRATION_NOTICE_DAYS', 0, 'show message X days before expiration'), ('e843bc2a-0878-4b6f-9be3-32e83169fb7c', 'PASSWORD_HISTORY_LIMIT', 3, 'number of old passwords to keep/check against in password change'), ('aaa93f69-7b75-44ee-b8a7-4d4736e73be1', 'ALLOW_EXPIRED_PASSWORD_CHANGE', FALSE, 'if true when a password expires the user can change it'), ('b55243d1-27b5-49bf-8436-67d5ada33975', 'PASSWORD_COMPLEXITY', 'UPPERCASE:chars=ABCDEFGHIJKLMNOPQRSTUVWXYZ::min=-1::LOWERCASE:chars=abcdefghijklmnopqrstuvwxyz::min=-1::NUMBERS:chars=0123456789::min=-1::', 'complexity groups definition. format:\n[name:chars=x::min=y::...]\nmin=-1 no limit. following chars should be escaped: \\t, \\n, \\f, \\'', \\" \\\\'), ('24e7de2f-a714-4f3e-8f64-13bc6ee7525b', 'MIN_LENGTH', 6, 'passwords are at least X characters long'), ('8a077fb6-7271-4d79-a0b5-aa9a84384b69', 'MAX_PAGE_SIZE', 200, 'searches never return pages larger then X records'), ('fba813af-4c30-448f-8df9-9334449c149e', 'SETTINGS_INTERVAL_MINUTES', -1, 'attempt to refresh settings for settings table at most every X minutes. -1 = never'), ('d89abf58-f0ca-4be8-8ec3-45a1f3645c7b', 'HOUSE_KEEPING_INTERVAL_HOURS', 24, 'perform house keeping tasks every X hours. -1 = never'), ('12fb6fee-797b-47e7-83e1-1f1fd8b8dd05', 'FAILED_LOGINS_OLD_DAYS', 7, 'during house keeping, delete failed logins older then X days. -1 = never'); ************************** INSERT 0 23 ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** select 1000000; ************************** 1000000 ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'aaa_jdbc' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'aaa_jdbc' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'aaa_jdbc' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_schema || '.' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'aaa_jdbc' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'aaa_jdbc' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and table_schema = 'aaa_jdbc' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'aaa_jdbc' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select * from aaa_jdbc.generate_drop_all_views_syntax(); ************************** ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'aaa_jdbc' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'aaa_jdbc' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'aaa_jdbc' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_schema || '.' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'aaa_jdbc' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'aaa_jdbc' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and table_schema = 'aaa_jdbc' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'aaa_jdbc' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** select * from aaa_jdbc.generate_drop_all_functions_syntax(); ************************** drop function if exists aaa_jdbc.checkdbconnection() cascade; drop function if exists aaa_jdbc.fn_db_add_column(character varying, character varying, text) cascade; drop function if exists aaa_jdbc.fn_db_add_config_value_for_versions_up_to(character varying, character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_change_column_type(character varying, character varying, character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_create_constraint(character varying, character varying, text) cascade; drop function if exists aaa_jdbc.fn_db_create_index(character varying, character varying, text, text) cascade; drop function if exists aaa_jdbc.fn_db_drop_column(character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_drop_constraint(character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_is_table_exists(character varying) cascade; drop function if exists aaa_jdbc.fn_db_mask_object(regclass) cascade; drop function if exists aaa_jdbc.fn_db_rename_column(character varying, character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_get_column_size(character varying, character varying) cascade; drop function if exists aaa_jdbc.generate_drop_all_functions_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_seq_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_tables_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_user_types_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_views_syntax() cascade; ********* QUERY ********** drop function if exists aaa_jdbc.checkdbconnection() cascade; drop function if exists aaa_jdbc.fn_db_add_column(character varying, character varying, text) cascade; drop function if exists aaa_jdbc.fn_db_add_config_value_for_versions_up_to(character varying, character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_change_column_type(character varying, character varying, character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_create_constraint(character varying, character varying, text) cascade; drop function if exists aaa_jdbc.fn_db_create_index(character varying, character varying, text, text) cascade; drop function if exists aaa_jdbc.fn_db_drop_column(character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_drop_constraint(character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_db_is_table_exists(character varying) cascade; drop function if exists aaa_jdbc.fn_db_mask_object(regclass) cascade; drop function if exists aaa_jdbc.fn_db_rename_column(character varying, character varying, character varying) cascade; drop function if exists aaa_jdbc.fn_get_column_size(character varying, character varying) cascade; drop function if exists aaa_jdbc.generate_drop_all_functions_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_seq_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_tables_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_user_types_syntax() cascade; drop function if exists aaa_jdbc.generate_drop_all_views_syntax() cascade; ************************** DROP FUNCTION ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'aaa_jdbc' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'aaa_jdbc' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'aaa_jdbc' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_schema || '.' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'aaa_jdbc' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'aaa_jdbc' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and table_schema = 'aaa_jdbc' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'aaa_jdbc' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** SELECT setval('schema_version_seq', max(id)) FROM schema_version; ************************** 1 ********* QUERY ********** copy ( select version from aaa_jdbc.schema_version where current = true order by id LIMIT 1 ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from aaa_jdbc.schema_version where checksum = 'b7abf53c6d3368d76f448b86570dd320' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** SELECT fn_db_change_column_type('users', 'password_valid_to', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('users', 'last_successful_login', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('users', 'last_unsuccessful_login', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('users', 'valid_from', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('users', 'valid_to', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('user_password_history', 'changed', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** SELECT fn_db_change_column_type('failed_logins', 'minute_start', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into aaa_jdbc.schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('01000010'), 'upgrade/01_00_0010_fix_timezone_handling.sql', 'b7abf53c6d3368d76f448b86570dd320', 'engine', cast(trim('2016-07-12 18:25:49.185313-04') as timestamp), cast(trim('2016-07-12 18:25:51.649529-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from aaa_jdbc.schema_version where checksum = 'b349ac385f0348e7c625c5da7662489c' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** SELECT fn_db_change_column_type('users', 'unlock_time', 'TIMESTAMP', 'TIMESTAMP WITH TIME ZONE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into aaa_jdbc.schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('01000020'), 'upgrade/01_00_0020_fix_timezone_handling_unlocktime.sql', 'b349ac385f0348e7c625c5da7662489c', 'engine', cast(trim('2016-07-12 18:25:51.689421-04') as timestamp), cast(trim('2016-07-12 18:25:52.132668-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from aaa_jdbc.schema_version where checksum = 'cd47efe776b5149526c9e6827e2fd717' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** CREATE OR REPLACE FUNCTION convert_password(old_password VARCHAR) RETURNS TEXT STABLE AS $BODY$ DECLARE _items TEXT[]; BEGIN _items := regexp_split_to_array(old_password, E'\\|+'); RETURN encode( convert_to( '{"artifact":"EnvelopePBE","salt":"' || _items[3] || '","secret":"' || _items[5] || '","version":"' || _items[1] || '","iterations":"' || _items[4] || '","algorithm":"' || _items[2] || '"}', current_setting('server_encoding') ), 'base64' ); END; $BODY$ LANGUAGE PLPGSQL; ************************** CREATE FUNCTION ********* QUERY ********** UPDATE users SET password = convert_password(password) WHERE password IS NOT NULL AND substring(password from 1 for 2) = '1|'; ************************** UPDATE 0 ********* QUERY ********** UPDATE user_password_history SET password = convert_password(password) WHERE password IS NOT NULL AND substring(password from 1 for 2) = '1|'; ************************** UPDATE 0 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into aaa_jdbc.schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('01000030'), 'upgrade/01_00_0030_sync_password_format.sql', 'cd47efe776b5149526c9e6827e2fd717', 'engine', cast(trim('2016-07-12 18:25:52.172509-04') as timestamp), cast(trim('2016-07-12 18:25:52.232633-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** copy ( select version from aaa_jdbc.schema_version where checksum = '4e001d6ecdf67b5bd275d30d43060564' and state = 'INSTALLED' ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** SELECT fn_db_drop_constraint('user_groups', 'user_groups_in_group_id_fkey'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('user_groups', 'user_groups_in_group_id_fkey', 'FOREIGN KEY (in_group_id) REFERENCES groups (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE'); ************************** ********* QUERY ********** SELECT fn_db_drop_constraint('group_groups', 'group_groups_in_group_id_fkey'); ************************** ********* QUERY ********** SELECT fn_db_create_constraint('group_groups', 'group_groups_in_group_id_fkey', 'FOREIGN KEY (in_group_id) REFERENCES groups (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE'); ************************** ********* QUERY ********** copy (select now()) to stdout with delimiter as '|'; ************************** ********* QUERY ********** insert into aaa_jdbc.schema_version( version, script, checksum, installed_by, started_at, ended_at, state, current, comment ) values ( trim('01000040'), 'upgrade/01_00_0040_on_delete_cascade_users_and_groups.sql', '4e001d6ecdf67b5bd275d30d43060564', 'engine', cast(trim('2016-07-12 18:25:52.272448-04') as timestamp), cast(trim('2016-07-12 18:25:52.406692-04') as timestamp), 'INSTALLED', false, '' ); ************************** INSERT 0 1 ********* QUERY ********** copy ( select max(id) from aaa_jdbc.schema_version where state in ('INSTALLED','SKIPPED') ) to stdout with delimiter as '|'; ************************** ********* QUERY ********** update aaa_jdbc.schema_version set current=(id=5); ************************** UPDATE 5 ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = '@SCHEMA_NAME@' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = '@SCHEMA_NAME@' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = '@SCHEMA_NAME@' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = '@SCHEMA_NAME@' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = '@SCHEMA_NAME@' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = '@SCHEMA_NAME@' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.views where table_schema = '@SCHEMA_NAME@' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.tables where table_schema = '@SCHEMA_NAME@' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_schema || '.' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = '@SCHEMA_NAME@' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = '@SCHEMA_NAME@' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = '@SCHEMA_NAME@' and table_name ilike v_table and column_name ilike v_column and table_schema = '@SCHEMA_NAME@' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = '@SCHEMA_NAME@' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** SET search_path TO aaa_jdbc; ************************** SET ********* QUERY ********** Create or replace FUNCTION fn_db_add_column(v_table varchar(128), v_column varchar(128), v_column_def text) returns void AS $procedure$ declare v_sql text; begin if (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' ADD COLUMN ' || v_column || ' ' || v_column_def; EXECUTE v_sql; end; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_drop_column(v_table varchar(128), v_column varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' DROP COLUMN ' || v_column; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; end;$procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_change_column_type(v_table varchar(128), v_column varchar(128), v_type varchar(128), v_new_type varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_type or data_type ilike v_type))) then begin v_sql := 'ALTER TABLE ' || v_table || ' ALTER COLUMN ' || v_column || ' TYPE ' || v_new_type; EXECUTE v_sql; end; --- ignore operation if requested type is already there elsif (not exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and (udt_name ilike v_new_type or data_type ilike v_new_type))) then RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_db_rename_column(v_table varchar(128), v_column varchar(128), v_new_name varchar(128)) returns void AS $procedure$ declare v_sql text; begin if (exists (select 1 from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column)) then begin v_sql := 'ALTER TABLE ' || v_table || ' RENAME COLUMN ' || v_column || ' TO ' || v_new_name; EXECUTE v_sql; end; else RAISE EXCEPTION 'Table % or Column % does not exist.', v_table, v_column; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_create_constraint ( v_table varchar(128), v_constraint varchar(128), v_constraint_sql text) returns void AS $procedure$ begin if NOT EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' ADD CONSTRAINT ' || v_constraint || ' ' || v_constraint_sql; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace function fn_db_drop_constraint ( v_table varchar(128), v_constraint varchar(128)) returns void AS $procedure$ begin if EXISTS (SELECT 1 from pg_constraint where conname ilike v_constraint) then execute 'ALTER TABLE ' || v_table || ' DROP CONSTRAINT ' || v_constraint || ' CASCADE'; end if; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION CheckDBConnection() RETURNS SETOF integer IMMUTABLE AS $procedure$ BEGIN RETURN QUERY SELECT 1; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_functions_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'drop function if exists ' || ns.nspname || '.' || proname || '(' || oidvectortypes(proargtypes) || ') cascade;' from pg_proc inner join pg_namespace ns on (pg_proc.pronamespace=ns.oid) where ns.nspname = 'aaa_jdbc' order by proname; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_views_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP VIEW if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.views where table_schema = 'aaa_jdbc' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_tables_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP TABLE if exists ' || table_schema || '.' || table_name || ' CASCADE;' from information_schema.tables where table_schema = 'aaa_jdbc' and table_type = 'BASE TABLE' order by table_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_seq_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY select 'DROP SEQUENCE if exists ' || sequence_schema || '.' || sequence_name || ' CASCADE;' from information_schema.sequences where sequence_schema = 'aaa_jdbc' order by sequence_name; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION generate_drop_all_user_types_syntax() RETURNS SETOF text STABLE AS $procedure$ BEGIN RETURN QUERY SELECT 'DROP TYPE if exists ' || c.relname::information_schema.sql_identifier || ' CASCADE;' FROM pg_namespace n, pg_class c, pg_type t WHERE n.oid = c.relnamespace and t.typrelid = c.oid and c.relkind = 'c'::"char" and n.nspname = 'aaa_jdbc' ORDER BY c.relname::information_schema.sql_identifier; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** Create or replace FUNCTION fn_get_column_size( v_table varchar(64), v_column varchar(64)) returns integer STABLE AS $procedure$ declare retvalue integer; BEGIN retvalue := character_maximum_length from information_schema.columns where table_schema = 'aaa_jdbc' and table_name ilike v_table and column_name ilike v_column and table_schema = 'aaa_jdbc' and udt_name in ('char','varchar'); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_mask_object(v_object regclass) RETURNS setof record as $BODY$ DECLARE v_sql TEXT; v_table record; v_table_name TEXT; temprec record; BEGIN -- get full table/view name from v_object (i.e .) select c.relname, n.nspname INTO v_table FROM pg_class c join pg_namespace n on c.relnamespace = n.oid WHERE c.oid = v_object; -- try to get filtered query syntax from previous execution if exists (select 1 from object_column_white_list_sql where object_name = v_table.relname) then select sql into v_sql from object_column_white_list_sql where object_name = v_table.relname; else v_table_name := quote_ident( v_table.nspname ) || '.' || quote_ident( v_table.relname ); -- compose sql statement while skipping values for columns not defined in object_column_white_list for this table. for temprec in select a.attname, t.typname FROM pg_attribute a join pg_type t on a.atttypid = t.oid WHERE a.attrelid = v_object AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum loop v_sql := coalesce( v_sql || ', ', 'SELECT ' ); if exists(select 1 from object_column_white_list where object_name = v_table.relname and column_name = temprec.attname) then v_sql := v_sql || quote_ident( temprec.attname ); ELSE v_sql := v_sql || 'NULL::' || quote_ident( temprec.typname ) || ' as ' || quote_ident( temprec.attname ); END IF; END LOOP; v_sql := v_sql || ' FROM ' || v_table_name; v_sql := 'SELECT x::' || v_table_name || ' as rec FROM (' || v_sql || ') as x'; -- save generated query for further use insert into object_column_white_list_sql(object_name,sql) values (v_table.relname, v_sql); end if; RETURN QUERY EXECUTE v_sql; END; $BODY$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** CREATE OR REPLACE FUNCTION fn_db_is_table_exists (v_table varchar(64)) returns boolean STABLE AS $procedure$ declare retvalue boolean; BEGIN retvalue := EXISTS ( SELECT * FROM information_schema.tables WHERE table_schema = 'aaa_jdbc' AND table_name ILIKE v_table ); return retvalue; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_create_index(v_index_name varchar(128), v_table_name varchar(128), v_column_names text, v_where_predicate text) returns void AS $procedure$ DECLARE v_sql TEXT; BEGIN v_sql := 'DROP INDEX ' || ' IF EXISTS ' || v_index_name || '; CREATE INDEX ' || v_index_name || ' ON ' || v_table_name || '(' || v_column_names || ')'; IF v_where_predicate = '' THEN v_sql := v_sql || ';'; ELSE v_sql := v_sql || ' WHERE ' || v_where_predicate || ';'; END IF; EXECUTE v_sql; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** create or replace FUNCTION fn_db_add_config_value_for_versions_up_to(v_option_name varchar(100), v_val varchar(4000), v_version varchar(40)) returns void AS $procedure$ declare i int; arr varchar[] := array['3.0', '3.1', '3.2', '3.3', '3.4', '3.5', '3.6']; begin FOR i IN array_lower(arr, 1) .. array_upper(arr, 1) LOOP PERFORM fn_db_add_config_value(v_option_name, v_val, arr[i]); EXIT WHEN arr[i] = v_version; END LOOP; END; $procedure$ LANGUAGE plpgsql; ************************** CREATE FUNCTION ********* QUERY ********** ************************** 2016-07-12 18:25:53 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:878 execute-result: ['/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-e', 'aaa_jdbc', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'], rc=0 2016-07-12 18:25:53 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:936 execute-output: ['/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-e', 'aaa_jdbc', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'] stdout: Creating custom schema aaa_jdbc ... Creating schema aaa_jdbc in engine@localhost:5432/engine Creating fresh schema Creating tables... Creating functions... Creating common functions... Inserting data from /usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/data/00000_insert_schema_version.sql ... Inserting data from /usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/data/00100_insert_default_settings.sql ... Saving custom users permissions on database objects... upgrade script detected a change in Config, View or Stored Procedure... Running upgrade sql script '/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/upgrade/01_00_0010_fix_timezone_handling.sql'... Running upgrade sql script '/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/upgrade/01_00_0020_fix_timezone_handling_unlocktime.sql'... Running upgrade sql script '/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/upgrade/01_00_0030_sync_password_format.sql'... Running upgrade sql script '/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/upgrade/01_00_0040_on_delete_cascade_users_and_groups.sql'... Creating stored procedures... Creating stored procedures from /usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/common_sp.sql... Applying custom users permissions on database objects... 2016-07-12 18:25:53 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:941 execute-output: ['/usr/share/ovirt-engine-extension-aaa-jdbc/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine', '-d', 'engine', '-e', 'aaa_jdbc', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', '-c', 'apply'] stderr: 2016-07-12 18:25:53 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/aaa/internal.properties'' 2016-07-12 18:25:53 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/aaa/internal.properties' missing 2016-07-12 18:25:53 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/extensions.d/internal-authn.properties'' 2016-07-12 18:25:53 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/extensions.d/internal-authn.properties' missing 2016-07-12 18:25:53 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/extensions.d/internal-authz.properties'' 2016-07-12 18:25:53 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/extensions.d/internal-authz.properties' missing 2016-07-12 18:25:53 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:828 execute: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'query', '--what=user', '--pattern=name=admin'), executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'OVIRT_ENGINE_JAVA_HOME_FORCE': '1', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'OVIRT_ENGINE_JAVA_HOME': u'/usr/lib/jvm/jre', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'OVIRT_JBOSS_HOME': '/usr/share/jbossas', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'previous': 'N'} 2016-07-12 18:25:55 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:878 execute-result: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'query', '--what=user', '--pattern=name=admin'), rc=0 2016-07-12 18:25:55 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:936 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'query', '--what=user', '--pattern=name=admin') stdout: 2016-07-12 18:25:55 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:941 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'query', '--what=user', '--pattern=name=admin') stderr: 2016-07-12 18:25:55 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:828 execute: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'add', 'admin', '--attribute=firstName=admin'), executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'OVIRT_ENGINE_JAVA_HOME_FORCE': '1', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'OVIRT_ENGINE_JAVA_HOME': u'/usr/lib/jvm/jre', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'OVIRT_JBOSS_HOME': '/usr/share/jbossas', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'previous': 'N'} 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:878 execute-result: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'add', 'admin', '--attribute=firstName=admin'), rc=0 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:936 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'add', 'admin', '--attribute=firstName=admin') stdout: adding user admin... user added successfully Note: by default created user cannot log in. see: /usr/bin/ovirt-aaa-jdbc-tool user password-reset --help. 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:941 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'add', 'admin', '--attribute=firstName=admin') stderr: 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:828 execute: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'show', 'admin', '--attribute=id'), executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'OVIRT_ENGINE_JAVA_HOME_FORCE': '1', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'OVIRT_ENGINE_JAVA_HOME': u'/usr/lib/jvm/jre', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'OVIRT_JBOSS_HOME': '/usr/share/jbossas', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'previous': 'N'} 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:878 execute-result: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'show', 'admin', '--attribute=id'), rc=0 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:936 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'show', 'admin', '--attribute=id') stdout: 087d8800-71e0-4010-95bb-5b39b8e97e93 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:941 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'show', 'admin', '--attribute=id') stderr: 2016-07-12 18:25:56 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:25:56 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserId=unicode:'087d8800-71e0-4010-95bb-5b39b8e97e93' 2016-07-12 18:25:56 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:25:56 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc.Plugin._setupAdminPassword 2016-07-12 18:25:56 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:828 execute: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'password-reset', 'admin', '--password=env:pass', '--force', '--password-valid-to=2216-05-25 22:25:56Z'), executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'OVIRT_ENGINE_JAVA_HOME_FORCE': '1', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'pass': '**FILTERED**', 'OVIRT_ENGINE_JAVA_HOME': u'/usr/lib/jvm/jre', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'OVIRT_JBOSS_HOME': '/usr/share/jbossas', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'previous': 'N'} 2016-07-12 18:26:19 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.executeRaw:878 execute-result: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'password-reset', 'admin', '--password=env:pass', '--force', '--password-valid-to=2216-05-25 22:25:56Z'), rc=0 2016-07-12 18:26:19 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:936 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'password-reset', 'admin', '--password=env:pass', '--force', '--password-valid-to=2216-05-25 22:25:56Z') stdout: updating user admin... user updated successfully 2016-07-12 18:26:19 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaajdbc plugin.execute:941 execute-output: ('/usr/bin/ovirt-aaa-jdbc-tool', '--db-config=/etc/ovirt-engine/aaa/internal.properties', 'user', 'password-reset', 'admin', '--password=env:pass', '--force', '--password-valid-to=2216-05-25 22:25:56Z') stderr: 2016-07-12 18:26:19 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._miscUpgrade 2016-07-12 18:26:19 INFO otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._miscUpgrade:511 Upgrading CA 2016-07-12 18:26:19 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:19 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ca_pki=list:'[[]]' 2016-07-12 18:26:19 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/ca_pki=dict:'{}' 2016-07-12 18:26:19 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:19 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.pki30.Plugin._misc 2016-07-12 18:26:19 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:19 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._misc 2016-07-12 18:26:19 DEBUG otopi.transaction transaction._prepare:76 preparing 'CA Transaction' 2016-07-12 18:26:19 INFO otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._misc:627 Creating CA 2016-07-12 18:26:19 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/cacert.template'' 2016-07-12 18:26:19 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/cacert.template' missing 2016-07-12 18:26:19 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/cert.template'' 2016-07-12 18:26:19 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/cert.template' missing 2016-07-12 18:26:19 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/cert.template'' 2016-07-12 18:26:19 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/cert.template 2016-07-12 18:26:19 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:19 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/cacert.template'' 2016-07-12 18:26:19 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/cacert.template 2016-07-12 18:26:19 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:19 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-create-ca.sh', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215', '--keystore-password=**FILTERED**'), executable='None', cwd='None', env={'LANG': 'en_US.UTF-8', 'CONSOLETYPE': 'vt', 'TERM': 'linux', 'SHLVL': '3', 'PYTHONPATH': '/usr/share/ovirt-engine/setup/bin/..::', 'RUNLEVEL': '3', 'UPSTART_EVENTS': 'runlevel', 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/', 'runlevel': '3', 'UPSTART_JOB': 'rc', 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', 'JAVA_HOME': u'/usr/lib/jvm/jre', 'OTOPI_LOGFILE': '/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log', 'OTOPI_EXECDIR': '/', 'previous': 'N'} 2016-07-12 18:26:20 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-create-ca.sh', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215', '--keystore-password=**FILTERED**'), rc=0 2016-07-12 18:26:20 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-create-ca.sh', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215', '--keystore-password=**FILTERED**') stdout: 2016-07-12 18:26:20 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-create-ca.sh', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215', '--keystore-password=**FILTERED**') stderr: Generating RSA private key, 2048 bit long modulus ..............................+++ ..............................................................................................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain.29215' Certificate is to be certified until Jul 10 22:26:20 2026 GMT (3650 days) Write out database with 1 new entries Data Base Updated Certificate was added to keystore 2016-07-12 18:26:20 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:294 processing: 'engine'[renew=False] 2016-07-12 18:26:20 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:306 '/etc/pki/ovirt-engine/keys/engine.p12' does not exist, enrolling 2016-07-12 18:26:20 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=engine', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), executable='None', cwd='None', env=None 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=engine', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), rc=0 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=engine', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stdout: 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=engine', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stderr: Generating RSA private key, 2048 bit long modulus ...........................................................................................................................................................................+++ ................................................................................................................................................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain' Certificate is to be certified until Jun 16 22:26:25 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:294 processing: 'jboss'[renew=False] 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:306 '/etc/pki/ovirt-engine/keys/jboss.p12' does not exist, enrolling 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=jboss', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), executable='None', cwd='None', env=None 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=jboss', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), rc=0 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=jboss', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stdout: 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=jboss', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stderr: Generating RSA private key, 2048 bit long modulus .................................+++ .....................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain' Certificate is to be certified until Jun 16 22:26:25 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:294 processing: 'websocket-proxy'[renew=False] 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:306 '/etc/pki/ovirt-engine/keys/websocket-proxy.p12' does not exist, enrolling 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=websocket-proxy', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), executable='None', cwd='None', env=None 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=websocket-proxy', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), rc=0 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=websocket-proxy', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stdout: 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=websocket-proxy', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stderr: Generating RSA private key, 2048 bit long modulus ..................+++ ...................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain' Certificate is to be certified until Jun 16 22:26:25 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/websocket-proxy.p12', '-passin', 'pass:**FILTERED**', '-nodes', '-nocerts'), executable='None', cwd='None', env=None 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/websocket-proxy.p12', '-passin', 'pass:**FILTERED**', '-nodes', '-nocerts'), rc=0 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/websocket-proxy.p12', '-passin', 'pass:**FILTERED**', '-nokeys'), executable='None', cwd='None', env=None 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/websocket-proxy.p12', '-passin', 'pass:**FILTERED**', '-nokeys'), rc=0 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/websocket-proxy.p12', '-passin', 'pass:**FILTERED**', '-nokeys') stdout: Bag Attributes localKeyID: A9 49 45 0F E0 CE E8 1B 38 BB F4 CB 25 63 B4 20 0F CB 20 AB subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain issuer=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215 -----BEGIN CERTIFICATE----- MIIEcjCCA1qgAwIBAgICEAMwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCVVMx GDAWBgNVBAoTD2xhYi5sb2NhbGRvbWFpbjEjMCEGA1UEAxMacmhldi5sYWIubG9j YWxkb21haW4uMjkyMTUwHhcNMTYwNzExMjIyNjI1WhcNMjEwNjE2MjIyNjI1WjBG MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPbGFiLmxvY2FsZG9tYWluMR0wGwYDVQQD ExRyaGV2LmxhYi5sb2NhbGRvbWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBAMXRWGUXkR+ATeCVpo1TpAoDjSyl5KQSdqncxbX1TDbc7zMIeImO0dFZ yibSoWf/8Jn7v68RAOGvBJAJOltI4vZu8ecAqchvplyzJL8WxojW1OSMqvdvTKe9 4S90bvVjpjy907uTyCIPEb/+Hi3GRzCyOf7fau9DZ2GfXJHSaeMDrkQDWdVPt9lB Hrcb5hXwvz+PIIAJgQU6WmPwBIPbBiJCzlkH7Gcyx5hbsAyN5E4ZsS5EQ1pV5k2P HKDZAsaF2nqpBUQAS8whKPpx9nx/MwUuGmNGudL3nmYHg7/dYz6iI1/566IjYZvN wB9Fwo//bI8GFs8WYT59RG0rNWAWdT8CAwEAAaOCAWIwggFeMB0GA1UdDgQWBBRM Fk0RRyPwFm2FdXODAN5BJrVQ3jCBiAYIKwYBBQUHAQEEfDB6MHgGCCsGAQUFBzAC hmxodHRwOi8vcmhldi5sYWIubG9jYWxkb21haW46ODAvb3ZpcnQtZW5naW5lL3Nl cnZpY2VzL3BraS1yZXNvdXJjZT9yZXNvdXJjZT1jYS1jZXJ0aWZpY2F0ZSZmb3Jt YXQ9WDUwOS1QRU0tQ0EwdQYDVR0jBG4wbIAUgIVjif6vQCx7khx9cShjSooat2Wh UKROMEwxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9sYWIubG9jYWxkb21haW4xIzAh BgNVBAMTGnJoZXYubGFiLmxvY2FsZG9tYWluLjI5MjE1ggIQADAJBgNVHRMEAjAA MA4GA1UdDwEB/wQEAwIFoDAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUH AwIwDQYJKoZIhvcNAQEFBQADggEBAFPlFtvxbCoTlusQXmfFCJSiFZNbjrLtmKp6 8xqlTMIW3zhsk3fzYjm90GqTeYK8NOih8uNa+FLhDORblzY9FvmLTpmz/MmabBkV RzocRkOHO/ai0UY55UZy530FgU0oa0q9w7G3JVjJB/N15TTsK8NaxDsoJYatQ494 t9GvDOt2GjAu1D9utxi6Ww2FzZQdvZLp5H1dSrF5FnDAnFeqDzT06Hk6qNBu/+DX 6E8jSW34p6c6dUQ63bAYVHC7eRNfznimYMaRFxyId+wQlfZenEv6Hovvtc8K8S2c m73xFkVxPFvn0JLbvt5nYELvyjhZyMNFQIRWVYfHlaJMUS9FmIk= -----END CERTIFICATE----- 2016-07-12 18:26:25 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/websocket-proxy.p12', '-passin', 'pass:**FILTERED**', '-nokeys') stderr: MAC verified OK 2016-07-12 18:26:25 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/certs/websocket-proxy.cer'' 2016-07-12 18:26:25 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/etc/pki/ovirt-engine/certs/websocket-proxy.cer' exists 2016-07-12 18:26:25 DEBUG otopi.filetransaction filetransaction.prepare:234 backup '/etc/pki/ovirt-engine/certs/websocket-proxy.cer'->'/etc/pki/ovirt-engine/certs/websocket-proxy.cer.20160712182625' 2016-07-12 18:26:25 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/keys/websocket-proxy.key.nopass'' 2016-07-12 18:26:25 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/keys/websocket-proxy.key.nopass' missing 2016-07-12 18:26:25 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/keys/websocket-proxy.key.nopass'' 2016-07-12 18:26:25 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/keys/websocket-proxy.key.nopass 2016-07-12 18:26:25 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:25 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/certs/websocket-proxy.cer'' 2016-07-12 18:26:25 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/certs/websocket-proxy.cer 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:294 processing: 'apache'[renew=False] 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:306 '/etc/pki/ovirt-engine/keys/apache.p12' does not exist, enrolling 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=apache', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), executable='None', cwd='None', env=None 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=apache', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), rc=0 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=apache', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stdout: 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=apache', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stderr: Generating RSA private key, 2048 bit long modulus .......................+++ ...............................................................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain' Certificate is to be certified until Jun 16 22:26:26 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/apache.p12', '-passin', 'pass:**FILTERED**', '-nodes', '-nocerts'), executable='None', cwd='None', env=None 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/apache.p12', '-passin', 'pass:**FILTERED**', '-nodes', '-nocerts'), rc=0 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/apache.p12', '-passin', 'pass:**FILTERED**', '-nokeys'), executable='None', cwd='None', env=None 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/apache.p12', '-passin', 'pass:**FILTERED**', '-nokeys'), rc=0 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/apache.p12', '-passin', 'pass:**FILTERED**', '-nokeys') stdout: Bag Attributes localKeyID: BD A1 10 8B C2 00 EB 54 00 5C AF 48 84 4D 0E 6F 05 63 C9 DF subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain issuer=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215 -----BEGIN CERTIFICATE----- MIIEcjCCA1qgAwIBAgICEAQwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCVVMx GDAWBgNVBAoTD2xhYi5sb2NhbGRvbWFpbjEjMCEGA1UEAxMacmhldi5sYWIubG9j YWxkb21haW4uMjkyMTUwHhcNMTYwNzExMjIyNjI2WhcNMjEwNjE2MjIyNjI2WjBG MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPbGFiLmxvY2FsZG9tYWluMR0wGwYDVQQD ExRyaGV2LmxhYi5sb2NhbGRvbWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBAMsOA2oX4ucGYwy6fqSbubZIaxUvlqS4uxgy6q+3QLinpbISNmk2SFT8 GGmx9oKFUzQPqO9dlgK2VgW6otGWQikmJsfHnur80gX2foT5ui7OsbI5Mp+Yitv1 AUM6NfV94cOJTDgCoIFivGjcOtuyAnN66fkDcRvgznjy4XdR+E0G0wokYqxT5ZAv zZI8IbtFLNwD/2yCOhUZSVHsrShGTm15vL9x+0qF8bcsbmAoHWBrQ9unoUa10UNp 3pT0Mp4KVBi/WPkUnnM292KNto/U3ygUPWotqOWyCMjwoJlRnr4lbt98S1neXRnK cqPiTE24sfyq8QU1URzzi6SQiLSABYUCAwEAAaOCAWIwggFeMB0GA1UdDgQWBBR7 pP/vFGTL/yxxFKd78CMG2q2XFTCBiAYIKwYBBQUHAQEEfDB6MHgGCCsGAQUFBzAC hmxodHRwOi8vcmhldi5sYWIubG9jYWxkb21haW46ODAvb3ZpcnQtZW5naW5lL3Nl cnZpY2VzL3BraS1yZXNvdXJjZT9yZXNvdXJjZT1jYS1jZXJ0aWZpY2F0ZSZmb3Jt YXQ9WDUwOS1QRU0tQ0EwdQYDVR0jBG4wbIAUgIVjif6vQCx7khx9cShjSooat2Wh UKROMEwxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9sYWIubG9jYWxkb21haW4xIzAh BgNVBAMTGnJoZXYubGFiLmxvY2FsZG9tYWluLjI5MjE1ggIQADAJBgNVHRMEAjAA MA4GA1UdDwEB/wQEAwIFoDAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUH AwIwDQYJKoZIhvcNAQEFBQADggEBAICynKuXq8cpgNQMGmjDvEXriL0MAcbKQ53v 7yx1fvvuJjF3gx9GXmVeR7TZNRQ1Uxs2iKj3sbmvnMCNBTMQzaADeO+FUfRydfQe 2T4Hpu+Jltk7mC3bSrZnuBtedNhKnjeVtoEVRMEsV0tDw/B2usAv9VxfB9uDbDvM 07t2D+cY1pYx8VUjViZqfn8t7j8rBp94h9Ji90KqJazp8QC52YKEsCpk//gmznQX c14trdxoRnBCBhBnckjVsYUOo2DlG6RemRa1foPftuw++XfGXldvCyxzi8tR7Ma7 CZ4O3J8SBa7N0PNSLV8adzwALzP6C/n158eFtwJQE/zjYSiF3G4= -----END CERTIFICATE----- 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/apache.p12', '-passin', 'pass:**FILTERED**', '-nokeys') stderr: MAC verified OK 2016-07-12 18:26:26 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/certs/apache.cer'' 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/etc/pki/ovirt-engine/certs/apache.cer' exists 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.prepare:234 backup '/etc/pki/ovirt-engine/certs/apache.cer'->'/etc/pki/ovirt-engine/certs/apache.cer.20160712182626' 2016-07-12 18:26:26 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/keys/apache.key.nopass'' 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/keys/apache.key.nopass' missing 2016-07-12 18:26:26 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/keys/apache.key.nopass'' 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/keys/apache.key.nopass 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:26 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/certs/apache.cer'' 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/certs/apache.cer 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:294 processing: 'reports'[renew=False] 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca ca._enrollCertificates:306 '/etc/pki/ovirt-engine/keys/reports.p12' does not exist, enrolling 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=reports', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), executable='None', cwd='None', env=None 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=reports', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain'), rc=0 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=reports', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stdout: 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=reports', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain') stderr: Generating RSA private key, 2048 bit long modulus ..........................................+++ ...................................................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain' Certificate is to be certified until Jun 16 22:26:26 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/reports.p12', '-passin', 'pass:**FILTERED**', '-nodes', '-nocerts'), executable='None', cwd='None', env=None 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/reports.p12', '-passin', 'pass:**FILTERED**', '-nodes', '-nocerts'), rc=0 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:828 execute: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/reports.p12', '-passin', 'pass:**FILTERED**', '-nokeys'), executable='None', cwd='None', env=None 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.executeRaw:878 execute-result: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/reports.p12', '-passin', 'pass:**FILTERED**', '-nokeys'), rc=0 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:936 execute-output: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/reports.p12', '-passin', 'pass:**FILTERED**', '-nokeys') stdout: Bag Attributes localKeyID: B6 28 6D 30 4B E3 ED 8F 88 80 91 51 7F BC ED A0 48 38 63 AE subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain issuer=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215 -----BEGIN CERTIFICATE----- MIIEcjCCA1qgAwIBAgICEAUwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCVVMx GDAWBgNVBAoTD2xhYi5sb2NhbGRvbWFpbjEjMCEGA1UEAxMacmhldi5sYWIubG9j YWxkb21haW4uMjkyMTUwHhcNMTYwNzExMjIyNjI2WhcNMjEwNjE2MjIyNjI2WjBG MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPbGFiLmxvY2FsZG9tYWluMR0wGwYDVQQD ExRyaGV2LmxhYi5sb2NhbGRvbWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBALmMhsf8/ebn7or/FvK1tq5qVivVWcopHtwG41kPzQEz0ImVAU2nFE+q BTr6T9FMKVblWe9nxycwYSR8KxYXrdbLOvxeoD/6mxwgsQgpfxG9sInhQn5hvVWD d7QAhz+b3b6LRVow2Aj3EqAWIKBNr9ac4IvKrcNlDtsrifGD3ASwrwAzYqsZqd2u t8lIUjw0iuR1uF06fSrfQhF5tnXMe37DFhLI92m3n0YY3SNVfABW2xe0+TTjnX9+ JJP7y+4sL54Es1wnltpraUxbrYOSsoft2Becbpje5fa4CgeEbyTH+vYNtf6LrLcM B325+Ab2sGOL/dcl/qnccLgorrdLtssCAwEAAaOCAWIwggFeMB0GA1UdDgQWBBQZ Sd07C2HyHOfNZBE99UAZbSYQMDCBiAYIKwYBBQUHAQEEfDB6MHgGCCsGAQUFBzAC hmxodHRwOi8vcmhldi5sYWIubG9jYWxkb21haW46ODAvb3ZpcnQtZW5naW5lL3Nl cnZpY2VzL3BraS1yZXNvdXJjZT9yZXNvdXJjZT1jYS1jZXJ0aWZpY2F0ZSZmb3Jt YXQ9WDUwOS1QRU0tQ0EwdQYDVR0jBG4wbIAUgIVjif6vQCx7khx9cShjSooat2Wh UKROMEwxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9sYWIubG9jYWxkb21haW4xIzAh BgNVBAMTGnJoZXYubGFiLmxvY2FsZG9tYWluLjI5MjE1ggIQADAJBgNVHRMEAjAA MA4GA1UdDwEB/wQEAwIFoDAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUH AwIwDQYJKoZIhvcNAQEFBQADggEBAJpFUEqYPgcsS/HUWMdQGtpM0r0LcBUUFdOS aTEXpEmky1+XtgaMZk4OXa+BzCr5O2pt1LyhxtRfsZcav8UMq0TTCShNwc4oeS1p UUHc4Kkx5BblItUfjfLx0+Z3YjKMn6O4QlRLLl2r0f2a5TiNmXBKYyectxudLA5y i+enbt9xYfyK0JtofKHD8NiPZhR7jA0yUdyoYAVX+4AnjV5kt/T0FoeEMD2L7cZh HQaL/asskQQSzGOMRDXK1WP+6JFbPFJXk1dulLlkmAr/bQOjL3CpLelxeJOpBByA 5J/AhI3iS50SRoY/GgK8U8sr6+xDWyhOywbBuatxc3m5IejxrpA= -----END CERTIFICATE----- 2016-07-12 18:26:26 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca plugin.execute:941 execute-output: ('/usr/bin/openssl', 'pkcs12', '-in', '/etc/pki/ovirt-engine/keys/reports.p12', '-passin', 'pass:**FILTERED**', '-nokeys') stderr: MAC verified OK 2016-07-12 18:26:26 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/certs/reports.cer'' 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/etc/pki/ovirt-engine/certs/reports.cer' exists 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.prepare:234 backup '/etc/pki/ovirt-engine/certs/reports.cer'->'/etc/pki/ovirt-engine/certs/reports.cer.20160712182626' 2016-07-12 18:26:26 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/keys/reports.key.nopass'' 2016-07-12 18:26:26 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/keys/reports.key.nopass' missing 2016-07-12 18:26:27 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/keys/reports.key.nopass'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/keys/reports.key.nopass 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:27 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/certs/reports.cer'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/certs/reports.cer 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ca_pki=list:'[[], ['/etc/pki/ovirt-engine/cert.template', '/etc/pki/ovirt-engine/cacert.template', '/etc/pki/ovirt-engine/ca.pem', '/etc/pki/ovirt-engine/private/ca.pem', '/etc/pki/ovirt-engine/.truststore', '/etc/pki/ovirt-engine/cacert.conf', '/etc/pki/ovirt-engine/cert.conf', '/etc/pki/ovirt-engine/apache-ca.pem', '/etc/pki/ovirt-engine/keys/engine', '/etc/pki/ovirt-engine/certs/engine', '/etc/pki/ovirt-engine/keys/jboss', '/etc/pki/ovirt-engine/certs/jboss', '/etc/pki/ovirt-engine/keys/websocket-proxy', '/etc/pki/ovirt-engine/certs/websocket-proxy', '/etc/pki/ovirt-engine/keys/websocket-proxy.key.nopass', '/etc/pki/ovirt-engine/certs/websocket-proxy.cer', '/etc/pki/ovirt-engine/keys/apache', '/etc/pki/ovirt-engine/certs/apache', '/etc/pki/ovirt-engine/keys/apache.key.nopass', '/etc/pki/ovirt-engine/certs/apache.cer', '/etc/pki/ovirt-engine/keys/reports', '/etc/pki/ovirt-engine/certs/reports', '/etc/pki/ovirt-engine/keys/reports.key.nopass', '/etc/pki/ovirt-engine/certs/reports.cer']]' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.ca.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-pki.conf'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/engine.conf.d/10-setup-pki.conf' missing 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ca_config=list:'[[]]' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/ca_config=dict:'{}' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin.miscOptions 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'OrganizationName'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'OrganizationName', 'value': 'lab.localdomain'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--key=-'), executable='None', cwd='None', env=None 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--key=-'), rc=0 2016-07-12 18:26:27 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/keys/engine_id_rsa'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/keys/engine_id_rsa' missing 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-'), executable='None', cwd='None', env=None 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-'), rc=0 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-') stdout: Bag Attributes localKeyID: 5C 1C C3 EA 72 FB EC 86 54 AE 2E 55 7D E6 DF 15 A1 95 CA 3E subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain issuer=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215 -----BEGIN CERTIFICATE----- MIIEcjCCA1qgAwIBAgICEAEwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCVVMx GDAWBgNVBAoTD2xhYi5sb2NhbGRvbWFpbjEjMCEGA1UEAxMacmhldi5sYWIubG9j YWxkb21haW4uMjkyMTUwHhcNMTYwNzExMjIyNjI1WhcNMjEwNjE2MjIyNjI1WjBG MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPbGFiLmxvY2FsZG9tYWluMR0wGwYDVQQD ExRyaGV2LmxhYi5sb2NhbGRvbWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBAM6glzYST3P6FuoasYT1avBErK4fZTiO/1bMoXrbW7z3Xn+jntNKHMTr W0WCGneZb66b68BcQ1q9bHnHWNh0WBh08is741Uu5uw50iYGmBNZhnEOtUne9N7G kT7Cp2KMCLuxh5mPq+FMElXZY883s+8OKKBQcuspOicFTNqG2ibWyehX9lajDD/V uI3a/KarSpRjIcefcN8M65JcCT4kyfRYlYeihn4mvXrNmdtivNW7JYn04ATGekyl CFySEYRzFUl0cb/ROpsfBAtkcNP1OlaqRT0J3++CPOzm0Ct8+QWwxGRPWfJ+1Z07 UxnQ9RFJqTQG6bwrQx8mPyyjfE/QuE8CAwEAAaOCAWIwggFeMB0GA1UdDgQWBBSk gqTdGA2JaTKPkeCisZ1zitKbPjCBiAYIKwYBBQUHAQEEfDB6MHgGCCsGAQUFBzAC hmxodHRwOi8vcmhldi5sYWIubG9jYWxkb21haW46ODAvb3ZpcnQtZW5naW5lL3Nl cnZpY2VzL3BraS1yZXNvdXJjZT9yZXNvdXJjZT1jYS1jZXJ0aWZpY2F0ZSZmb3Jt YXQ9WDUwOS1QRU0tQ0EwdQYDVR0jBG4wbIAUgIVjif6vQCx7khx9cShjSooat2Wh UKROMEwxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9sYWIubG9jYWxkb21haW4xIzAh BgNVBAMTGnJoZXYubGFiLmxvY2FsZG9tYWluLjI5MjE1ggIQADAJBgNVHRMEAjAA MA4GA1UdDwEB/wQEAwIFoDAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUH AwIwDQYJKoZIhvcNAQEFBQADggEBADTCDg/lXc+rTVJSSc7fEvtEgBH4cI226DfA eEZqqKgvnG7vNKL+m3OZtA9ZPuPRqFC2DynLQdX4qTRNdPo8DByvxwzxsdmcgBUq /dSK6J/b8rWMH7uIY29tHmSZDn9IPDIi4S1XbPwsEVORzRLdCr+8BnzZ06HR7Q4V uhl78B8ueOSp1nFw4us6muWtBel48Bn35mgUIcm2+a7SwKOsBGnEWQ8pgUpgk0gn PybKCBXZR7r74ePjx4ZQEKl2r8yGRQxGs53TWGuBYI6aHCShnMVVA9onWHeHKz6I 16IvLMCQ0paRsbKXPDgz57eS2mMaugbAsdUfXRNQRIy9RFgKAEM= -----END CERTIFICATE----- 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-') stderr: MAC verified OK 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:918 execute-input: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0') stdin: -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzqCXNhJPc/oW6hqxhPVq 8ESsrh9lOI7/VsyhettbvPdef6Oe00ocxOtbRYIad5lvrpvrwFxDWr1secdY2HRY GHTyKzvjVS7m7DnSJgaYE1mGcQ61Sd703saRPsKnYowIu7GHmY+r4UwSVdljzzez 7w4ooFBy6yk6JwVM2obaJtbJ6Ff2VqMMP9W4jdr8pqtKlGMhx59w3wzrklwJPiTJ 9FiVh6KGfia9es2Z22K81bslifTgBMZ6TKUIXJIRhHMVSXRxv9E6mx8EC2Rw0/U6 VqpFPQnf74I87ObQK3z5BbDEZE9Z8n7VnTtTGdD1EUmpNAbpvCtDHyY/LKN8T9C4 TwIDAQAB -----END PUBLIC KEY----- 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0'), executable='None', cwd='None', env=None 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0'), rc=0 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0') stdout: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOoJc2Ek9z+hbqGrGE9WrwRKyuH2U4jv9WzKF621u8915/o57TShzE61tFghp3mW+um+vAXENavWx5x1jYdFgYdPIrO+NVLubsOdImBpgTWYZxDrVJ3vTexpE+wqdijAi7sYeZj6vhTBJV2WPPN7PvDiigUHLrKTonBUzahtom1snoV/ZWoww/1biN2vymq0qUYyHHn3DfDOuSXAk+JMn0WJWHooZ+Jr16zZnbYrzVuyWJ9OAExnpMpQhckhGEcxVJdHG/0TqbHwQLZHDT9TpWqkU9Cd/vgjzs5tArfPkFsMRkT1nyftWdO1MZ0PURSak0Bum8K0MfJj8so3xP0LhP 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0') stderr: 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/sshPublicKey=unicode:'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOoJc2Ek9z+hbqGrGE9WrwRKyuH2U4jv9WzKF621u8915/o57TShzE61tFghp3mW+um+vAXENavWx5x1jYdFgYdPIrO+NVLubsOdImBpgTWYZxDrVJ3vTexpE+wqdijAi7sYeZj6vhTBJV2WPPN7PvDiigUHLrKTonBUzahtom1snoV/ZWoww/1biN2vymq0qUYyHHn3DfDOuSXAk+JMn0WJWHooZ+Jr16zZnbYrzVuyWJ9OAExnpMpQhckhGEcxVJdHG/0TqbHwQLZHDT9TpWqkU9Cd/vgjzs5tArfPkFsMRkT1nyftWdO1MZ0PURSak0Bum8K0MfJj8so3xP0LhP' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.image_upload.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.answerfile_fixup.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.selinux.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxBooleans=list:'[{'state': 'on', 'boolean': 'httpd_can_network_connect'}]' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.ssl.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/httpd/conf.d/ssl.conf'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:200 file '/etc/httpd/conf.d/ssl.conf' exists 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:234 backup '/etc/httpd/conf.d/ssl.conf'->'/etc/httpd/conf.d/ssl.conf.20160712182627' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports', '/etc/sysconfig/iptables', '/var/lib/pgsql/data/postgresql.conf', '/var/lib/pgsql/data/pg_hba.conf', '/etc/httpd/conf.d/ssl.conf']' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ssl=list:'[]' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/ssl=dict:'{'/etc/httpd/conf.d/ssl.conf': [{'removed': 'SSLCertificateFile /etc/pki/tls/certs/localhost.crt', 'added': '# SSLCertificateFile /etc/pki/tls/certs/localhost.crt'}, {'added': 'SSLCertificateFile /etc/pki/ovirt-engine/certs/apache.cer'}, {'removed': 'SSLCertificateKeyFile /etc/pki/tls/private/localhost.key', 'added': '# SSLCertificateKeyFile /etc/pki/tls/private/localhost.key'}, {'added': 'SSLCertificateKeyFile /etc/pki/ovirt-engine/keys/apache.key.nopass'}, {'added': 'SSLCACertificateFile /etc/pki/ovirt-engine/apache-ca.pem'}]}' 2016-07-12 18:26:27 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._network 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.1', 'name': 'SupportBridgesReportByVDSM'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.1', 'name': 'SupportBridgesReportByVDSM', 'value': 'true'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._storage 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'AllowClusterWithVirtGlusterEnabled'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'AllowClusterWithVirtGlusterEnabled', 'value': 'false'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.1', 'name': 'AdvancedNFSOptionsEnabled'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 0L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' insert into vdc_options ( option_name, option_value, version ) values ( %(name)s, %(value)s, %(version)s ) ', args: {'version': '3.1', 'name': 'AdvancedNFSOptionsEnabled', 'value': 'true'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.2', 'name': 'AdvancedNFSOptionsEnabled'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 0L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' insert into vdc_options ( option_name, option_value, version ) values ( %(name)s, %(value)s, %(version)s ) ', args: {'version': '3.2', 'name': 'AdvancedNFSOptionsEnabled', 'value': 'true'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.3', 'name': 'AdvancedNFSOptionsEnabled'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 0L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' insert into vdc_options ( option_name, option_value, version ) values ( %(name)s, %(value)s, %(version)s ) ', args: {'version': '3.3', 'name': 'AdvancedNFSOptionsEnabled', 'value': 'true'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'GlusterDefaultBrickMountPoint'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'GlusterDefaultBrickMountPoint', 'value': '/rhgs'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._ui_locales 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'UnsupportedLocalesFilter'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'UnsupportedLocalesFilter', 'value': ''} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._ui_popups 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'DisplayUncaughtUIExceptions'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'DisplayUncaughtUIExceptions', 'value': 'false'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.config.Plugin._virt 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'AgentAppName'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'AgentAppName', 'value': 'rhev-agent,rhevm-guest-agent,rhevm-guest-agent-common,RHEV-Agent'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'GuestToolsSetupIsoPrefix'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'GuestToolsSetupIsoPrefix', 'value': 'RHEV-toolsSetup_'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'CpuPinMigrationEnabled'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': 'general', 'name': 'CpuPinMigrationEnabled', 'value': 'false'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.0', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.0', 'name': 'ClusterEmulatedMachines', 'value': 'rhel6.2.0'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.1', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.1', 'name': 'ClusterEmulatedMachines', 'value': 'rhel6.3.0'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.2', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.2', 'name': 'ClusterEmulatedMachines', 'value': 'rhel6.4.0'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.3', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.3', 'name': 'ClusterEmulatedMachines', 'value': 'rhel6.5.0'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.4', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.4', 'name': 'ClusterEmulatedMachines', 'value': 'rhel6.5.0,pseries'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.5', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.5', 'name': 'ClusterEmulatedMachines', 'value': 'rhel6.5.0,pseries'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.6', 'name': 'ClusterEmulatedMachines'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.6', 'name': 'ClusterEmulatedMachines', 'value': 'pc-i440fx-rhel7.2.0,pseries-rhel7.2.0'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select version, option_value from vdc_options where option_name = %(name)s ', args: {'name': 'ServerCPUList'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'version': '3.1', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64;'}, {'version': '3.3', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; :IBM POWER 7 v2.0:powernv,model_POWER7_v2.0:POWER7_v2.0:ppc64; :IBM POWER 7 v2.1:powernv,model_POWER7_v2.1:POWER7_v2.1:ppc64; :IBM POWER 7 v2.3:powernv,model_POWER7_v2.3:POWER7_v2.3:ppc64; :IBM POWER 7+ v2.1:powernv,model_POWER7+_v2.1:POWER7+_v2.1:ppc64; :IBM POWER8 v1.0:powernv,model_POWER8_v1.0:POWER8_v1.0:ppc64;'}, {'version': '3.5', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_power8:power8:ppc64;'}, {'version': '3.6', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell-noTSX Family:vmx,nx,model_Haswell-noTSX:Haswell-noTSX:x86_64; 9:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 10:Intel Broadwell-noTSX Family:vmx,nx,model_Broadwell-noTSX:Broadwell-noTSX:x86_64; 11:Intel Broadwell Family:vmx,nx,model_Broadwell:Broadwell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_POWER8:POWER8:ppc64;'}, {'version': '3.0', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64;'}, {'version': '3.2', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64;'}, {'version': '3.4', 'option_value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64; 3:IBM POWER8:powernv,model_power8:power8:ppc64;'}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select count(*) as count from vdc_options where option_name=%(name)s and version=%(version)s ', args: {'version': '3.3', 'name': 'ServerCPUList'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'count': 1L}] 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' update vdc_options set option_value=%(value)s where option_name=%(name)s and version=%(version)s ', args: {'version': '3.3', 'name': 'ServerCPUList', 'value': '3:Intel Conroe Family:vmx,nx,model_Conroe:Conroe:x86_64; 4:Intel Penryn Family:vmx,nx,model_Penryn:Penryn:x86_64; 5:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; 6:Intel Westmere Family:aes,vmx,nx,model_Westmere:Westmere:x86_64; 7:Intel SandyBridge Family:vmx,nx,model_SandyBridge:SandyBridge:x86_64; 8:Intel Haswell Family:vmx,nx,model_Haswell:Haswell:x86_64; 2:AMD Opteron G1:svm,nx,model_Opteron_G1:Opteron_G1:x86_64; 3:AMD Opteron G2:svm,nx,model_Opteron_G2:Opteron_G2:x86_64; 4:AMD Opteron G3:svm,nx,model_Opteron_G3:Opteron_G3:x86_64; 5:AMD Opteron G4:svm,nx,model_Opteron_G4:Opteron_G4:x86_64; 6:AMD Opteron G5:svm,nx,model_Opteron_G5:Opteron_G5:x86_64'} 2016-07-12 18:26:27 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [] 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.image_upload.Plugin._misc 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._miscConfigVMConsoleHelper 2016-07-12 18:26:27 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/ovirt-vmconsole-proxy-helper.conf.d/10-setup.conf'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/ovirt-vmconsole-proxy-helper.conf.d/10-setup.conf' missing 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.config.Plugin._miscConfigVMConsoleProxy 2016-07-12 18:26:27 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-vmconsole/ovirt-vmconsole-proxy/conf.d/20-ovirt-vmconsole-proxy-helper.conf'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-vmconsole/ovirt-vmconsole-proxy/conf.d/20-ovirt-vmconsole-proxy-helper.conf' missing 2016-07-12 18:26:27 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki.Plugin._miscPKIEngine 2016-07-12 18:26:27 INFO otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki pki._miscPKIEngine:207 Setting up ovirt-vmconsole proxy helper PKI artifacts 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-helper', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain', '--ku=digitalSignature', '--eku=1.3.6.1.4.1.2312.13.1.2.1.1'), executable='None', cwd='None', env=None 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-helper', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain', '--ku=digitalSignature', '--eku=1.3.6.1.4.1.2312.13.1.2.1.1'), rc=0 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-helper', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain', '--ku=digitalSignature', '--eku=1.3.6.1.4.1.2312.13.1.2.1.1') stdout: 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-helper', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain', '--ku=digitalSignature', '--eku=1.3.6.1.4.1.2312.13.1.2.1.1') stderr: Generating RSA private key, 2048 bit long modulus ..+++ ...+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'rhev.lab.localdomain' Certificate is to be certified until Jun 16 22:26:27 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-helper', '--passin=**FILTERED**', '--key=-'), executable='None', cwd='None', env=None 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-helper', '--passin=**FILTERED**', '--key=-'), rc=0 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-helper', '--passin=**FILTERED**', '--key=-') stdout: Bag Attributes localKeyID: 23 49 5F A2 B9 9C F7 02 27 A1 B7 3F 7C C4 01 E9 4C FD 30 39 Key Attributes: -----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC86lUZt4tm2VCb 0kCPgsZeW1xxU5a0B5XkkVv2VF09qk347CLMHXx8n2RnJFKlpaCO1bK0XgYStNO/ K/Hkdbu9z8h46JMisZlmcCYNJbQZr8c/4ek1l2KrzwgASFEkCazcoOQKPcDpZupI /m/5lQ6Avzrc1A87cmTLcidwfXhZkxIvM4kG4SBRYZXz+fc6swMiAQJ+Goz8PRih VMInUro3VgPBkqm74Y8PuLUq3+2AYdbJHmjoox4ViCVoO2nSxX9tccoXmnHuBg9T Ryea7CcadYsRzfFEMKIrO2hq79451ASbhHBCTdesixW65BDBqxTlUnq8QDSIl/aA d3k+gE99AgMBAAECggEBAJkDTC5qRdTmC65KG9ShXb6rTTLVO2lSA4yAV/Yq2uLJ gCIwUPb2ow/lolMQToiwoF1QpVAGH/Ei2acsFt6upYPWOlAEQLiHFPKtv4RCl59+ imopttSba2YxaA+ig2YnGAYTouDQp+HkY7r/qv6CRp7tROX8NOI3g4BtU5h/Z+1U F2sHTgvKI7m7TJRY1qZYpq2aUOyG0AlmSAlHMR/B2cQpzt+iqDyQrD69qZTo2i2c Qn/rUDf40XcuSxhAdXcUUesi0OrhBHRqolCzNhRCvmpWC7mbM/Cg8uXklO10iVFd Fy/7OgcYH2aV4lq07d6Bx5zwg8xalBVXKLa8SxOxIgECgYEA5soogTE7JjbIXHdF vmiYEORtqz8+BzbmeQ92uW4+L1zryxZzJQlH3yUO6PNv/CBiLe11EoKitoT1SevX FxSNQ0RM7EdFw/cqmfUBqeb2HNAtSUi9Z7ZBBhqit3R1rzQZJy529GY3xgSUn5FO V6iz8WS/J9FedIRCgfshECPEdsECgYEA0Y0xkZN12Tapb+OiKS4CsVDVLZogwuwI znfWhLEAlpd1TwKPuXs4rc6f15EFrHS7+hdZM9Az4pK+u7OV2CbL9cBkDbbvQsR2 0uw3W09RA0rArh/0vcaWzmQIOjK5sf0kvY1fYiI8o4VZQWOp4RcdepF7vLlU0XdI R3oiYkaIY70CgYAvmpdMPqlisn4VhIygP9bN9TAh2IOk3VAgvG3SxciR4GrKkzDg /M8UWgJ/TmdU7CEUNByn2sZRO4+U1c6h9h1FOLtdKT5cs4jYBM95CijNvKr6qMRY tiEnbysNCDqWDvr5N/5VXxg2Ag/d8gzky+mB6zP6tJb1FaraQMCLIbWOgQKBgG3s 3mLacwjGNu3+AJQPkdQIbjvkzWjTPu9oR/0FiSR2QVB4LIMFU79BU/JWHh7Qgcd4 tg+LGZyylCGM3H8uIvJAwXu8ShjBTP/qcEOTARF0Bk2Rb+aZpYSRTwuQjn8DJ2HU JoQpJ5w0GJVHvdbZNFqWtM1Uf1z+cMkmFaFuFKAVAoGAPqoWNI9AWmg/9VqmVBu7 6BU0t0arMuLPrmzNCERmWN9tlvc3FUgoEFaVhuzo/tbZ3q4BRIOF1the5QEuNChA FlT7gqAODqQhmIERdZZ35s8cv2TMNzipjZl3vvnmgpPSXVI6TkWUZ1SdRpnrgFKd FSE2OdUOLss8wckwnK/zv8Q= -----END PRIVATE KEY----- 2016-07-12 18:26:27 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-helper', '--passin=**FILTERED**', '--key=-') stderr: MAC verified OK 2016-07-12 18:26:27 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.key.nopass'' 2016-07-12 18:26:27 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.key.nopass' missing 2016-07-12 18:26:28 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:28 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/vmconsole_proxy_helper_pki=list:'[['/etc/pki/ovirt-engine/certs/vmconsole-proxy-helper.cer', '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.p12']]' 2016-07-12 18:26:28 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/vmconsole_proxy_helper_pki=dict:'{}' 2016-07-12 18:26:28 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:28 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki.Plugin._miscPKIProxy 2016-07-12 18:26:28 INFO otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki pki._miscPKIProxy:303 Setting up ovirt-vmconsole SSH PKI artifacts 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipeRaw:496 executePipeRaw: [0] popen kw={'args': ('/usr/bin/openssl', 'x509', '-in', '/etc/pki/ovirt-engine/ca.pem', '-noout', '-pubkey'), 'preexec_fn': , 'stdout': -1, 'close_fds': True, 'stdin': None, 'stderr': -1} 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipeRaw:501 executePipeRaw: [0] pid pid=15203 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipeRaw:496 executePipeRaw: [1] popen kw={'args': ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0'), 'preexec_fn': , 'stdout': -1, 'close_fds': True, 'stdin': ', mode 'rb' at 0x1f550c0>, 'stderr': -1} 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipeRaw:501 executePipeRaw: [1] pid pid=15204 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipeRaw:618 executePipe-result: [0] ('/usr/bin/openssl', 'x509', '-in', '/etc/pki/ovirt-engine/ca.pem', '-noout', '-pubkey'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipeRaw:618 executePipe-result: [1] ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipe:754 executePipe-output: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0') stdout: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDrshde3MNOa3lN+dxQ0SgibBzwWufr8MSXrOOhOrXfcxWpjmXsrRi9ltQHJSdT576NJHggSqgUk1vDaZWn2mjnzIVDlcGGEZvuyiz70HTSmFGe9U18uQBnWkyhbIPQL9+Id0KHd+CZzY9DNLHlo97i/qH9VOnY6M1yhyiISBGx6u+L0lNiJBkx5QeW8mMPoM5o7gIZMtxrdE1wp4/JplUSqKGF3w3BbzDS7lHuD1gi3nQlksFq+hmi2uRfIqSq3vadOkXStfl3HssFraRtBl09YqTykwtKHRMhaCRNcjNIeA+XTvUPSYN01MDMD5ZCQHe0OfAnhXCu9tTvsNvKgq3D 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipe:764 executePipe-output: [0] ('/usr/bin/openssl', 'x509', '-in', '/etc/pki/ovirt-engine/ca.pem', '-noout', '-pubkey') stderr: 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executePipe:764 executePipe-output: [1] ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-i', '-m', 'PKCS8', '-f', '/proc/self/fd/0') stderr: 2016-07-12 18:26:28 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-vmconsole/ca.pub'' 2016-07-12 18:26:28 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-vmconsole/ca.pub' missing 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-user', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-user'), executable='None', cwd='None', env=None 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-user', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-user'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-user', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-user') stdout: 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-user', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-user') stderr: Generating RSA private key, 2048 bit long modulus .................+++ ..........................................................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'vmconsole-proxy-user' Certificate is to be certified until Jun 16 22:26:28 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-user', '--id=vmconsole-proxy-user', '--principals=ovirt-vmconsole-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-user', '--id=vmconsole-proxy-user', '--principals=ovirt-vmconsole-proxy'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-user', '--id=vmconsole-proxy-user', '--principals=ovirt-vmconsole-proxy') stdout: 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-user', '--id=vmconsole-proxy-user', '--principals=ovirt-vmconsole-proxy') stderr: Signed user key /etc/pki/ovirt-engine/certs/vmconsole-proxy-user-cert.pub: id "vmconsole-proxy-user" serial 0 for ovirt-vmconsole-proxy valid from 2016-07-12T17:26:28 to 2021-06-16T18:26:28 2016-07-12 18:26:28 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa-cert.pub'' 2016-07-12 18:26:28 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa-cert.pub' missing 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-user', '--passin=**FILTERED**', '--key=-'), executable='None', cwd='None', env=None 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-user', '--passin=**FILTERED**', '--key=-'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-user', '--passin=**FILTERED**', '--key=-') stdout: Bag Attributes localKeyID: 31 5E A8 24 C8 0E FA 2B 6A A5 E1 13 3C C1 43 02 44 1F 3C FD Key Attributes: -----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCyJ5vuNWxJRuLH wvYyH6X48BsRtj4fIBu2RS9OV1gRtP2w+hLyMYvlIFQmZV593UfBNTL1arYBuOe1 h6YPiLnoynK7dSfJ7k8NLLnd6FyY/MynzGkznUlEhQG1pUmp5iehuTAPBrynhH4N PJEoK3zsIZt8oWHsZRDwZ/qGmR66z73d7CgWi2G78PP9D1hdV1eo0MSMfJHyHpkm KXC4S9+0gp289b0Ivo0Gt0EJKVvCg59/qM9o+ATT5ytU/hUqymP9m9fgr0FuvrSM Dx6mI0ZQCLW9xg3lOKCEkhQkyqJrrfhscSB13OeRBVWOTPij9/CEtVr23yoUANJ7 ANUP21VdAgMBAAECggEANytq71ad5QdNnTzzzsvcMv3v9AkyraLc0hIUtzb3L+yT j2WxzkynnNnpFUbY/zMyUFOwJy3XlSr0nlOWikL2B3ACHakHHFJvKo5KNL0LR9kp a2EyxugTU2O5Bs5bxIBgj4Vwq4aTj3DJNEIoVX86HUm/A9ZaI8GcgEZC38G1MXY1 YpLOpepaP8u5yfWpzOge0b/7Q10GelAMZe3rO4KJLCAalku+wO7w+fCoZlVIu2jD 7iBwaKwSHtUgD2ZkRwZPZFZUWbDXcyGJyvLMBTZB6SByrDg9yciKlAlQKZfAbW1q mXpvuSpZ8m3+myUq0iGZAZLWUntGuYRa33RU3unahQKBgQDdqzf0NXXzZKMzCQaq dRXkBh9UvlsmZ2SxwbGUboIoBkWpj26wFcXy9DUT7k5VU2318544MAmVGLn3vcLV ToAYTzJIXLGXFu8lq4YhhkWWjKlIqlY6UXEd0ezONK3xM49ZWdENXp2Zsz1JSkJ0 Tiz9814pkbyQItrCKnCSOMtKZwKBgQDNvyHtthulykFCL+Tb1w0eseIAEQgBRxva 1EltMRr7BKPf5vYAkPbwHQ7xir7IHL9D3g11vlsLjWw1o+PgcYF59CVPfKjl3lnr 4tx7GY40XmTDqYf+pBXDTJZpVXdZMmUVIMPbmC+i390Mt9cG+VcC0y/3A4Ifx06m hiHijgTPmwKBgBnT3U0i/X9CdpF3t8McqVRMMlJZa51p5p2fh+VXiurG8E71W1xA 7TOFqLmNxqrCccl6fTDmx/cLTn/DKHRaFSq/74fm5PpJvcuR1KsLTghgk0jYL/vT iW6ECydrk+jKrSUoBeec4pgJ/lYPxPZwNWXReWM2i9XvebWt5DflTip5AoGBAJ3b twF2xtG2U8mfi51s64EQhFD+wECSuXl1hXzEv2m3DrDcuQSINR7XfL6wcF6DR/Cf b35Wde5wLIUfYNi03d2fB/1rrP7pUd7dacL9QZFGl1NUQKaMaLI2kfTxgSertci3 Ie7bXjk+P5DhgJa2Oh9Nv7BrPax6NAsqQNddla1fAoGBAIGTpc4mFQ4QpT4QGxeM GLZgX10MZXAQn9ABdPeutKv45DOcNVCCLRc+OTbTLgzNg2+BWTxKgMZ0LzkprFXT xEVM6EqXiNn900UaqGcC8V8pOVrDLvEI+ka5clJsM6x2g9YQkMdLpq3ztv2Md+HE HpNORwR12tZY6SAJ643cAEBT -----END PRIVATE KEY----- 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-user', '--passin=**FILTERED**', '--key=-') stderr: MAC verified OK 2016-07-12 18:26:28 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa'' 2016-07-12 18:26:28 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa' missing 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-host', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-host'), executable='None', cwd='None', env=None 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-host', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-host'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-host', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-host') stdout: 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-pkcs12.sh', '--name=vmconsole-proxy-host', '--password=**FILTERED**', '--subject=/C=US/O=lab.localdomain/CN=vmconsole-proxy-host') stderr: Generating RSA private key, 2048 bit long modulus ..................................................+++ ...................+++ unable to write 'random state' e is 65537 (0x10001) Using configuration from openssl.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'US' organizationName :PRINTABLE:'lab.localdomain' commonName :PRINTABLE:'vmconsole-proxy-host' Certificate is to be certified until Jun 16 22:26:28 2021 GMT (1800 days) Write out database with 1 new entries Data Base Updated unable to write 'random state' 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-host', '--id=vmconsole-proxy-host', '--principals=rhev.lab.localdomain', '--host'), executable='None', cwd='None', env=None 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-host', '--id=vmconsole-proxy-host', '--principals=rhev.lab.localdomain', '--host'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-host', '--id=vmconsole-proxy-host', '--principals=rhev.lab.localdomain', '--host') stdout: 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-enroll-openssh-cert.sh', '--name=vmconsole-proxy-host', '--id=vmconsole-proxy-host', '--principals=rhev.lab.localdomain', '--host') stderr: Signed host key /etc/pki/ovirt-engine/certs/vmconsole-proxy-host-cert.pub: id "vmconsole-proxy-host" serial 0 for rhev.lab.localdomain valid from 2016-07-12T17:26:28 to 2021-06-16T18:26:28 2016-07-12 18:26:28 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa-cert.pub'' 2016-07-12 18:26:28 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa-cert.pub' missing 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-host', '--passin=**FILTERED**', '--key=-'), executable='None', cwd='None', env=None 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-host', '--passin=**FILTERED**', '--key=-'), rc=0 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-host', '--passin=**FILTERED**', '--key=-') stdout: Bag Attributes localKeyID: 99 FD C8 79 41 C7 08 C6 C8 36 42 D7 EF E4 C5 27 AC 51 2C 92 Key Attributes: -----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDN26OqFu/gY8Te wKdIhG3OO9EZ02jLf3dtSmxUQxkIQ8CflYT0ttg0dnBjUV9XMyVHvqkyhysle0Nq 89sXTIwtTmeGAI0s/qjVjbipd8nLKPe9uJKZQf9NGKo5lXlZrI9iBgOjQ/hnA7Yw zvVHV+ZR5EAZh/C7soQIOLmb8f15s4t98ZIVaBi6opxzDPS2R6fWwncaeEgsHCim XmWgrOFvsfzuwfRkF0n0F7LWQOgNTDGXK5f1Dn1Mjk5Cxl9zlPOqN3uKRpTTH52H 9Ef4srqbz7CE8XnLm8weW3M264oDJJVaSi13zl+H59ACSQYsl93MomKvYJGLkfl3 sYWlQ35VAgMBAAECggEBAJdRslafEajR7a8H0m992PFWCvh+7HNZuUH/CO5PfCEV HIyx7c+sb/TwcuCuufRxRiAcyGa58T9WAlKl+hCAVjIfhf18fknqz9RanrkDsrPB 44n0GN7LIo1bahV2CIOgUq1tWlMy7W9bzRrHpojQ1h6wN2YNBSoTqPYaLGWzVe2U eXRgdEksMtC9NACugmGVQlBEDb1xIsHXETguDpxZPp5RpDpoBnrGIbemjGyHx77B qwOZ0S9qlOst0UGuzWpWgXaCIya8HO4ysUKsOWfBANaMuxuNtpSsRG8E4oehCy1b hGtKzi6ez/1TmG1chb4GBcJMUtegZQ/AESpzcLLc9AECgYEA7QUIlZcj7tbrL7IA viHvN6XCmIz4JqZg+SSxxQqPQUC9yTBgE6QNVJzoWb4bl9p2HUxtehLtZDCT1Yoo Rh18Wk1S+dF4jl28j/pc8/vrajtOhNt8eXrj+XCsuAvFCJfMXSDEeNhiH4iC7sU0 ggMUxrBLLx0XK7q1MQGEkEftX4ECgYEA3lfIXXHyF9v1Nn+AUeogiOeDu46UdiYp 9QCsftx0GgxIli5mzf90Kan/fTawoB6M3PysrrIfi2qMX1KTlPenpO535kqVkgEd +RC+v1eloVgyFqCZdH1McOSJufGPDN53BWr6qQ/4NW653R7T0SDUg3vwuAe7USzd Pu5FN2VHCNUCgYEAlVfMluUKwR0uR3kzOpoLLtcFDDYWzdOb2qAiWvNSXF08uB4B C58cvym2xYUhwcbnEYLsoDR429436B8LTVKa3hNGqx4vhhTOETJBi4I6TU9dJB1g CvNB3hP+4GCaH9X18OAKq9I70X6kcWpUsW7bkm3WkbMUvHsCXASG0JphmQECgYEA m1MptxX98OsJT8wcgZ0Uo29QmLsPPcaFcxHIb0tklDnWj4vU5724kc6fnAKTuxf8 gfjGTbhDzypc686NKPkllVO+URPzjy7WmIM5LgR1wdQSEbqZ2UYbG5acHFkC/ROA hDlq6KYuWG2EzFNX1/WeYEg6LuW/1wKHgQoFMqC+0g0CgYBYzc+XHO42x1ggS515 zhA6HISrsyS207O2/ZQsesJbF465NRZK0qYDBREcnTn5Q61yDbppAoH/+XXdmP8v dVaGV3JcleROMBxWxdVV5ZBP9au5CRzALE85Uj5YGx3YWwbGyey0Dx84v1V96tzf fLxD1kA4qVt8WkWwDR8wnlMZXA== -----END PRIVATE KEY----- 2016-07-12 18:26:28 DEBUG otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.pki plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=vmconsole-proxy-host', '--passin=**FILTERED**', '--key=-') stderr: MAC verified OK 2016-07-12 18:26:28 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa'' 2016-07-12 18:26:28 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa' missing 2016-07-12 18:26:29 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:29 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/vmconsole_proxy_pki=list:'[['/etc/pki/ovirt-engine/certs/vmconsole-proxy-user-cert.pub', '/etc/pki/ovirt-engine/certs/vmconsole-proxy-host-cert.pub']]' 2016-07-12 18:26:29 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/vmconsole_proxy_pki=dict:'{}' 2016-07-12 18:26:29 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._check_separate 2016-07-12 18:26:29 INFO otopi.plugins.ovirt_engine_setup.websocket_proxy.config config._check_separate:178 Configuring WebSocket Proxy 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._misc_VDC 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._misc_config 2016-07-12 18:26:29 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine/ovirt-websocket-proxy.conf.d/10-setup.conf'' 2016-07-12 18:26:29 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine/ovirt-websocket-proxy.conf.d/10-setup.conf' missing 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._misc_pki 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._misc 2016-07-12 18:26:29 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:171 Database: 'None', Statement: ' select attach_user_to_role( %(admin_user)s, %(authz_name)s, %(namespace)s, %(admin_user_id)s, 'SuperUser' ) ', args: {'namespace': '*', 'admin_user': 'admin@internal', 'authz_name': 'internal-authz', 'admin_user_id': u'087d8800-71e0-4010-95bb-5b39b8e97e93'} 2016-07-12 18:26:29 DEBUG otopi.ovirt_engine_setup.engine_common.database database.execute:221 Result: [{'attach_user_to_role': ''}] 2016-07-12 18:26:29 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_common.base.system.selinux.Plugin._misc 2016-07-12 18:26:29 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.executeRaw:828 execute: ('/usr/sbin/semanage', 'boolean', '--modify', '--on', 'httpd_can_network_connect'), executable='None', cwd='None', env=None 2016-07-12 18:26:59 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.executeRaw:878 execute-result: ('/usr/sbin/semanage', 'boolean', '--modify', '--on', 'httpd_can_network_connect'), rc=0 2016-07-12 18:26:59 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.execute:936 execute-output: ('/usr/sbin/semanage', 'boolean', '--modify', '--on', 'httpd_can_network_connect') stdout: 2016-07-12 18:26:59 DEBUG otopi.plugins.ovirt_engine_common.base.system.selinux plugin.execute:941 execute-output: ('/usr/sbin/semanage', 'boolean', '--modify', '--on', 'httpd_can_network_connect') stderr: 2016-07-12 18:26:59 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine_common.apache.misc.Plugin._misc 2016-07-12 18:26:59 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:26:59 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configured=bool:'True' 2016-07-12 18:26:59 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:26:59 DEBUG otopi.context context._executeMethod:142 Stage misc METHOD otopi.plugins.ovirt_engine_common.base.core.postinstall.Plugin._misc 2016-07-12 18:26:59 INFO otopi.plugins.ovirt_engine_common.base.core.postinstall postinstall._misc:57 Generating post install configuration file '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf' 2016-07-12 18:26:59 DEBUG otopi.transaction transaction._prepare:76 preparing 'File transaction for '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf'' 2016-07-12 18:26:59 DEBUG otopi.filetransaction filetransaction.prepare:198 file '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf' missing 2016-07-12 18:26:59 INFO otopi.context context.runSequence:427 Stage: Transaction commit 2016-07-12 18:26:59 DEBUG otopi.context context.runSequence:431 STAGE cleanup 2016-07-12 18:26:59 DEBUG otopi.context context._executeMethod:142 Stage cleanup METHOD otopi.plugins.otopi.core.transaction.Plugin._main_end 2016-07-12 18:26:59 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf'' 2016-07-12 18:26:59 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf 2016-07-12 18:26:59 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:59 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/ovirt-websocket-proxy.conf.d/10-setup.conf'' 2016-07-12 18:26:59 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/ovirt-websocket-proxy.conf.d/10-setup.conf 2016-07-12 18:26:59 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:26:59 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa'' 2016-07-12 18:26:59 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa-cert.pub'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa-cert.pub 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa-cert.pub'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa-cert.pub 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-vmconsole/ca.pub'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-vmconsole/ca.pub 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.key.nopass'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.key.nopass 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-vmconsole/ovirt-vmconsole-proxy/conf.d/20-ovirt-vmconsole-proxy-helper.conf'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-vmconsole/ovirt-vmconsole-proxy/conf.d/20-ovirt-vmconsole-proxy-helper.conf 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/ovirt-vmconsole-proxy-helper.conf.d/10-setup.conf'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/ovirt-vmconsole-proxy-helper.conf.d/10-setup.conf 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/httpd/conf.d/ssl.conf'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/httpd/conf.d/ssl.conf 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:00 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/pki/ovirt-engine/keys/engine_id_rsa'' 2016-07-12 18:27:00 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/pki/ovirt-engine/keys/engine_id_rsa 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-pki.conf'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/engine.conf.d/10-setup-pki.conf 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'CA Transaction' 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/extensions.d/internal-authz.properties'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/extensions.d/internal-authz.properties 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/extensions.d/internal-authn.properties'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/extensions.d/internal-authn.properties 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/aaa/internal.properties'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/aaa 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'Engine schema Transaction' 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/logcollector.conf.d/10-engine-setup.conf'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/logcollector.conf.d/10-engine-setup.conf 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/imageuploader.conf.d/10-engine-setup.conf'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/imageuploader.conf.d/10-engine-setup.conf 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/isouploader.conf.d/10-engine-setup.conf'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/isouploader.conf.d/10-engine-setup.conf 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-protocols.conf'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/engine.conf.d/10-setup-protocols.conf 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:01 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/notifier/notifier.conf.d/10-setup-jboss.conf'' 2016-07-12 18:27:01 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/notifier/notifier.conf.d/10-setup-jboss.conf 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-jboss.conf'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/engine.conf.d/10-setup-jboss.conf 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-java.conf'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/engine.conf.d/10-setup-java.conf 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/engine.conf.d/10-setup-database.conf 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/httpd/conf.d/ovirt-engine-root-redirect.conf'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/httpd/conf.d/ovirt-engine-root-redirect.conf 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/httpd/conf.d/z-ovirt-engine-proxy.conf'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/httpd/conf.d/z-ovirt-engine-proxy.conf 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/ovirt-engine/iptables.example'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/ovirt-engine/iptables.example 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'File transaction for '/etc/sysconfig/iptables'' 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:331 Executing restorecon for /etc/sysconfig/iptables 2016-07-12 18:27:02 DEBUG otopi.filetransaction filetransaction.commit:345 restorecon result rc=0, stdout=, stderr= 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'Version Lock Transaction' 2016-07-12 18:27:02 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages plugin.executeRaw:828 execute: ('/bin/rpm', '-q', 'rhevm', 'rhevm-userportal', 'rhevm-dbscripts', 'rhevm-tools-backup', 'redhat-support-plugin-rhev', 'rhevm-webadmin-portal', 'rhevm-restapi', 'ovirt-engine-extension-aaa-jdbc', 'rhevm-tools', 'rhevm-backend'), executable='None', cwd='None', env=None 2016-07-12 18:27:02 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages plugin.executeRaw:878 execute-result: ('/bin/rpm', '-q', 'rhevm', 'rhevm-userportal', 'rhevm-dbscripts', 'rhevm-tools-backup', 'redhat-support-plugin-rhev', 'rhevm-webadmin-portal', 'rhevm-restapi', 'ovirt-engine-extension-aaa-jdbc', 'rhevm-tools', 'rhevm-backend'), rc=0 2016-07-12 18:27:02 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages plugin.execute:936 execute-output: ('/bin/rpm', '-q', 'rhevm', 'rhevm-userportal', 'rhevm-dbscripts', 'rhevm-tools-backup', 'redhat-support-plugin-rhev', 'rhevm-webadmin-portal', 'rhevm-restapi', 'ovirt-engine-extension-aaa-jdbc', 'rhevm-tools', 'rhevm-backend') stdout: rhevm-3.6.6.2-0.1.el6.noarch rhevm-userportal-3.6.6.2-0.1.el6.noarch rhevm-dbscripts-3.6.6.2-0.1.el6.noarch rhevm-tools-backup-3.6.6.2-0.1.el6.noarch redhat-support-plugin-rhev-3.6.0-15.el6.noarch rhevm-webadmin-portal-3.6.6.2-0.1.el6.noarch rhevm-restapi-3.6.6.2-0.1.el6.noarch ovirt-engine-extension-aaa-jdbc-1.0.7-2.el6ev.noarch rhevm-tools-3.6.6.2-0.1.el6.noarch rhevm-backend-3.6.6.2-0.1.el6.noarch 2016-07-12 18:27:02 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine_common.distro-rpm.packages plugin.execute:941 execute-output: ('/bin/rpm', '-q', 'rhevm', 'rhevm-userportal', 'rhevm-dbscripts', 'rhevm-tools-backup', 'redhat-support-plugin-rhev', 'rhevm-webadmin-portal', 'rhevm-restapi', 'ovirt-engine-extension-aaa-jdbc', 'rhevm-tools', 'rhevm-backend') stderr: 2016-07-12 18:27:02 DEBUG otopi.transaction transaction.commit:162 committing 'Database Transaction' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/modifiedFiles=list:'['/var/lib/pgsql/data/pg_hba.conf', '/var/lib/pgsql/data/postgresql.conf', '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf', '/etc/ovirt-engine/ovirt-websocket-proxy.conf.d/10-setup.conf', '/etc/ovirt-vmconsole/ovirt-vmconsole-proxy/conf.d/20-ovirt-vmconsole-proxy-helper.conf', '/etc/ovirt-engine/ovirt-vmconsole-proxy-helper.conf.d/10-setup.conf', '/etc/pki/ovirt-engine/keys/engine_id_rsa', '/etc/ovirt-engine/extensions.d/internal-authz.properties', '/etc/ovirt-engine/extensions.d/internal-authn.properties', '/etc/ovirt-engine/aaa/internal.properties', '/etc/ovirt-engine/logcollector.conf.d/10-engine-setup.conf', '/etc/ovirt-engine/imageuploader.conf.d/10-engine-setup.conf', '/etc/ovirt-engine/isouploader.conf.d/10-engine-setup.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-protocols.conf', '/etc/ovirt-engine/notifier/notifier.conf.d/10-setup-jboss.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-jboss.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-java.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf', '/etc/httpd/conf.d/ovirt-engine-root-redirect.conf', '/etc/httpd/conf.d/z-ovirt-engine-proxy.conf', '/etc/ovirt-engine/iptables.example', '/etc/sysconfig/iptables']' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports', '/etc/sysconfig/iptables', '/var/lib/pgsql/data/postgresql.conf', '/var/lib/pgsql/data/pg_hba.conf', '/etc/httpd/conf.d/ssl.conf', '/etc/yum/pluginconf.d/versionlock.list', '/etc/dnf/plugins/versionlock.list']' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ca_config=list:'[['/etc/ovirt-engine/engine.conf.d/10-setup-pki.conf']]' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/versionlock=list:'[]' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/vmconsole_proxy_helper_pki=list:'[['/etc/pki/ovirt-engine/certs/vmconsole-proxy-helper.cer', '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.p12', '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.key.nopass']]' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/vmconsole_proxy_pki=list:'[['/etc/pki/ovirt-engine/certs/vmconsole-proxy-user-cert.pub', '/etc/pki/ovirt-engine/certs/vmconsole-proxy-host-cert.pub', '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa', '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa-cert.pub', '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa', '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa-cert.pub', '/etc/pki/ovirt-vmconsole/ca.pub']]' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/versionlock=dict:'{'/etc/yum/pluginconf.d/versionlock.list': [{'added': u'rhevm-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-userportal-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-dbscripts-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-tools-backup-3.6.6.2-0.1.el6.noarch'}, {'added': u'redhat-support-plugin-rhev-3.6.0-15.el6.noarch'}, {'added': u'rhevm-webadmin-portal-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-restapi-3.6.6.2-0.1.el6.noarch'}, {'added': u'ovirt-engine-extension-aaa-jdbc-1.0.7-2.el6ev.noarch'}, {'added': u'rhevm-tools-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-backend-3.6.6.2-0.1.el6.noarch'}]}' 2016-07-12 18:27:03 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:27:03 INFO otopi.context context.runSequence:427 Stage: Closing up 2016-07-12 18:27:03 DEBUG otopi.context context.runSequence:431 STAGE closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.otopi.network.firewalld.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.otopi.network.iptables.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:124 check if service firewalld exists 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'firewalld'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'firewalld'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'firewalld') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'firewalld') stderr: initctl: Unknown job: firewalld 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.exists:136 service firewalld exists False upstart=False 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service iptables startup to True 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'iptables'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'iptables'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'iptables') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'iptables') stderr: initctl: Unknown job: iptables 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'iptables', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'iptables', 'on'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'iptables', 'on') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'iptables', 'on') stderr: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service iptables 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'iptables'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'iptables'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'iptables') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'iptables') stderr: initctl: Unknown job: iptables 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'iptables', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'iptables', 'stop'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'iptables', 'stop') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'iptables', 'stop') stderr: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service iptables 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'iptables'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'iptables'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'iptables') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'iptables') stderr: initctl: Unknown job: iptables 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'iptables', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'iptables', 'start'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'iptables', 'start') stdout: iptables: Applying firewall rules: [ OK ] 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'iptables', 'start') stderr: 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.nfs.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_s_summary 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== SUMMARY ==-- 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.rhevm_setup_plugins.distro-rhel.reports.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._devenv_closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.upgrade.dwh.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck.Plugin._closeup 2016-07-12 18:27:03 WARNING otopi.plugins.ovirt_engine_setup.ovirt_engine.system.memcheck memcheck._check_requirements:83 Less than 16384MB of memory is available 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.exportfs.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.provisioning.postgres.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-') stdout: Bag Attributes localKeyID: 5C 1C C3 EA 72 FB EC 86 54 AE 2E 55 7D E6 DF 15 A1 95 CA 3E subject=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain issuer=/C=US/O=lab.localdomain/CN=rhev.lab.localdomain.29215 -----BEGIN CERTIFICATE----- MIIEcjCCA1qgAwIBAgICEAEwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCVVMx GDAWBgNVBAoTD2xhYi5sb2NhbGRvbWFpbjEjMCEGA1UEAxMacmhldi5sYWIubG9j YWxkb21haW4uMjkyMTUwHhcNMTYwNzExMjIyNjI1WhcNMjEwNjE2MjIyNjI1WjBG MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPbGFiLmxvY2FsZG9tYWluMR0wGwYDVQQD ExRyaGV2LmxhYi5sb2NhbGRvbWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC AQoCggEBAM6glzYST3P6FuoasYT1avBErK4fZTiO/1bMoXrbW7z3Xn+jntNKHMTr W0WCGneZb66b68BcQ1q9bHnHWNh0WBh08is741Uu5uw50iYGmBNZhnEOtUne9N7G kT7Cp2KMCLuxh5mPq+FMElXZY883s+8OKKBQcuspOicFTNqG2ibWyehX9lajDD/V uI3a/KarSpRjIcefcN8M65JcCT4kyfRYlYeihn4mvXrNmdtivNW7JYn04ATGekyl CFySEYRzFUl0cb/ROpsfBAtkcNP1OlaqRT0J3++CPOzm0Ct8+QWwxGRPWfJ+1Z07 UxnQ9RFJqTQG6bwrQx8mPyyjfE/QuE8CAwEAAaOCAWIwggFeMB0GA1UdDgQWBBSk gqTdGA2JaTKPkeCisZ1zitKbPjCBiAYIKwYBBQUHAQEEfDB6MHgGCCsGAQUFBzAC hmxodHRwOi8vcmhldi5sYWIubG9jYWxkb21haW46ODAvb3ZpcnQtZW5naW5lL3Nl cnZpY2VzL3BraS1yZXNvdXJjZT9yZXNvdXJjZT1jYS1jZXJ0aWZpY2F0ZSZmb3Jt YXQ9WDUwOS1QRU0tQ0EwdQYDVR0jBG4wbIAUgIVjif6vQCx7khx9cShjSooat2Wh UKROMEwxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9sYWIubG9jYWxkb21haW4xIzAh BgNVBAMTGnJoZXYubGFiLmxvY2FsZG9tYWluLjI5MjE1ggIQADAJBgNVHRMEAjAA MA4GA1UdDwEB/wQEAwIFoDAgBgNVHSUBAf8EFjAUBggrBgEFBQcDAQYIKwYBBQUH AwIwDQYJKoZIhvcNAQEFBQADggEBADTCDg/lXc+rTVJSSc7fEvtEgBH4cI226DfA eEZqqKgvnG7vNKL+m3OZtA9ZPuPRqFC2DynLQdX4qTRNdPo8DByvxwzxsdmcgBUq /dSK6J/b8rWMH7uIY29tHmSZDn9IPDIi4S1XbPwsEVORzRLdCr+8BnzZ06HR7Q4V uhl78B8ueOSp1nFw4us6muWtBel48Bn35mgUIcm2+a7SwKOsBGnEWQ8pgUpgk0gn PybKCBXZR7r74ePjx4ZQEKl2r8yGRQxGs53TWGuBYI6aHCShnMVVA9onWHeHKz6I 16IvLMCQ0paRsbKXPDgz57eS2mMaugbAsdUfXRNQRIy9RFgKAEM= -----END CERTIFICATE----- 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-pkcs12-extract.sh', '--name=engine', '--passin=**FILTERED**', '--cert=-') stderr: MAC verified OK 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:918 execute-input: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-f', '/proc/self/fd/0') stdin: -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzqCXNhJPc/oW6hqxhPVq 8ESsrh9lOI7/VsyhettbvPdef6Oe00ocxOtbRYIad5lvrpvrwFxDWr1secdY2HRY GHTyKzvjVS7m7DnSJgaYE1mGcQ61Sd703saRPsKnYowIu7GHmY+r4UwSVdljzzez 7w4ooFBy6yk6JwVM2obaJtbJ6Ff2VqMMP9W4jdr8pqtKlGMhx59w3wzrklwJPiTJ 9FiVh6KGfia9es2Z22K81bslifTgBMZ6TKUIXJIRhHMVSXRxv9E6mx8EC2Rw0/U6 VqpFPQnf74I87ObQK3z5BbDEZE9Z8n7VnTtTGdD1EUmpNAbpvCtDHyY/LKN8T9C4 TwIDAQAB -----END PUBLIC KEY----- 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:828 execute: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-f', '/proc/self/fd/0'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.executeRaw:878 execute-result: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-f', '/proc/self/fd/0'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:936 execute-output: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-f', '/proc/self/fd/0') stdout: 2048 7e:fc:e9:fd:ce:e7:68:61:4d:13:f3:89:39:06:27:1a /proc/self/fd/0 (RSA) 2016-07-12 18:27:03 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ssh plugin.execute:941 execute-output: ('/usr/share/ovirt-engine/bin/pki-ssh-keygen.py', '-l', '-f', '/proc/self/fd/0') stderr: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND SSH fingerprint: 7e:fc:e9:fd:ce:e7:68:61:4d:13:f3:89:39:06:27:1a 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.pki.ca.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Internal CA BF:70:FE:C3:6D:7C:FC:ED:04:1E:F5:C5:92:BE:94:1D:82:9A:EC:85 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.core.advertise_dwh.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Note! If you want to gather statistical information you can install Reports and/or DWH: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND http://rhev.lab.localdomain:80/ovirt-engine/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.protocols.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Web access is enabled at: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND http://rhev.lab.localdomain:80/ovirt-engine 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND https://rhev.lab.localdomain:443/ovirt-engine 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.config.aaa.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Please use the user 'admin@internal' and password specified in order to login 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.base.network.firewall_manager.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_common.base.dialog.titles.Plugin._title_e_summary 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND --== END OF SUMMARY ==-- 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_common.base.system.hostile_services.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.sshd.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.fence_kdump_listener.config.Plugin._closeup 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service ovirt-fence-kdump-listener 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stderr: initctl: Unknown job: ovirt-fence-kdump-listener 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop') stdout: Stopping oVirt fence_kdump listener: [FAILED] 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-fence-kdump-listener', 'stop') stderr: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service ovirt-fence-kdump-listener 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stderr: initctl: Unknown job: ovirt-fence-kdump-listener 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-fence-kdump-listener', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-fence-kdump-listener', 'start'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-fence-kdump-listener', 'start') stdout: Starting oVirt fence_kdump listener: [ OK ] 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-fence-kdump-listener', 'start') stderr: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service ovirt-fence-kdump-listener startup to True 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-fence-kdump-listener') stderr: initctl: Unknown job: ovirt-fence-kdump-listener 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'ovirt-fence-kdump-listener', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'ovirt-fence-kdump-listener', 'on'), rc=0 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'ovirt-fence-kdump-listener', 'on') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'ovirt-fence-kdump-listener', 'on') stderr: 2016-07-12 18:27:03 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.system.engine.Plugin._closeup 2016-07-12 18:27:03 INFO otopi.plugins.ovirt_engine_setup.ovirt_engine.system.engine engine._closeup:53 Starting engine service 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service ovirt-engine 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine'), executable='None', cwd='None', env=None 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine'), rc=1 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stdout: 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stderr: initctl: Unknown job: ovirt-engine 2016-07-12 18:27:03 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-engine', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-engine', 'start'), rc=0 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-engine', 'start') stdout: Starting oVirt Engine: [ OK ] 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-engine', 'start') stderr: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service ovirt-engine startup to True 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-engine'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-engine'), rc=1 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-engine') stderr: initctl: Unknown job: ovirt-engine 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'ovirt-engine', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'ovirt-engine', 'on'), rc=0 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'ovirt-engine', 'on') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'ovirt-engine', 'on') stderr: 2016-07-12 18:27:07 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache.Plugin._closeup 2016-07-12 18:27:07 INFO otopi.plugins.ovirt_engine_common.ovirt_engine_common.system.apache apache._closeup:80 Restarting httpd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service httpd startup to True 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'httpd'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'httpd'), rc=1 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'httpd') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'httpd') stderr: initctl: Unknown job: httpd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'httpd', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'httpd', 'on'), rc=0 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'httpd', 'on') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'httpd', 'on') stderr: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service httpd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'httpd'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'httpd'), rc=1 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'httpd') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'httpd') stderr: initctl: Unknown job: httpd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'httpd', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'httpd', 'stop'), rc=0 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'httpd', 'stop') stdout: Stopping httpd: [FAILED] 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'httpd', 'stop') stderr: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service httpd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'httpd'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'httpd'), rc=1 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'httpd') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'httpd') stderr: initctl: Unknown job: httpd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'httpd', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'httpd', 'start'), rc=0 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'httpd', 'start') stdout: Starting httpd: [ OK ] 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'httpd', 'start') stderr: 2016-07-12 18:27:07 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.ovirt_engine.all-in-one.vdsmi.Plugin._closeup 2016-07-12 18:27:07 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:07 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system.Plugin._closeup 2016-07-12 18:27:07 INFO otopi.plugins.ovirt_engine_setup.vmconsole_proxy_helper.system system._closeup:87 Restarting ovirt-vmconsole proxy service 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service ovirt-vmconsole-proxy-sshd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd'), rc=1 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd') stderr: initctl: Unknown job: ovirt-vmconsole-proxy-sshd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'stop'), rc=0 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'stop') stdout: Stopping ovirt-vmconsole-proxy-sshd: [FAILED] 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'stop') stderr: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service ovirt-vmconsole-proxy-sshd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd'), rc=1 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd') stdout: 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd') stderr: initctl: Unknown job: ovirt-vmconsole-proxy-sshd 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:27:07 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'start'), rc=0 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'start') stdout: Starting ovirt-vmconsole-proxy-sshd: [ OK ] [ OK ] 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-vmconsole-proxy-sshd', 'start') stderr: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service ovirt-vmconsole-proxy-sshd startup to True 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd'), rc=1 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd') stdout: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-vmconsole-proxy-sshd') stderr: initctl: Unknown job: ovirt-vmconsole-proxy-sshd 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'ovirt-vmconsole-proxy-sshd', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'ovirt-vmconsole-proxy-sshd', 'on'), rc=0 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'ovirt-vmconsole-proxy-sshd', 'on') stdout: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'ovirt-vmconsole-proxy-sshd', 'on') stderr: 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.config.Plugin._closeup 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 stopping service ovirt-websocket-proxy 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), rc=1 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stdout: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stderr: initctl: Unknown job: ovirt-websocket-proxy 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-websocket-proxy', 'stop'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-websocket-proxy', 'stop'), rc=0 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'stop') stdout: Stopping oVirt Engine websockets proxy: [FAILED] 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'stop') stderr: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel rhel.state:186 starting service ovirt-websocket-proxy 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), rc=1 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stdout: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stderr: initctl: Unknown job: ovirt-websocket-proxy 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/service', 'ovirt-websocket-proxy', 'start'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/service', 'ovirt-websocket-proxy', 'start'), rc=0 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'start') stdout: Starting oVirt Engine websockets proxy: [ OK ] 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/service', 'ovirt-websocket-proxy', 'start') stderr: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel rhel.startup:154 set service ovirt-websocket-proxy startup to True 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy'), rc=1 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stdout: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/initctl', 'status', 'ovirt-websocket-proxy') stderr: initctl: Unknown job: ovirt-websocket-proxy 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:828 execute: ('/sbin/chkconfig', 'ovirt-websocket-proxy', 'on'), executable='None', cwd='None', env=None 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.executeRaw:878 execute-result: ('/sbin/chkconfig', 'ovirt-websocket-proxy', 'on'), rc=0 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:936 execute-output: ('/sbin/chkconfig', 'ovirt-websocket-proxy', 'on') stdout: 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.services.rhel plugin.execute:941 execute-output: ('/sbin/chkconfig', 'ovirt-websocket-proxy', 'on') stderr: 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage closeup METHOD otopi.plugins.otopi.system.reboot.Plugin._closeup 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:08 INFO otopi.context context.runSequence:427 Stage: Clean up 2016-07-12 18:27:08 DEBUG otopi.context context.runSequence:431 STAGE cleanup 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage cleanup METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._cleanup 2016-07-12 18:27:08 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:219 DIALOG:SEND Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage cleanup METHOD otopi.plugins.ovirt_engine_common.base.remote_engine.remote_engine.Plugin._cleanup 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage cleanup METHOD otopi.plugins.ovirt_engine_setup.websocket_proxy.pki.Plugin._cleanup 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage cleanup METHOD otopi.plugins.ovirt_engine_common.base.core.uninstall.Plugin._cleanup 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage cleanup METHOD otopi.plugins.ovirt_engine_common.base.core.answerfile.Plugin._cleanup 2016-07-12 18:27:08 INFO otopi.plugins.ovirt_engine_common.base.core.answerfile answerfile._cleanup:74 Generating answer file '/var/lib/ovirt-engine/setup/answers/20160712182708-setup.conf' 2016-07-12 18:27:08 INFO otopi.context context.runSequence:427 Stage: Pre-termination 2016-07-12 18:27:08 DEBUG otopi.context context.runSequence:431 STAGE pre-terminate 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage pre-terminate METHOD otopi.plugins.otopi.core.misc.Plugin._preTerminate 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:500 ENVIRONMENT DUMP - BEGIN 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/aborted=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/debug=int:'0' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/error=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/exceptionInfo=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/executionDirectory=str:'/' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/exitCode=list:'[{'priority': 90001, 'code': 0}]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/log=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/pluginGroups=str:'otopi:ovirt-engine-common:ovirt-engine-setup' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/pluginPath=str:'/usr/share/otopi/plugins:/usr/share/ovirt-engine/setup/bin/../plugins' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV BASE/suppressEnvironmentKeys=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/chkconfig=str:'/sbin/chkconfig' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/chronyc=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/date=str:'/bin/date' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/dig=str:'/usr/bin/dig' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/exportfs=str:'/usr/sbin/exportfs' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/firewall-cmd=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/hwclock=str:'/sbin/hwclock' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/initctl=str:'/sbin/initctl' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/ip=str:'/sbin/ip' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/ntpq=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/openssl=str:'/usr/bin/openssl' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/pg_dump=str:'/usr/bin/pg_dump' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/pg_restore=str:'/usr/bin/pg_restore' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/postgresql-setup=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/psql=str:'/usr/bin/psql' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rc=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rc-update=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/reboot=str:'/sbin/reboot' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/restorecon=str:'/sbin/restorecon' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/rpm=str:'/bin/rpm' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/selinuxenabled=str:'/usr/sbin/selinuxenabled' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/semanage=str:'/usr/sbin/semanage' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/service=str:'/sbin/service' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/sshd=str:'/usr/sbin/sshd' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/sysctl=str:'/sbin/sysctl' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV COMMAND/systemctl=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/configFileAppend=str:':/root/ovirt-engine-answers:/root/heanswers.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/configFileName=str:'/etc/ovirt-engine-setup.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/failOnPrioOverride=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/internalPackageTransaction=Transaction:'transaction' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logDir=str:'/var/log/ovirt-engine/setup' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileHandle=file:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileName=str:'/var/log/ovirt-engine/setup/ovirt-engine-setup-20160712182135-nq10m2.log' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFileNamePrefix=str:'ovirt-engine-setup' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilter=_MyLoggerFilter:'filter' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logFilterKeys=list:'['OVESETUP_DB/password', 'OVESETUP_CONFIG/adminPassword', 'OVESETUP_PKI/storePassword', 'OVESETUP_CONFIG/remoteEngineHostRootPassword']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/logRemoveAtExit=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/mainTransaction=Transaction:'transaction' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/modifiedFiles=list:'['/var/lib/pgsql/data/pg_hba.conf', '/var/lib/pgsql/data/postgresql.conf', '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf', '/etc/ovirt-engine/ovirt-websocket-proxy.conf.d/10-setup.conf', '/etc/ovirt-vmconsole/ovirt-vmconsole-proxy/conf.d/20-ovirt-vmconsole-proxy-helper.conf', '/etc/ovirt-engine/ovirt-vmconsole-proxy-helper.conf.d/10-setup.conf', '/etc/pki/ovirt-engine/keys/engine_id_rsa', '/etc/ovirt-engine/extensions.d/internal-authz.properties', '/etc/ovirt-engine/extensions.d/internal-authn.properties', '/etc/ovirt-engine/aaa/internal.properties', '/etc/ovirt-engine/logcollector.conf.d/10-engine-setup.conf', '/etc/ovirt-engine/imageuploader.conf.d/10-engine-setup.conf', '/etc/ovirt-engine/isouploader.conf.d/10-engine-setup.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-protocols.conf', '/etc/ovirt-engine/notifier/notifier.conf.d/10-setup-jboss.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-jboss.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-java.conf', '/etc/ovirt-engine/engine.conf.d/10-setup-database.conf', '/etc/httpd/conf.d/ovirt-engine-root-redirect.conf', '/etc/httpd/conf.d/z-ovirt-engine-proxy.conf', '/etc/ovirt-engine/iptables.example', '/etc/sysconfig/iptables']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV CORE/randomizeEvents=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/boundary=str:'--=451b80dc-996f-432e-9e4f-2b29ef6d1141=--' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/cliVersion=int:'1' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/customization=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV DIALOG/dialect=str:'human' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_NAME=str:'otopi' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV INFO/PACKAGE_VERSION=str:'1.4.1' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldAvailable=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldDisableServices=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/firewalldEnable=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesEnable=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/iptablesRules=str:'# Generated by ovirt-engine installer #filtering rules *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT -A INPUT -p udp -m state --state NEW -m udp --dport 7410 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 6100 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 2222 -j ACCEPT #drop all rule -A INPUT -j REJECT --reject-with icmp-host-prohibited COMMIT ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshEnable=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshKey=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK/sshUser=str:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-fence-kdump-listener=str:' ovirt-fence-kdump-listener oVirt configured fence_kdump listener service ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-http=str:' ovirt-http oVirt configured http service ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-https=str:' ovirt-https oVirt configured https service ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-postgres=str:' ovirt-postgres oVirt configured postgres service ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-vmconsole-proxy=str:' ovirt-vmconsole-proxy oVirt configured VM Console Proxy service ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV NETWORK_FIREWALLD_SERVICE/ovirt-websocket-proxy=str:' ovirt-websocket-proxy oVirt configured WebSocket Proxy service ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/enableUpgrade=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/requireRollback=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockApply=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc', 'rhevm', 'rhevm-backend', 'rhevm-dbscripts', 'rhevm-restapi', 'rhevm-tools', 'rhevm-tools-backup', 'rhevm-userportal', 'rhevm-webadmin-portal']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OSETUP_RPMDISTRO/versionLockFilter=list:'['redhat-support-plugin-rhev', 'ovirt-engine-extension-aaa-jdbc', 'rhevm']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/configure=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/continueWithoutAIO=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/enable=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localCluster=str:'local_cluster' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localDataCenter=str:'local_datacenter' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/localHost=str:'local_host' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/sshdPort=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainDefaultDir=str:'/var/lib/images' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainDir=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/storageDomainName=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/supported=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_AIO/vdsmCpu=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileOvirtEngine=str:'/etc/httpd/conf.d/z-ovirt-engine-proxy.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileOvirtRoot=str:'/etc/httpd/conf.d/ovirt-engine-root-redirect.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configFileSsl=str:'/etc/httpd/conf.d/ssl.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureRootRedirection=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureRootRedirectionDefault=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configureSsl=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/configured=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/enable=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/httpdService=str:'httpd' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_APACHE/needRestart=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ASYNC/clearTasks=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ASYNC/clearTasksWait=int:'20' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/addOvirtGlanceRepository=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminPassword=str:'**FILTERED**' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUser=str:'admin@internal' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserAuthzName=str:'internal-authz' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserAuthzType=str:'ovirt-engine-extension-aaa-jdbc' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserId=unicode:'087d8800-71e0-4010-95bb-5b39b8e97e93' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/adminUserNamespace=str:'*' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/applicationMode=str:'virt' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineDbBackupDir=str:'/var/lib/ovirt-engine/backups' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineHeapMax=str:'1967M' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineHeapMin=str:'1967M' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/engineServiceStopNeeded=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fenceKdumpListenerStopNeeded=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallChangesReview=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManager=str:'iptables' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/firewallManagers=list:'[, ]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdn=str:'rhev.lab.localdomain' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdnNonLoopback=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/fqdnReverseValidation=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/httpPort=int:'80' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/httpsPort=int:'443' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainACL=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainDefaultMountPoint=str:'/var/lib/exports/iso' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainExists=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainMountPoint=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainName=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainSdUuid=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoDomainStorageDir=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/isoPathsToUpload=list:'['/usr/share/virtio-win/virtio-win_x86.vfd', '/usr/share/virtio-win/virtio-win_amd64.vfd', '/usr/share/virtio-win/virtio-win.iso', '/usr/share/ovirt-guest-tools-iso/ovirt-tools-setup.iso', '/usr/share/rhev-guest-tools-iso/rhev-tools-setup.iso']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaHome=unicode:'/usr/lib/jvm/jre' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/javaNeeded=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossAjpPort=int:'8702' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDebugAddress=str:'127.0.0.1:8787' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDirectHttpPort=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossDirectHttpsPort=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHome=str:'/usr/share/jbossas' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHttpPort=int:'8080' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossHttpsPort=int:'8443' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/jbossNeeded=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/keySize=int:'2048' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/pkiRenewalDocUrl=str:'https://access.redhat.com/solutions/1572983' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/pkiWSPCSRFilename=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/publicHttpPort=int:'80' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/publicHttpsPort=int:'443' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostClientKey=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostKnownHosts=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostRootPassword=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineHostSshPort=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyle=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/remoteEngineSetupStyles=list:'[, ]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/sanWipeAfterDelete=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageIsLocal=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/storageType=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/totalMemoryMB=int:'7870' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/updateFirewall=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/validFirewallManagers=str:'iptables' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyConfig=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyHost=str:'localhost' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyPort=int:'6100' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CONFIG/websocketProxyStopNeeded=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/action=str:'setup' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/answerFile=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/developerMode=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/engineStop=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/generatePostInstall=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/generatedByVersion=str:'3.6.6.2' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/offlinePackager=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/originalGeneratedByVersion=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/reconfigureOptionalComponents=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/registerUninstallGroups=RegisterGroups:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/remoteEngine=RemoteEngine:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/setupAttributesModules=list:'[, , , , , ]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/uninstallUnremovableFiles=list:'['/etc/exports', '/etc/sysconfig/iptables', '/var/lib/pgsql/data/postgresql.conf', '/var/lib/pgsql/data/pg_hba.conf', '/etc/httpd/conf.d/ssl.conf', '/etc/yum/pluginconf.d/versionlock.list', '/etc/dnf/plugins/versionlock.list']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE/upgradeSupportedVersions=str:'3.0,3.1,3.2,3.3,3.4,3.5,3.6' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ca_config=list:'[['/etc/ovirt-engine/engine.conf.d/10-setup-pki.conf']]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ca_pki=list:'[[], ['/etc/pki/ovirt-engine/cert.template', '/etc/pki/ovirt-engine/cacert.template', '/etc/pki/ovirt-engine/ca.pem', '/etc/pki/ovirt-engine/private/ca.pem', '/etc/pki/ovirt-engine/.truststore', '/etc/pki/ovirt-engine/cacert.conf', '/etc/pki/ovirt-engine/cert.conf', '/etc/pki/ovirt-engine/apache-ca.pem', '/etc/pki/ovirt-engine/keys/engine', '/etc/pki/ovirt-engine/certs/engine', '/etc/pki/ovirt-engine/keys/jboss', '/etc/pki/ovirt-engine/certs/jboss', '/etc/pki/ovirt-engine/keys/websocket-proxy', '/etc/pki/ovirt-engine/certs/websocket-proxy', '/etc/pki/ovirt-engine/keys/websocket-proxy.key.nopass', '/etc/pki/ovirt-engine/certs/websocket-proxy.cer', '/etc/pki/ovirt-engine/keys/apache', '/etc/pki/ovirt-engine/certs/apache', '/etc/pki/ovirt-engine/keys/apache.key.nopass', '/etc/pki/ovirt-engine/certs/apache.cer', '/etc/pki/ovirt-engine/keys/reports', '/etc/pki/ovirt-engine/certs/reports', '/etc/pki/ovirt-engine/keys/reports.key.nopass', '/etc/pki/ovirt-engine/certs/reports.cer']]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/ssl=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/versionlock=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/vmconsole_proxy_helper_pki=list:'[['/etc/pki/ovirt-engine/certs/vmconsole-proxy-helper.cer', '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.p12', '/etc/pki/ovirt-engine/keys/vmconsole-proxy-helper.key.nopass']]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_FILE_GROUP/vmconsole_proxy_pki=list:'[['/etc/pki/ovirt-engine/certs/vmconsole-proxy-user-cert.pub', '/etc/pki/ovirt-engine/certs/vmconsole-proxy-host-cert.pub', '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa', '/etc/pki/ovirt-vmconsole/proxy-ssh_host_rsa-cert.pub', '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa', '/etc/pki/ovirt-vmconsole/proxy-ssh_user_rsa-cert.pub', '/etc/pki/ovirt-vmconsole/ca.pub']]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/ca_config=dict:'{}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/ca_pki=dict:'{}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/ssl=dict:'{'/etc/httpd/conf.d/ssl.conf': [{'removed': 'SSLCertificateFile /etc/pki/tls/certs/localhost.crt', 'added': '# SSLCertificateFile /etc/pki/tls/certs/localhost.crt'}, {'added': 'SSLCertificateFile /etc/pki/ovirt-engine/certs/apache.cer'}, {'removed': 'SSLCertificateKeyFile /etc/pki/tls/private/localhost.key', 'added': '# SSLCertificateKeyFile /etc/pki/tls/private/localhost.key'}, {'added': 'SSLCertificateKeyFile /etc/pki/ovirt-engine/keys/apache.key.nopass'}, {'added': 'SSLCACertificateFile /etc/pki/ovirt-engine/apache-ca.pem'}]}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/versionlock=dict:'{'/etc/yum/pluginconf.d/versionlock.list': [{'added': u'rhevm-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-userportal-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-dbscripts-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-tools-backup-3.6.6.2-0.1.el6.noarch'}, {'added': u'redhat-support-plugin-rhev-3.6.0-15.el6.noarch'}, {'added': u'rhevm-webadmin-portal-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-restapi-3.6.6.2-0.1.el6.noarch'}, {'added': u'ovirt-engine-extension-aaa-jdbc-1.0.7-2.el6ev.noarch'}, {'added': u'rhevm-tools-3.6.6.2-0.1.el6.noarch'}, {'added': u'rhevm-backend-3.6.6.2-0.1.el6.noarch'}]}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/vmconsole_proxy_helper_pki=dict:'{}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_CORE_MODIFIED_LINES_GROUP/vmconsole_proxy_pki=dict:'{}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/connection=connection:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/database=str:'engine' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/dumper=str:'pg_custom' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/filter=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/fixDbViolations=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/host=str:'localhost' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/newDatabase=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/password=str:'**FILTERED**' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/pgPassFile=str:'/tmp/tmpmJJtRQ' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/port=int:'5432' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/restoreJobs=int:'2' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/secured=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/securedHostValidation=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/statement=Statement:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/upgradeWithHeEl6Hosts=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DB/user=str:'engine' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DIALOG/confirmSettings=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/docsAreLocal=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/dwhDocUrl=str:'/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_DOCS/reportsDocUrl=str:'/docs/manual/en_US/html/Installation_Guide/chap-History_and_Reports.html' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ENGINE_CONFIG/fqdn=str:'rhev.lab.localdomain' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_ENGINE_CORE/enable=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldServices=list:'[{'directory': 'ovirt-common', 'name': 'ovirt-http'}, {'directory': 'ovirt-common', 'name': 'ovirt-https'}, {'directory': 'vmconsole-proxy', 'name': 'ovirt-vmconsole-proxy'}, {'directory': 'websocket-proxy', 'name': 'ovirt-websocket-proxy'}, {'directory': 'ovirt-engine', 'name': 'ovirt-fence-kdump-listener'}, {'directory': 'ovirt-common', 'name': 'ovirt-postgres'}]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_NETWORK/firewalldSubst=dict:'{'@WEBSOCKET_PROXY_PORT@': 6100, '@HTTPS_PORT@': 443, '@VMCONSOLE_PROXY_PORT@': 2222, '@HTTP_PORT@': 80, '@JBOSS_HTTPS_PORT@': None, '@JBOSS_HTTP_PORT@': None}' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/country=str:'US' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/organization=str:'lab.localdomain' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/renew=NoneType:'None' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/sshPublicKey=unicode:'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOoJc2Ek9z+hbqGrGE9WrwRKyuH2U4jv9WzKF621u8915/o57TShzE61tFghp3mW+um+vAXENavWx5x1jYdFgYdPIrO+NVLubsOdImBpgTWYZxDrVJ3vTexpE+wqdijAi7sYeZj6vhTBJV2WPPN7PvDiigUHLrKTonBUzahtom1snoV/ZWoww/1biN2vymq0qUYyHHn3DfDOuSXAk+JMn0WJWHooZ+Jr16zZnbYrzVuyWJ9OAExnpMpQhckhGEcxVJdHG/0TqbHwQLZHDT9TpWqkU9Cd/vgjzs5tArfPkFsMRkT1nyftWdO1MZ0PURSak0Bum8K0MfJj8so3xP0LhP' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PKI/storePassword=str:'**FILTERED**' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresConf=str:'/var/lib/pgsql/data/postgresql.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresLCMessages=str:''en_US.UTF-8'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresListenAddress=str:''*'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresMaxConn=int:'150' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresPgHba=str:'/var/lib/pgsql/data/pg_hba.conf' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresPgVersion=str:'/var/lib/pgsql/data/PG_VERSION' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_PROVISIONING/postgresService=str:'postgresql' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RHEVM_DIALOG/confirmUpgrade=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RHEVM_SUPPORT/redhatSupportProxyEnabled=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/aaaJdbcPackage=str:'ovirt-engine-extension-aaa-jdbc' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/additionalPackages=str:'ovirt-host-deploy,redhat-support-plugin-rhev,rhevm-branding-rhev,rhevm-cli,rhevm-doc,rhevm-image-uploader,rhevm-iso-uploader,rhevm-log-collector' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/enginePackages=str:'rhevm' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/engineSetupPackages=str:'rhevm-setup' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/jbossPackages=str:'' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesSetup=list:'['rhevm-setup', 'rhevm-setup-plugin-websocket-proxy']' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/packagesUpgradeList=list:'[{'packages': ['ovirt-engine-extension-aaa-jdbc']}, {'packages': ['rhevm', 'ovirt-host-deploy', 'redhat-support-plugin-rhev', 'rhevm-branding-rhev', 'rhevm-cli', 'rhevm-doc', 'rhevm-image-uploader', 'rhevm-iso-uploader', 'rhevm-log-collector'], 'group': 'rhevm36'}, {'packages': ['rhevm-websocket-proxy']}]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_RPMDISTRO/upgradeYumGroup=str:'rhevm36' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupEngine=str:'ovirt' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupKvm=str:'kvm' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/groupVmConsole=str:'ovirt-vmconsole' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/hostileServices=str:'ovirt-engine-dwhd,ovirt-engine-notifier' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckEnabled=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckMinimumMB=int:'4096' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckRecommendedMB=int:'16384' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/memCheckThreshold=int:'90' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsConfigEnabled=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsConfigEnabled_legacyInPostInstall=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/nfsServiceName=str:'nfs' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxBooleans=list:'[{'state': 'on', 'boolean': 'httpd_can_network_connect'}]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxContexts=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/selinuxRestorePaths=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/shmmax=int:'68719476736' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userApache=str:'apache' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userEngine=str:'ovirt' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userPostgres=str:'postgres' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userRoot=str:'root' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userVdsm=str:'vdsm' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_SYSTEM/userVmConsole=str:'ovirt-vmconsole' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyConfig=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_VMCONSOLE_PROXY_CONFIG/vmconsoleProxyPort=int:'2222' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_WSP_RPMDISRO_PACKAGES=str:'rhevm-websocket-proxy' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV OVESETUP_WSP_RPMDISRO_PACKAGES_SETUP=str:'rhevm-setup-plugin-websocket-proxy' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfDisabledPlugins=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfExpireCache=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfRollback=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/dnfpackagerEnabled=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/keepAliveInterval=int:'30' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumDisabledPlugins=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumEnabledPlugins=list:'[]' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumExpireCache=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumRollback=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV PACKAGER/yumpackagerEnabled=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/clockMaxGap=int:'5' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/clockSet=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/commandPath=str:'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/reboot=bool:'False' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/rebootAllow=bool:'True' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:510 ENV SYSTEM/rebootDeferTime=int:'10' 2016-07-12 18:27:08 DEBUG otopi.context context.dumpEnvironment:514 ENVIRONMENT DUMP - END 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage pre-terminate METHOD otopi.plugins.otopi.dialog.cli.Plugin._pre_terminate 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:08 INFO otopi.context context.runSequence:427 Stage: Termination 2016-07-12 18:27:08 DEBUG otopi.context context.runSequence:431 STAGE terminate 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage terminate METHOD otopi.plugins.ovirt_engine_common.base.core.misc.Plugin._terminate 2016-07-12 18:27:08 INFO otopi.plugins.ovirt_engine_common.base.core.misc misc._terminate:159 Execution of setup completed successfully 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage terminate METHOD otopi.plugins.otopi.dialog.human.Plugin._terminate 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage terminate METHOD otopi.plugins.otopi.dialog.machine.Plugin._terminate 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:148 condition False 2016-07-12 18:27:08 DEBUG otopi.context context._executeMethod:142 Stage terminate METHOD otopi.plugins.otopi.core.log.Plugin._terminate