diff --git a/deployment/mcollective/astute/examples/no_attrs.yaml b/deployment/mcollective/astute/examples/no_attrs.yaml new file mode 100644 index 0000000000..83670502f6 --- /dev/null +++ b/deployment/mcollective/astute/examples/no_attrs.yaml @@ -0,0 +1,12 @@ +--- +nodes: +- status: provisioned + role: controller + uid: devnailgun.mirantis.com +- status: provisioned + role: compute + uid: devnailgun.mirantis.com +attributes: + deployment_mode: multinode_compute + deployment_engine: simplepuppet +task_uuid: deployment_task diff --git a/deployment/mcollective/astute/examples/test_env.yaml b/deployment/mcollective/astute/examples/test_env.yaml new file mode 100644 index 0000000000..6a4eb91675 --- /dev/null +++ b/deployment/mcollective/astute/examples/test_env.yaml @@ -0,0 +1,85 @@ +--- +nodes: +- status: provisioned + network_data: + - gateway: 192.168.0.1 + name: management + netmask: 255.255.255.0 + vlan: 102 + ip: 192.168.0.2/24 + dev: eth0 + brd: 192.168.0.255 + - gateway: 240.0.1.1 + name: public + netmask: 255.255.255.0 + vlan: 101 + ip: 240.0.1.2/24 + dev: eth0 + brd: 240.0.1.255 + - name: floating + vlan: 120 + dev: eth0 + - name: fixed + vlan: 103 + dev: eth0 + - name: storage + vlan: 104 + dev: eth0 + role: controller + ip: 10.20.0.200 + uid: devnailgun.mirantis.com + mac: 52:54:00:0E:B8:F5 +- status: provisioned + network_data: + - gateway: 192.168.0.1 + name: management + netmask: 255.255.255.0 + vlan: 102 + ip: 192.168.0.3/24 + dev: eth0 + brd: 192.168.0.255 + - gateway: 240.0.1.1 + name: public + netmask: 255.255.255.0 + vlan: 101 + ip: 240.0.1.3/24 + dev: eth0 + brd: 240.0.1.255 + - name: floating + vlan: 120 + dev: eth0 + - name: fixed + vlan: 103 + dev: eth0 + - name: storage + vlan: 104 + dev: eth0 + role: compute + ip: 10.20.0.221 + uid: devnailgun.mirantis.com + mac: 52:54:00:50:91:DD +attributes: + deployment_mode: multinode_compute + deployment_engine: nailyfact + glance: + db_password: glance + user_password: glance + mysql: + root_password: nova + keystone: + db_password: admin + admin_tenant: admin + admin_token: admin + rabbit: + password: nova + user: nova + nova: + db_password: nova + user_password: nova + auto_assign_floating_ip: false + fixed_network_range: 10.0.0.0/24 + storage_network_range: 172.16.0.0/24 + floating_network_range: 240.0.0.0/24 + management_network_range: 192.168.0.0/24 + public_network_range: 240.0.1.0/24 +task_uuid: deployment_task diff --git a/deployment/mcollective/astute/lib/astute/logparser/deployment.rb b/deployment/mcollective/astute/lib/astute/logparser/deployment.rb new file mode 100644 index 0000000000..7f4929cf26 --- /dev/null +++ b/deployment/mcollective/astute/lib/astute/logparser/deployment.rb @@ -0,0 +1,156 @@ +module Astute + module LogParser + class ParseDeployLogs 'count-lines', + # 'endlog_patterns' => [{'pattern' => /Finished catalog run in [0-9]+\.[0-9]* seconds\n/, 'progress' => 1.0}], + # 'expected_line_number' => 500} + # Use custom separator if defined. + separator = pattern_spec['separator'] + counter = 0 + end_of_scope = false + previous_subchunk = '' + until end_of_scope + chunk = get_chunk(fo, pattern_spec['chunk_size']) + break unless chunk + # Trying to find separator on border between chunks. + subchunk = chunk.slice((1-separator.size)..-1) + # End of file reached. Exit from cycle. + end_of_scope = true unless subchunk + if subchunk and (subchunk + previous_subchunk).include?(separator) + # Separator found on border between chunks. Exit from cycle. + end_of_scope = true + continue + end + + pos = chunk.rindex(separator) + if pos + end_of_scope = true + chunk = chunk.slice((pos + separator.size)..-1) + end + counter += chunk.count("\n") + end + number = pattern_spec['expected_line_number'] + unless number + Astute.logger.warn("Wrong pattern #{pattern_spec.inspect} defined for calculating progress via log.") + return 0 + end + progress = counter.to_f / number + progress = 1 if progress > 1 + return progress + end + + def component_parser(fo, pattern_spec) + # Pattern specification example: + # pattern_spec = {'type' => 'components-list', + # 'chunk_size' => 40000, + # 'components_list' => [ + # {'name' => 'Horizon', 'weight' => 10, 'patterns' => [ + # {'pattern' => '/Stage[main]/Horizon/Package[mod_wsgi]/ensure) created', 'progress' => 0.1}, + # {'pattern' => '/Stage[main]/Horizon/File_line[horizon_redirect_rule]/ensure) created', 'progress' => 0.3}, + # {'pattern' => '/Stage[main]/Horizon/File[/etc/openstack-dashboard/local_settings]/group)', 'progress' => 0.7}, + # {'pattern' => '/Stage[main]/Horizon/Service[$::horizon::params::http_service]/ensure)'\ + # ' ensure changed \'stopped\' to \'running\'', 'progress' => 1}, + # ] + # }, + # ] + # } + # Use custom separator if defined. + separator = pattern_spec['separator'] + components_list = pattern_spec['components_list'] + unless components_list + Astute.logger.warn("Wrong pattern #{pattern_spec.inspect} defined for calculating progress via logs.") + return 0 + end + + chunk = get_chunk(fo, pos=pattern_spec['file_pos']) + return 0 unless chunk + pos = chunk.rindex(separator) + chunk = chunk.slice((pos + separator.size)..-1) if pos + block = chunk.split("\n") + + # Update progress of each component. + while block.any? + string = block.pop + components_list.each do |component| + matched_pattern = nil + component['patterns'].each do |pattern| + if pattern['regexp'] + matched_pattern = pattern if string.match(pattern['pattern']) + else + matched_pattern = pattern if string.include?(pattern['pattern']) + end + break if matched_pattern + end + if matched_pattern and + (not component['_progress'] or matched_pattern['progress'] > component['_progress']) + component['_progress'] = matched_pattern['progress'] + end + end + end + + # Calculate integral progress. + weighted_components = components_list.select{|n| n['weight']} + weight_sum = 0.0 + if weighted_components.any? + weighted_components.each{|n| weight_sum += n['weight']} + weight_sum = weight_sum * components_list.length / weighted_components.length + raise "Total weight of weighted components equal to zero." if weight_sum == 0 + end + nonweighted_delta = 1.0 / components_list.length + progress = 0 + components_list.each do |component| + component['_progress'] = 0.0 unless component['_progress'] + weight = component['weight'] + if weight + progress += component['_progress'] * weight / weight_sum + else + progress += component['_progress'] * nonweighted_delta + end + end + + return progress + end + end + end +end \ No newline at end of file diff --git a/deployment/mcollective/astute/lib/astute/logparser/parser_patterns.rb b/deployment/mcollective/astute/lib/astute/logparser/parser_patterns.rb new file mode 100644 index 0000000000..61fc3a3eca --- /dev/null +++ b/deployment/mcollective/astute/lib/astute/logparser/parser_patterns.rb @@ -0,0 +1,501 @@ +module Astute + module LogParser + module Patterns + def self.get_default_pattern(key) + return Marshal.load(Marshal.dump(@default_patterns[key])) + end + + def self.list_default_patterns + return @default_patterns.keys + end + + @default_patterns = { + 'anaconda-log-supposed-time-baremetal' => # key for default baremetal provision pattern + {'type' => 'supposed-time', + 'chunk_size' => 10000, + 'date_format' => '%Y-%m-%dT%H:%M:%S', + 'date_regexp' => '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}', + 'pattern_list' => [ + {'pattern' => 'Running anaconda script', 'supposed_time' => 60}, + {'pattern' => 'moving (1) to step enablefilesystems', 'supposed_time' => 3}, + {'pattern' => "notifying kernel of 'change' event on device", 'hdd_size_multiplier' => 0.3}, + {'pattern' => 'Preparing to install packages', 'supposed_time' => 9}, + {'pattern' => 'Installing glibc-common-2.12', 'supposed_time' => 9}, + {'pattern' => 'Installing bash-4.1.2', 'supposed_time' => 11}, + {'pattern' => 'Installing coreutils-8.4-19', 'supposed_time' => 20}, + {'pattern' => 'Installing centos-release-6-3', 'supposed_time' => 21}, + {'pattern' => 'Installing attr-2.4.44', 'supposed_time' => 23}, + {'pattern' => 'leaving (1) step installpackages', 'supposed_time' => 60}, + {'pattern' => 'moving (1) to step postscripts', 'supposed_time' => 4}, + {'pattern' => 'leaving (1) step postscripts', 'supposed_time' => 130}, + {'pattern' => 'wait while node rebooting', 'supposed_time' => 20}, + ].reverse, + 'filename' => 'install/anaconda.log' + }, + + 'anaconda-log-supposed-time-kvm' => # key for default kvm provision pattern + {'type' => 'supposed-time', + 'chunk_size' => 10000, + 'date_format' => '%Y-%m-%dT%H:%M:%S', + 'date_regexp' => '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}', + 'pattern_list' => [ + {'pattern' => 'Running anaconda script', 'supposed_time' => 60}, + {'pattern' => 'moving (1) to step enablefilesystems', 'supposed_time' => 3}, + {'pattern' => "notifying kernel of 'change' event on device", 'hdd_size_multiplier' => 1.5}, + {'pattern' => 'Preparing to install packages', 'supposed_time' => 12}, + {'pattern' => 'Installing glibc-common-2.12', 'supposed_time' => 15}, + {'pattern' => 'Installing bash-4.1.2', 'supposed_time' => 15}, + {'pattern' => 'Installing coreutils-8.4-19', 'supposed_time' => 33}, + {'pattern' => 'Installing centos-release-6-3', 'supposed_time' => 21}, + {'pattern' => 'Installing attr-2.4.44', 'supposed_time' => 48}, + {'pattern' => 'leaving (1) step installpackages', 'supposed_time' => 100}, + {'pattern' => 'moving (1) to step postscripts', 'supposed_time' => 4}, + {'pattern' => 'leaving (1) step postscripts', 'supposed_time' => 200}, + {'pattern' => 'wait while node rebooting', 'supposed_time' => 20}, + ].reverse, + 'filename' => 'install/anaconda.log' + }, + + 'puppet-log-components-list-ha_compute-controller' => # key for default HA deploy pattern + {'type' => 'components-list', + 'endlog_patterns' => [{'pattern' => /Finished catalog run in [0-9]+\.[0-9]* seconds\n/, 'progress' => 1.0}], + 'chunk_size' => 40000, + 'filename' => 'puppet-agent.log', + 'components_list' => [ + {'name' => 'Galera', 'weight' => 5, 'patterns' => [ + {'pattern' => '/Stage[main]/Galera/File[/etc/mysql]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Galera/Package[galera]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Galera/Package[MySQL-client]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Galera/Package[MySQL-server]/ensure) created', 'progress' => 0.6}, + {'pattern' => "/Stage[main]/Galera/Service[mysql-galera]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Galera/Exec[wait-for-synced-state]/returns) executed successfully', 'progress' => 0.9}, + {'pattern' => '/Stage[main]/Galera::Galera_master_final_config/Exec'\ + '[first-galera-node-final-config]/returns) executed successfully', 'progress' => 1}, + ] + }, + {'name' => 'Glance', 'weight' => 5, 'patterns' => [ + {'pattern' => '/Stage[main]/Glance/Package[glance]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Glance::Db::Mysql/Mysql::Db[glance]/Database[glance]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Glance::Db::Mysql/Glance::Db::Mysql::Host_access[]/'\ + 'Database_user[glance@]/ensure) created', 'progress' => 0.7}, + {'pattern' => '/Stage[main]/Glance::Registry/Glance_registry_config[keystone_authtoken/'\ + 'admin_user]/value) value changed', 'progress' => 0.71}, + {'pattern' => '/Stage[main]/Glance::Keystone::Auth/Keystone_endpoint[glance]/ensure) created', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Glance::Registry/Service[glance-registry]/ensure)"\ + " ensure changed 'stopped' to 'running'", 'progress' => 0.95}, + {'pattern' => "/Stage[main]/Glance::Api/Service[glance-api]/ensure) ensure changed"\ + " 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Haproxy', 'weight' => 5, 'patterns' => [ + {'pattern' => '/Stage[main]/Haproxy/Concat[/etc/haproxy/haproxy.cfg]/File[/var/lib/puppet/'\ + 'concat/_etc_haproxy_haproxy.cfg]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Haproxy/Concat[/etc/haproxy/haproxy.cfg]/File[/var/lib/puppet/'\ + 'concat/_etc_haproxy_haproxy.cfg/fragments.concat.out]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Haproxy/Concat[/etc/haproxy/haproxy.cfg]/Exec[concat_/etc/haproxy/'\ + 'haproxy.cfg]/returns) executed successfully', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Haproxy/Service[haproxy]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Horizon', 'weight' => 5, 'patterns' => [ + {'pattern' => '/Stage[main]/Horizon/Package[mod_wsgi]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Horizon/Package[openstack-dashboard]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Horizon/File[/etc/openstack-dashboard/'\ + 'local_settings]/content) content changed', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Horizon/Service[\$::horizon::params::http_service]/"\ + "ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Keepalived', 'weight' => 1, 'patterns' => [ + {'pattern' => '/Stage[main]/Keepalived::Install/Package[keepalived]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Keepalived::Config/Concat[/etc/keepalived/keepalived.conf]/'\ + 'File[/etc/keepalived/keepalived.conf]/content) content changed', 'progress' => 0.6}, + {'pattern' => "/Stage[main]/Keepalived::Service/Service[keepalived]/ensure) ensure"\ + " changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Keystone', 'weight' => 1, 'patterns' => [ + {'pattern' => '/Stage[main]/Keystone::Python/Package[python-keystone]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Keystone::Db::Mysql/Mysql::Db[keystone]/Database[keystone]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Keystone/Package[keystone]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Keystone/Keystone_config[DEFAULT/admin_port]/ensure) created', 'progress' => 0.7}, + {'pattern' => "/Stage[main]/Keystone/Service[keystone]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Keystone::Roles::Admin/Keystone_user_role[admin@admin]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Memcached', 'weight' => 1, 'patterns' => [ + {'pattern' => '/Stage[main]/Memcached/User[memcached]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Memcached/Package[memcached]/ensure) created', 'progress' => 0.4}, + {'pattern' => "/Stage[main]/Memcached/Service[memcached]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Rabbitmq', 'weight' => 1, 'patterns' => [ + {'pattern' => '/Stage[main]/Rabbitmq::Server/Package[rabbitmq-server]/ensure) created', 'progress' => 0.3}, + {'pattern' => "/Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]/ensure) ensure changed 'stopped' to 'running", 'progress' => 0.7}, + {'pattern' => '/Stage[main]/Rabbitmq::Server/Rabbitmq_user[guest]/ensure) removed', 'progress' => 1}, + ] + }, + {'name' => 'Rsync/Xinetd', 'weight' => 1, 'patterns' => [ + {'pattern' => '/Stage[main]/Xinetd/Package[xinetd]/ensure) created', 'progress' => 0.2}, + {'pattern' => '(/Stage[main]/Xinetd/File[/etc/xinetd.conf]/content) content changed', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Rsync::Server/File[/etc/rsync.d]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Rsync::Server/Xinetd::Service[rsync]/File[/etc/xinetd.d/rsync]/content) content changed', 'progress' => 1}, + ] + }, + {'name' => 'Swift', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Swift::Xfs/Package[xfsprogs]/ensure) created', 'progress' => 0.01}, + {'pattern' => '/Stage[main]/Swift/File[/etc/swift/swift.conf]/content) content changed', 'progress' => 0.05}, + {'pattern' => '/Stage[main]/Swift/File[/home/swift]/ensure) created', 'progress' => 0.07}, + {'pattern' => '/Stage[main]/Swift::Storage::All/File[/srv/node]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Swift::Storage::Account/Swift::Storage::Generic[account]/File'\ + '[/etc/swift/account-server/]/ensure) created', 'progress' => 0.12}, + {'pattern' => '/Stage[main]/Swift::Storage::Object/Swift::Storage::Generic[object]/Package'\ + '[swift-object]/ensure) created', 'progress' => 0.15}, + {'pattern' => "/Stage[main]/Swift::Storage::Account/Swift::Storage::Generic[account]/Service"\ + "[swift-account]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.18}, + {'pattern' => "/Stage[main]/Swift::Storage::Object/Swift::Storage::Generic[object]/Service"\ + "[swift-object]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Swift::Keystone::Auth/Keystone_service[swift]/ensure) created', 'progress' => 0.23}, + {'pattern' => '/Stage[main]/Swift::Keystone::Auth/Keystone_user_role[swift@services]/ensure) created', 'progress' => 0.28}, + {'pattern' => '/Stage\[main\]/Swift::Storage::Container/Ring_container_device\[[0-9.:]+\]/ensure\) created', + 'regexp' => true, 'progress' => 0.33}, + {'pattern' => "/Stage[main]/Swift::Storage::Account/Swift::Storage::Generic[account]/File[/etc/swift/"\ + "account-server/]/group) group changed 'root' to 'swift'", 'progress' => 0.36}, + {'pattern' => '/Stage[main]/Swift::Ringbuilder/Swift::Ringbuilder::Rebalance[object]/Exec'\ + '[hours_passed_object]/returns) executed successfully', 'progress' => 0.39}, + {'pattern' => '/Stage[main]/Swift::Ringbuilder/Swift::Ringbuilder::Rebalance[account]/Exec'\ + '[hours_passed_account]/returns) executed successfully', 'progress' => 0.42}, + {'pattern' => '/Stage[main]/Swift::Ringbuilder/Swift::Ringbuilder::Rebalance[account]/Exec'\ + '[rebalance_account]/returns) executed successfully', 'progress' => 0.44}, + {'pattern' => '/Stage[main]/Swift::Ringbuilder/Swift::Ringbuilder::Rebalance[container]/Exec'\ + '[hours_passed_container]/returns) executed successfully', 'progress' => 0.49}, + {'pattern' => '/Stage[main]/Swift::Ringbuilder/Swift::Ringbuilder::Rebalance[container]/Exec'\ + '[rebalance_container]/returns) executed successfully', 'progress' => 0.52}, + {'pattern' => '/Stage[main]/Swift::Proxy/Package[swift-proxy]/ensure) created', 'progress' => 0.55}, + {'pattern' => '/Service[swift-container-replicator]/ensure) ensure changed \'stopped\'', 'progress' => 0.9}, + {'pattern' => '/Service[swift-accaunt-replicator]/ensure) ensure changed \'stopped\'', 'progress' => 0.95}, + {'pattern' => '/Service[swift-object-replicator]/ensure) ensure changed \'stopped\'', 'progress' => 1}, + ] + }, + {'name' => 'Nova', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Utilities/Package[euca2ools]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[parted]/ensure) created', 'progress' => 0.11}, + {'pattern' => '/Stage[main]/Nova::Api/Nova::Generic_service[api]/Package[nova-api]/ensure) created', 'progress' => 0.13}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[unzip]/ensure) created', 'progress' => 0.15}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Package[python-numpy]/ensure) created', 'progress' => 0.2}, + {'pattern' => '(/Stage[main]/Nova::Utilities/Package[libguestfs-tools-c]/ensure) created', 'progress' => 0.25}, + {'pattern' => '/Stage[main]/Nova::Rabbitmq/Rabbitmq_user_permissions[nova@/]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Nova::Db::Mysql/Mysql::Db[nova]/Database[nova]/ensure) created', 'progress' => 0.35}, + {'pattern' => "/Stage[main]/Nova::Db::Mysql/Mysql::Db[nova]/Database_grant"\ + "[nova@127.0.0.1/nova]/privileges) privileges changed '' to 'all'", 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Nova::Generic_service[vncproxy]/Package'\ + '[nova-vncproxy]/ensure) created', 'progress' => 0.45}, + {'pattern' => '/Stage[main]/Nova::Keystone::Auth/Keystone_service[nova_volume]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Nova::Keystone::Auth/Keystone_user_role[nova@services]/ensure) created', 'progress' => 0.55}, + {'pattern' => '/Stage[main]/Nova/Exec[post-nova_config]/returns) Nova config has changed', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Nova::Api/Exec[nova-db-sync]/returns) executed successfully', 'progress' => 0.7}, + {'pattern' => "/Stage[main]/Nova::Consoleauth/Nova::Generic_service[consoleauth]/Service"\ + "[nova-consoleauth]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.85}, + {'pattern' => '/Stage[main]/Nova::Network/Nova::Manage::Network[nova-vm-net]/Nova_network'\ + 'nova-vm-net]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Openstack', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Openstack::Firewall/File[iptables]/ensure) defined content as', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Openstack::Glance/Package[swift]/ensure) created', 'progress' => 0.15}, + {'pattern' => '/Stage[main]/Openstack::Auth_file/File[/root/openrc]/ensure) defined content as', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Openstack::Controller_ha/Package[socat]/ensure) created', 'progress' => 0.25}, + {'pattern' => '/Stage[main]/Openstack::Swift::Storage-node/Swift::Storage::Loopback[1]/File[/srv/loopback-device]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Openstack::Controller_ha/Exec[wait-for-haproxy-mysql-backend]/returns) executed successfully', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Openstack::Controller/Nova_config[DEFAULT/memcached_servers]/ensure) created', 'progress' => 0.45}, + {'pattern' => '/Stage[main]/Openstack::Nova::Controller/Nova_config[DEFAULT/multi_host]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Openstack::Firewall/Exec[startup-firewall]/returns) executed successfully', 'progress' => 0.65}, + {'pattern' => '/Stage[main]/Openstack::Swift::Proxy/Ring_object_device\[[0-9.:]+\]/ensure\) created', + 'regexp' => true, 'progress' => 0.75}, + {'pattern' => '/Stage[main]/Openstack::Swift::Proxy/Ring_container_device\[[0-9.:]+\]/ensure\) created', + 'regexp' => true, 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Openstack::Img::Cirros/Package[cirros-testvm]/ensure) created', 'progress' => 1}, + ] + }, + ] + }, + + 'puppet-log-components-list-ha_compute-compute' => + {'type' => 'components-list', + 'endlog_patterns' => [{'pattern' => /Finished catalog run in [0-9]+\.[0-9]* seconds\n/, 'progress' => 1.0}], + 'chunk_size' => 40000, + 'filename' => 'puppet-agent.log', + 'components_list' => [ + {'name' => 'Keystone', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Keystone::Python/Package[python-keystone]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Mysql', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Mysql::Python/Package[python-mysqldb]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Nova', 'weight' => 5, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Utilities/Package[euca2ools]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[parted]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Nova::Api/Nova::Generic_service[api]/Package[nova-api]/ensure) created', 'progress' => 0.28}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[unzip]/ensure) created', 'progress' => 0.32}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Package[python-numpy]/ensure) created', 'progress' => 0.35}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[libguestfs-tools-c]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Nova::Rabbitmq/Rabbitmq_user_permissions[nova@/]/ensure) created', 'progress' => 0.43}, + {'pattern' => '/Stage[main]/Nova/Exec[post-nova_config]/returns) Nova config has changed', 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Nova::Api/Exec[nova-db-sync]/returns) executed successfully', 'progress' => 0.85}, + {'pattern' => '/Stage[main]/Nova::Network/Nova::Manage::Network[nova-vm-net]/Nova_network'\ + 'nova-vm-net]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Nova::Compute', 'weight' => 15, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Compute/Package[bridge-utils]/ensure) created', 'progress' => 0.15}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Exec[symlink-qemu-kvm]/returns) executed successfully', 'progress' => 0.25}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Package[libvirt]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Package[dnsmasq-utils]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Nova_config[DEFAULT/vncserver_listen]/ensure) created', 'progress' => 0.55}, + {'pattern' => '/Stage[main]/Nova::Compute/Nova::Generic_service[compute]/Package[nova-compute]/ensure) created', 'progress' => 0.88}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Package[avahi]/ensure) created', 'progress' => 0.9}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Service[messagebus]/ensure) ensure changed', 'progress' => 0.93}, + {'pattern' => '/Stage[main]/Nova::Compute/Nova::Generic_service[compute]/Service[nova-compute]/ensure) ensure changed', 'progress' => 0.97}, + {'pattern' => '/Stage[main]/Nova::Compute/Nova::Generic_service[compute]/Service[nova-compute]) Triggered', 'progress' => 1}, + ] + }, + {'name' => 'Openstack', 'weight' => 2, 'patterns' => [ + {'pattern' => '/Stage[main]/Openstack::Compute/Nova_config[DEFAULT/metadata_host]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Openstack::Compute/Nova_config[DEFAULT/memcached_servers]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Openstack::Compute/Augeas[sysconfig-libvirt]/returns) executed successfully', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Openstack::Compute/Nova_config[DEFAULT/multi_host]/ensure) created', 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Openstack::Compute/Augeas[libvirt-conf]/returns) executed successfully', 'progress' => 1}, + ] + }, + ] + }, + + 'puppet-log-components-list-singlenode_compute-controller' => + {'type' => 'components-list', + 'endlog_patterns' => [{'pattern' => /Finished catalog run in [0-9]+\.[0-9]* seconds\n/, 'progress' => 1.0}], + 'chunk_size' => 40000, + 'filename' => 'puppet-agent.log', + 'components_list' => [ + {'name' => 'Glance', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Glance/Package[glance]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Glance::Db::Mysql/Mysql::Db[glance]/Database[glance]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Glance::Db::Mysql/Glance::Db::Mysql::Host_access[]/'\ + 'Database_user[glance@]/ensure) created', 'progress' => 0.7}, + {'pattern' => '/Stage[main]/Glance::Registry/Glance_registry_config[keystone_authtoken/'\ + 'admin_user]/value) value changed', 'progress' => 0.71}, + {'pattern' => '/Stage[main]/Glance::Keystone::Auth/Keystone_endpoint[glance]/ensure) created', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Glance::Registry/Service[glance-registry]/ensure)"\ + " ensure changed 'stopped' to 'running'", 'progress' => 0.95}, + {'pattern' => "/Stage[main]/Glance::Api/Service[glance-api]/ensure) ensure changed"\ + " 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Horizon', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Horizon/Package[mod_wsgi]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Horizon/Package[openstack-dashboard]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Horizon/File[/etc/openstack-dashboard/'\ + 'local_settings]/content) content changed', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Horizon/Service[\$::horizon::params::http_service]/"\ + "ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Keystone', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Keystone::Python/Package[python-keystone]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Keystone::Db::Mysql/Mysql::Db[keystone]/Database[keystone]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Keystone/Package[keystone]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Keystone/Keystone_config[DEFAULT/admin_port]/ensure) created', 'progress' => 0.7}, + {'pattern' => "/Stage[main]/Keystone/Service[keystone]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Keystone::Roles::Admin/Keystone_user_role[admin@admin]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Memcached', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Memcached/User[memcached]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Memcached/Package[memcached]/ensure) created', 'progress' => 0.6}, + {'pattern' => "/Stage[main]/Memcached/Service[memcached]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Rabbitmq', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Rabbitmq::Server/Package[rabbitmq-server]/ensure) created', 'progress' => 0.3}, + {'pattern' => "/Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]/ensure) ensure changed 'stopped' to 'running", 'progress' => 0.7}, + {'pattern' => '/Stage[main]/Rabbitmq::Server/Rabbitmq_user[guest]/ensure) removed', 'progress' => 1}, + ] + }, + {'name' => 'Nova', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Utilities/Package[euca2ools]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[parted]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Nova::Api/Nova::Generic_service[api]/Package[nova-api]/ensure) created', 'progress' => 0.28}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[unzip]/ensure) created', 'progress' => 0.32}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Package[python-numpy]/ensure) created', 'progress' => 0.35}, + {'pattern' => '(/Stage[main]/Nova::Utilities/Package[libguestfs-tools-c]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Nova::Rabbitmq/Rabbitmq_user_permissions[nova@/]/ensure) created', 'progress' => 0.43}, + {'pattern' => '/Stage[main]/Nova::Db::Mysql/Mysql::Db[nova]/Database[nova]/ensure) created', 'progress' => 0.48}, + {'pattern' => "/Stage[main]/Nova::Db::Mysql/Mysql::Db[nova]/Database_grant"\ + "[nova@127.0.0.1/nova]/privileges) privileges changed '' to 'all'", 'progress' => 0.51}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Nova::Generic_service[vncproxy]/Package'\ + '[nova-vncproxy]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Nova::Keystone::Auth/Keystone_service[nova_volume]/ensure) created', 'progress' => 0.68}, + {'pattern' => '/Stage[main]/Nova::Keystone::Auth/Keystone_user_role[nova@services]/ensure) created', 'progress' => 0.75}, + {'pattern' => '/Stage[main]/Nova/Exec[post-nova_config]/returns) Nova config has changed', 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Nova::Api/Exec[nova-db-sync]/returns) executed successfully', 'progress' => 0.85}, + {'pattern' => "/Stage[main]/Nova::Consoleauth/Nova::Generic_service[consoleauth]/Service"\ + "[nova-consoleauth]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.9}, + {'pattern' => '/Stage[main]/Nova::Network/Nova::Manage::Network[nova-vm-net]/Nova_network'\ + 'nova-vm-net]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Openstack', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Openstack::Firewall/File[iptables]/ensure) defined content as', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Openstack::Glance/Package[swift]/ensure) created', 'progress' => 0.15}, + {'pattern' => '/Stage[main]/Openstack::Auth_file/File[/root/openrc]/ensure) defined content as', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Openstack::Controller/Nova_config[DEFAULT/memcached_servers]/ensure) created', 'progress' => 0.45}, + {'pattern' => '/Stage[main]/Openstack::Nova::Controller/Nova_config[DEFAULT/multi_host]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Openstack::Firewall/Exec[startup-firewall]/returns) executed successfully', 'progress' => 0.65}, + {'pattern' => '/Stage[main]/Openstack::Img::Cirros/Package[cirros-testvm]/ensure) created', 'progress' => 1}, + ] + }, + ] + }, + + 'puppet-log-components-list-multinode_compute-controller' => + {'type' => 'components-list', + 'endlog_patterns' => [{'pattern' => /Finished catalog run in [0-9]+\.[0-9]* seconds\n/, 'progress' => 1.0}], + 'chunk_size' => 40000, + 'filename' => 'puppet-agent.log', + 'components_list' => [ + {'name' => 'Glance', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Glance/Package[glance]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Glance::Db::Mysql/Mysql::Db[glance]/Database[glance]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Glance::Db::Mysql/Glance::Db::Mysql::Host_access[]/'\ + 'Database_user[glance@]/ensure) created', 'progress' => 0.7}, + {'pattern' => '/Stage[main]/Glance::Registry/Glance_registry_config[keystone_authtoken/'\ + 'admin_user]/value) value changed', 'progress' => 0.71}, + {'pattern' => '/Stage[main]/Glance::Keystone::Auth/Keystone_endpoint[glance]/ensure) created', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Glance::Registry/Service[glance-registry]/ensure)"\ + " ensure changed 'stopped' to 'running'", 'progress' => 0.95}, + {'pattern' => "/Stage[main]/Glance::Api/Service[glance-api]/ensure) ensure changed"\ + " 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Horizon', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Horizon/Package[mod_wsgi]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Horizon/Package[openstack-dashboard]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Horizon/File[/etc/openstack-dashboard/'\ + 'local_settings]/content) content changed', 'progress' => 0.8}, + {'pattern' => "/Stage[main]/Horizon/Service[\$::horizon::params::http_service]/"\ + "ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Keystone', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Keystone::Python/Package[python-keystone]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Keystone::Db::Mysql/Mysql::Db[keystone]/Database[keystone]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Keystone/Package[keystone]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Keystone/Keystone_config[DEFAULT/admin_port]/ensure) created', 'progress' => 0.7}, + {'pattern' => "/Stage[main]/Keystone/Service[keystone]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Keystone::Roles::Admin/Keystone_user_role[admin@admin]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Memcached', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Memcached/User[memcached]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Memcached/Package[memcached]/ensure) created', 'progress' => 0.6}, + {'pattern' => "/Stage[main]/Memcached/Service[memcached]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 1}, + ] + }, + {'name' => 'Rabbitmq', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Rabbitmq::Server/Package[rabbitmq-server]/ensure) created', 'progress' => 0.3}, + {'pattern' => "/Stage[main]/Rabbitmq::Service/Service[rabbitmq-server]/ensure) ensure changed 'stopped' to 'running", 'progress' => 0.7}, + {'pattern' => '/Stage[main]/Rabbitmq::Server/Rabbitmq_user[guest]/ensure) removed', 'progress' => 1}, + ] + }, + {'name' => 'Nova', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Utilities/Package[euca2ools]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[parted]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Nova::Api/Nova::Generic_service[api]/Package[nova-api]/ensure) created', 'progress' => 0.28}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[unzip]/ensure) created', 'progress' => 0.32}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Package[python-numpy]/ensure) created', 'progress' => 0.35}, + {'pattern' => '(/Stage[main]/Nova::Utilities/Package[libguestfs-tools-c]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Nova::Rabbitmq/Rabbitmq_user_permissions[nova@/]/ensure) created', 'progress' => 0.43}, + {'pattern' => '/Stage[main]/Nova::Db::Mysql/Mysql::Db[nova]/Database[nova]/ensure) created', 'progress' => 0.48}, + {'pattern' => "/Stage[main]/Nova::Db::Mysql/Mysql::Db[nova]/Database_grant"\ + "[nova@127.0.0.1/nova]/privileges) privileges changed '' to 'all'", 'progress' => 0.51}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Nova::Generic_service[vncproxy]/Package'\ + '[nova-vncproxy]/ensure) created', 'progress' => 0.6}, + {'pattern' => '/Stage[main]/Nova::Keystone::Auth/Keystone_service[nova_volume]/ensure) created', 'progress' => 0.68}, + {'pattern' => '/Stage[main]/Nova::Keystone::Auth/Keystone_user_role[nova@services]/ensure) created', 'progress' => 0.75}, + {'pattern' => '/Stage[main]/Nova/Exec[post-nova_config]/returns) Nova config has changed', 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Nova::Api/Exec[nova-db-sync]/returns) executed successfully', 'progress' => 0.85}, + {'pattern' => "/Stage[main]/Nova::Consoleauth/Nova::Generic_service[consoleauth]/Service"\ + "[nova-consoleauth]/ensure) ensure changed 'stopped' to 'running'", 'progress' => 0.9}, + {'pattern' => '/Stage[main]/Nova::Network/Nova::Manage::Network[nova-vm-net]/Nova_network'\ + 'nova-vm-net]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Openstack', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Openstack::Firewall/File[iptables]/ensure) defined content as', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Openstack::Glance/Package[swift]/ensure) created', 'progress' => 0.15}, + {'pattern' => '/Stage[main]/Openstack::Auth_file/File[/root/openrc]/ensure) defined content as', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Openstack::Controller/Nova_config[DEFAULT/memcached_servers]/ensure) created', 'progress' => 0.45}, + {'pattern' => '/Stage[main]/Openstack::Nova::Controller/Nova_config[DEFAULT/multi_host]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Openstack::Firewall/Exec[startup-firewall]/returns) executed successfully', 'progress' => 0.65}, + {'pattern' => '/Stage[main]/Openstack::Img::Cirros/Package[cirros-testvm]/ensure) created', 'progress' => 1}, + ] + }, + ] + }, + + 'puppet-log-components-list-multinode_compute-compute' => + {'type' => 'components-list', + 'endlog_patterns' => [{'pattern' => /Finished catalog run in [0-9]+\.[0-9]* seconds\n/, 'progress' => 1.0}], + 'chunk_size' => 40000, + 'filename' => 'puppet-agent.log', + 'components_list' => [ + {'name' => 'Keystone', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Keystone::Python/Package[python-keystone]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Mysql', 'weight' => 10, 'patterns' => [ + {'pattern' => '/Stage[main]/Mysql::Python/Package[python-mysqldb]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Nova', 'weight' => 5, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Utilities/Package[euca2ools]/ensure) created', 'progress' => 0.1}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[parted]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Nova::Api/Nova::Generic_service[api]/Package[nova-api]/ensure) created', 'progress' => 0.28}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[unzip]/ensure) created', 'progress' => 0.32}, + {'pattern' => '/Stage[main]/Nova::Vncproxy/Package[python-numpy]/ensure) created', 'progress' => 0.35}, + {'pattern' => '/Stage[main]/Nova::Utilities/Package[libguestfs-tools-c]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Nova::Rabbitmq/Rabbitmq_user_permissions[nova@/]/ensure) created', 'progress' => 0.43}, + {'pattern' => '/Stage[main]/Nova/Exec[post-nova_config]/returns) Nova config has changed', 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Nova::Api/Exec[nova-db-sync]/returns) executed successfully', 'progress' => 0.85}, + {'pattern' => '/Stage[main]/Nova::Network/Nova::Manage::Network[nova-vm-net]/Nova_network'\ + 'nova-vm-net]/ensure) created', 'progress' => 1}, + ] + }, + {'name' => 'Nova::Compute', 'weight' => 15, 'patterns' => [ + {'pattern' => '/Stage[main]/Nova::Compute/Package[bridge-utils]/ensure) created', 'progress' => 0.15}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Exec[symlink-qemu-kvm]/returns) executed successfully', 'progress' => 0.25}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Package[libvirt]/ensure) created', 'progress' => 0.3}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Package[dnsmasq-utils]/ensure) created', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Nova_config[DEFAULT/vncserver_listen]/ensure) created', 'progress' => 0.55}, + {'pattern' => '/Stage[main]/Nova::Compute/Nova::Generic_service[compute]/Package[nova-compute]/ensure) created', 'progress' => 0.88}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Package[avahi]/ensure) created', 'progress' => 0.9}, + {'pattern' => '/Stage[main]/Nova::Compute::Libvirt/Service[messagebus]/ensure) ensure changed', 'progress' => 0.93}, + {'pattern' => '/Stage[main]/Nova::Compute/Nova::Generic_service[compute]/Service[nova-compute]/ensure) ensure changed', 'progress' => 0.97}, + {'pattern' => '/Stage[main]/Nova::Compute/Nova::Generic_service[compute]/Service[nova-compute]) Triggered', 'progress' => 1}, + ] + }, + {'name' => 'Openstack', 'weight' => 2, 'patterns' => [ + {'pattern' => '/Stage[main]/Openstack::Compute/Nova_config[DEFAULT/metadata_host]/ensure) created', 'progress' => 0.2}, + {'pattern' => '/Stage[main]/Openstack::Compute/Nova_config[DEFAULT/memcached_servers]/ensure) created', 'progress' => 0.4}, + {'pattern' => '/Stage[main]/Openstack::Compute/Augeas[sysconfig-libvirt]/returns) executed successfully', 'progress' => 0.5}, + {'pattern' => '/Stage[main]/Openstack::Compute/Nova_config[DEFAULT/multi_host]/ensure) created', 'progress' => 0.8}, + {'pattern' => '/Stage[main]/Openstack::Compute/Augeas[libvirt-conf]/returns) executed successfully', 'progress' => 1}, + ] + }, + ] + }, + } + end + end +end \ No newline at end of file diff --git a/deployment/mcollective/astute/lib/astute/logparser/provision.rb b/deployment/mcollective/astute/lib/astute/logparser/provision.rb new file mode 100644 index 0000000000..95dcf9be16 --- /dev/null +++ b/deployment/mcollective/astute/lib/astute/logparser/provision.rb @@ -0,0 +1,239 @@ +require 'date' + +module Astute + module LogParser + class ParseProvisionLogs 'supposed-time', + # 'chunk_size' => 10000, + # 'date_format' => '%Y-%m-%dT%H:%M:%S', + # 'date_regexp' => '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}', + # 'pattern_list' => [ + # {'pattern' => 'Running anaconda script', 'supposed_time' => 60}, + # {'pattern' => 'moving (1) to step enablefilesystems', 'supposed_time' => 3}, + # {'pattern' => "notifying kernel of 'change' event on device", 'supposed_time' => 200}, + # {'pattern' => 'Preparing to install packages', 'supposed_time' => 9}, + # {'pattern' => 'Installing glibc-common-2.12', 'supposed_time' => 9}, + # {'pattern' => 'Installing bash-4.1.2', 'supposed_time' => 11}, + # {'pattern' => 'Installing coreutils-8.4-19', 'supposed_time' => 20}, + # {'pattern' => 'Installing centos-release-6-3', 'supposed_time' => 21}, + # {'pattern' => 'Installing attr-2.4.44', 'supposed_time' => 23}, + # {'pattern' => 'leaving (1) step installpackages', 'supposed_time' => 60}, + # {'pattern' => 'moving (1) to step postscripts', 'supposed_time' => 4}, + # {'pattern' => 'leaving (1) step postscripts', 'supposed_time' => 130}, + # ].reverse, + # 'filename' => 'install/anaconda.log' + # } + # Use custom separator if defined. + separator = pattern_spec['separator'] + log_patterns = pattern_spec['pattern_list'] + date_format = pattern_spec['date_format'] + date_regexp = pattern_spec['date_regexp'] + unless date_regexp and date_format and log_patterns + Astute.logger.warn("Wrong pattern_spec #{pattern_spec.inspect} defined for calculating progress via logs.") + return 0 + end + + def self.get_elapsed_time(patterns) + elapsed_time = 0 + patterns.each do |p| + if p['_progress'] + break + else + elapsed_time += p['supposed_time'] + end + end + return elapsed_time + end + + def self.get_progress(base_progress, elapsed_time, delta_time, supposed_time=nil) + return 1.0 if elapsed_time.zero? + k = (1.0 - base_progress) / elapsed_time + supposed_time ? surplus = delta_time - supposed_time : surplus = nil + if surplus and surplus > 0 + progress = supposed_time * k + surplus * k/3 + base_progress + else + progress = delta_time * k + base_progress + end + progress = 1.0 if progress > 1 + return progress + end + + def self.get_seconds_from_time(date) + hours, mins, secs, frac = Date::day_fraction_to_time(date) + return hours*60*60 + mins*60 + secs + end + + + chunk = get_chunk(fo, pattern_spec['chunk_size']) + return 0 unless chunk + pos = chunk.rindex(separator) + chunk = chunk.slice((pos + separator.size)..-1) if pos + block = chunk.split("\n") + + now = DateTime.now() + prev_time = pattern_spec['_prev_time'] ||= now + prev_progress = pattern_spec['_prev_progress'] ||= 0 + elapsed_time = pattern_spec['_elapsed_time'] ||= get_elapsed_time(log_patterns) + seconds_since_prev = get_seconds_from_time(now - prev_time) + + until block.empty? + string = block.pop + log_patterns.each do |pattern| + if string.include?(pattern['pattern']) + if pattern['_progress'] + # We not found any new messages. Calculate progress with old data. + progress = get_progress(prev_progress, elapsed_time, + seconds_since_prev, pattern['supposed_time']) + return progress + + else + # We found message that we never find before. We need to: + # calculate progress for this message; + # recalculate control point and elapsed_time; + # calculate progress for current time. + + # Trying to find timestamp of message. + date_string = string.match(date_regexp) + if date_string + # Get relative time when the message realy occured. + date = DateTime.strptime(date_string[0], date_format) - prev_time.offset + real_time = get_seconds_from_time(date - prev_time) + # Update progress of the message. + prev_supposed_time = log_patterns.select{|n| n['_progress'] == prev_progress}[0] + prev_supposed_time = prev_supposed_time['supposed_time'] if prev_supposed_time + progress = get_progress(prev_progress, elapsed_time, real_time, prev_supposed_time) + pattern['_progress'] = progress + # Recalculate elapsed time. + elapsed_time = pattern_spec['_elapsed_time'] = get_elapsed_time(log_patterns) + # Update time and progress for control point. + prev_time = pattern_spec['_prev_time'] = date + prev_progress = pattern_spec['_prev_progress'] = progress + seconds_since_prev = get_seconds_from_time(now - date) + # Calculate progress for current time. + progress = get_progress(prev_progress, elapsed_time, + seconds_since_prev, pattern['supposed_time']) + return progress + else + Astute.logger.info("Can't gather date (format: '#{date_regexp}') from string: #{string}") + end + end + end + end + end + # We found nothing. + progress = get_progress(prev_progress, elapsed_time, seconds_since_prev, log_patterns[0]['supposed_time']) + return progress + end + + def simple_pattern_finder(fo, pattern_spec) + # Pattern specification example: + # pattern_spec = {'type' => 'pattern-list', 'separator' => "custom separator\n", + # 'chunk_size' => 40000, + # 'pattern_list' => [ + # {'pattern' => 'Running kickstart %%pre script', 'progress' => 0.08}, + # {'pattern' => 'to step enablefilesystems', 'progress' => 0.09}, + # {'pattern' => 'to step reposetup', 'progress' => 0.13}, + # {'pattern' => 'to step installpackages', 'progress' => 0.16}, + # {'pattern' => 'Installing', + # 'number' => 210, # Now it install 205 packets. Add 5 packets for growth in future. + # 'p_min' => 0.16, # min percent + # 'p_max' => 0.87 # max percent + # }, + # {'pattern' => 'to step postinstallconfig', 'progress' => 0.87}, + # {'pattern' => 'to step dopostaction', 'progress' => 0.92}, + # ] + # } + # Use custom separator if defined. + separator = pattern_spec['separator'] + log_patterns = pattern_spec['pattern_list'] + unless log_patterns + Astute.logger.warn("Wrong pattern #{pattern_spec.inspect} defined for calculating progress via logs.") + return 0 + end + + chunk = get_chunk(fo, pattern_spec['chunk_size']) + # NOTE(mihgen): Following line fixes "undefined method `rindex' for nil:NilClass" for empty log file + return 0 unless chunk + pos = chunk.rindex(separator) + chunk = chunk.slice((pos + separator.size)..-1) if pos + block = chunk.split("\n") + return 0 unless block + while true + string = block.pop + return 0 unless string # If we found nothing + log_patterns.each do |pattern| + if string.include?(pattern['pattern']) + return pattern['progress'] if pattern['progress'] + if pattern['number'] + string = block.pop + counter = 1 + while string + counter += 1 if string.include?(pattern['pattern']) + string = block.pop + end + progress = counter.to_f / pattern['number'] + progress = 1 if progress > 1 + progress = pattern['p_min'] + progress * (pattern['p_max'] - pattern['p_min']) + return progress + end + Astute.logger.warn("Wrong pattern #{pattern_spec.inspect} defined for calculating progress via log.") + end + end + end + end + + end + end +end \ No newline at end of file