Actions
Bug #7344
closedunable to import interface facts for certiain network configuration
Description
while importing my laptop facts, I've got an exception:
We have following interfaces 'em1, virbr0, virbr1, virbr0_nic, virbr1_nic, wlp3s0' based on facts Interface em1 facts: {"macaddress"=>"28:d2:44:69:39:a9"} Interface virbr0 facts: {"ipaddress"=>"192.168.100.1", "macaddress"=>"52:54:00:43:ae:36", "netmask"=>"255.255.255.0", "network"=>"192.168.100.0"} Interface virbr1 facts: {"ipaddress"=>"192.168.223.1", "macaddress"=>"52:54:00:bd:fd:94", "netmask"=>"255.255.255.0", "network"=>"192.168.223.0"} Interface virbr0_nic facts: {"macaddress"=>"52:54:00:43:ae:36"} Interface virbr1_nic facts: {"macaddress"=>"52:54:00:bd:fd:94"} Interface wlp3s0 facts: {"ipaddress"=>"192.168.2.122", "macaddress"=>"7c:7a:91:90:b9:f6", "netmask"=>"255.255.255.0", "network"=>"192.168.2.0"} Skipping em1 since it is primary interface of host aristo-tlv-redhat-com.lan (0.1ms) BEGIN Setting Load (0.2ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = 'root_pass' ORDER BY name LIMIT 1 Host::Managed Load (0.3ms) SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 369 LIMIT 1 (0.3ms) SELECT MAX("audits"."version") AS max_id FROM "audits" WHERE "audits"."auditable_id" = 369 AND "audits"."auditable_type" = 'Host' SQL (0.4ms) INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "user_id", "user_type", "username", "version") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING "id" [["action", "update"], ["associated_id", nil], ["associated_name", nil], ["associated_type", nil], ["auditable_id", 369], ["auditable_name", "aristo-tlv-redhat-com.lan"], ["auditable_type", "Host"], ["audited_changes", "---\nmodel_id:\n- \n- 1\ndomain_id:\n- \n- 2\narchitecture_id:\n- \n- 1\noperatingsystem_id:\n- \n- 1\nmac:\n- ''\n- 28:d2:44:69:39:a9\nip:\n- \n- 192.168.100.1\nprimary_interface:\n- \n- em1\n"], ["comment", nil], ["created_at", Wed, 03 Sep 2014 20:51:09 UTC +00:00], ["remote_address", "127.0.0.1"], ["user_id", nil], ["user_type", nil], ["username", "Admin User"], ["version", 2]] (0.7ms) UPDATE "hosts" SET "model_id" = 1, "domain_id" = 2, "architecture_id" = 1, "operatingsystem_id" = 1, "mac" = '28:d2:44:69:39:a9', "ip" = '192.168.100.1', "primary_interface" = 'em1', "updated_at" = '2014-09-03 20:51:09.329837' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 369 SQL (0.2ms) UPDATE "lookup_values" SET "match" = 'fqdn=aristo-tlv-redhat-com.lan' WHERE "lookup_values"."match" = 'fqdn=aristo-tlv-redhat-com.lan' (7.6ms) COMMIT Nic::Base Load (0.4ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 369 AND "nics"."mac" = '52:54:00:43:ae:36' AND "nics"."virtual" = 'f' ORDER BY identifier LIMIT 1 Saving virbr0 NIC interface for host aristo-tlv-redhat-com.lan (0.1ms) BEGIN Nic::Base Exists (0.2ms) SELECT 1 AS one FROM "nics" WHERE ("nics"."mac" = '52:54:00:43:ae:36' AND "nics"."virtual" = 'f') LIMIT 1 SQL (0.4ms) SELECT "hosts"."mac" FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."mac" = '52:54:00:43:ae:36' LIMIT 1 Nic::Interface Exists (0.3ms) SELECT 1 AS one FROM "nics" WHERE "nics"."type" IN ('Nic::Interface', 'Nic::Managed', 'Nic::BMC') AND "nics"."ip" = '192.168.100.1' LIMIT 1 (0.1ms) ROLLBACK Validation failed: IP address Can't use the same value as the primary interface (ActiveRecord::RecordInvalid) /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/validations.rb:56:in `save!' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/attribute_methods/dirty.rb:33:in `save!' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/transactions.rb:264:in `block in save!' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/transactions.rb:208:in `transaction' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/transactions.rb:311:in `with_transaction_returning_status' /home/ohad/.gem/ruby/gems/activerecord-3.2.18/lib/active_record/transactions.rb:264:in `save!' /home/ohad/git/foreman/app/models/host/base.rb:203:in `set_interface' /home/ohad/git/foreman/app/models/host/base.rb:118:in `block in set_interfaces' /home/ohad/git/foreman/app/models/host/base.rb:94:in `each' /home/ohad/git/foreman/app/models/host/base.rb:94:in `set_interfaces' /home/ohad/git/foreman/app/models/host/base.rb:81:in `populate_fields_from_facts' /home/ohad/git/foreman/app/models/host/managed.rb:446:in `populate_fields_from_facts' /home/ohad/git/foreman/app/models/host/base.rb:59:in `import_facts' /home/ohad/git/foreman/app/models/host/managed.rb:435:in `import_host_and_facts' /home/ohad/git/foreman/app/controllers/api/v2/hosts_controller.rb:160:in `facts'
my network interface configuration is:
ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: em1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether 28:d2:44:69:39:a9 brd ff:ff:ff:ff:ff:ff 3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000 link/ether 7c:7a:91:90:b9:f6 brd ff:ff:ff:ff:ff:ff 4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default link/ether 52:54:00:43:ae:36 brd ff:ff:ff:ff:ff:ff 5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT group default qlen 500 link/ether 52:54:00:43:ae:36 brd ff:ff:ff:ff:ff:ff 6: virbr1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default link/ether 52:54:00:bd:fd:94 brd ff:ff:ff:ff:ff:ff 7: virbr1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr1 state DOWN mode DEFAULT group default qlen 500 link/ether 52:54:00:bd:fd:94 brd ff:ff:ff:ff:ff:ff
Updated by Marek Hulán about 10 years ago
Could you please try to apply this patch and retry?
diff --git a/app/services/fact_parser.rb b/app/services/fact_parser.rb
index 28ce9e8..1d3aa9f 100644
--- a/app/services/fact_parser.rb
+++ b/app/services/fact_parser.rb
@@ -1,7 +1,7 @@
class FactParser
delegate :logger, :to => :Rails
VIRTUAL = '\A([a-z0-9]+)_(\d+)\Z'
- BRIDGES = '\Abr\d+\Z'
+ BRIDGES = '\A(vir)?br\d+\Z'
VIRTUAL_NAMES = /#{VIRTUAL}|#{BRIDGES}/
def self.parser_for(type)
This would be just one part of a fix. We should make sure that we ignore and log interfaces that we can't save but we should not cancel the whole import.
Updated by Ohad Levy about 10 years ago
another system where this is observed:
ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br182 state UP mode DEFAULT qlen 1000 link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 3: em2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000 link/ether 84:8f:69:fe:26:fa brd ff:ff:ff:ff:ff:ff 4: br182: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 5: br183: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 6: br181: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 7: br180: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 8: em1.181@em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br181 state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 9: em1.180@em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br180 state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 10: em1.183@em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br183 state UP mode DEFAULT link/ether 84:8f:69:fe:26:f9 brd ff:ff:ff:ff:ff:ff 22: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br182 state UNKNOWN mode DEFAULT qlen 500 link/ether fe:54:00:de:af:b5 brd ff:ff:ff:ff:ff:ff
Updated by Dominic Cleal about 10 years ago
- Related to Feature #6444: Add ancestry NICs and allow interfaces with same MAC added
Updated by Dominic Cleal about 10 years ago
- Translation missing: en.field_release set to 21
Updated by Marek Hulán about 10 years ago
- Status changed from New to Assigned
- Assignee set to Marek Hulán
Updated by The Foreman Bot about 10 years ago
- Status changed from Assigned to Ready For Testing
- Target version set to 1.7.4
- Pull request https://github.com/theforeman/foreman/pull/1739 added
- Pull request deleted (
)
Updated by Marek Hulán about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 7106fab4be28d5ba591bb58842ad3d2996c79061.
Updated by Marek Hulán almost 8 years ago
- Related to Refactor #11442: When host is created from facts we don't trigger validations added
Actions