Bug 1251759

Summary: AttributeError: 'Config' object has no attribute '_files'
Product: [Retired] oVirt Reporter: Jacek Kowalski <kowalski>
Component: ovirt-hosted-engine-haAssignee: Doron Fediuck <dfediuck>
Status: CLOSED WONTFIX QA Contact: meital avital <mavital>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.6CC: bugs, ecohen, gklein, kowalski, lsurette, rbalakri, rgolan, yeylon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard: sla
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-11 12:05:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jacek Kowalski 2015-08-09 18:08:00 UTC
Description of problem:

Exception handling in ovirt_hosted_engine_ha/env/config.py uses undefined property _files:

raise Exception("Configuration value not found: file={0}, key={1}"
   .format(self._files.get(type, unknown), key))

So error "Configuration value not found" is never thrown - instead it causes "AttributeError" (see stacktrace below).


Version-Release number of selected component (if applicable):

ovirt-hosted-engine-ha-1.3.0-0.0.master.20150615153650.20150615153645.git5f8c290.el7.noarch


Actual results:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/agent/agent.py", line 185, in _run_agent
    host_id=host_id))
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/agent/agent.py", line 64, in action_proper
    he.start_monitoring()
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/agent/hosted_engine.py", line 378, in start_monitoring
    for old_state, state, delay in self.fsm:
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/lib/fsm/machine.py", line 125, in next
    new_data = self.refresh(self._state.data)
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/agent/state_machine.py", line 123, in refresh
    ] = self.hosted_engine.min_memory_threshold,
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/agent/hosted_engine.py", line 169, in min_memory_threshold
    return int(self._config.get(config.VM, config.MEM_SIZE))
  File "/usr/lib/python2.7/site-packages/ovirt_hosted_engine_ha/env/config.py", line 98, in get
    .format(self._files.get(type, unknown), key))
AttributeError: 'Config' object has no attribute '_files'


Expected results:

Configuration value not found: ...

Comment 1 Doron Fediuck 2015-08-10 10:01:52 UTC
Hi,
can you please provide some more details on what you were doing?
ie- is this a part of a normal installation? upgrade? were you using the appliance? 
Or was it an installed system. If so what was the trigger?

Please also attach relevant log files (vdsm, hosted engine files, setup if relevant).

Comment 2 Jacek Kowalski 2015-08-10 11:17:07 UTC
I've encountered this error when I accidentally deleted /var/lib/ovirt-hosted-engine-ha/vm.conf during setup and tried to recreate it manually - I omitted memSize. It should not happen in normal circumstances - yet I would prefer to get meaningful error message:

Error: 'Configuration value not found: file=/var/run/ovirt-hosted-engine-ha/vm.conf, key=memSize' - trying to restart agent

not:

AttributeError: 'Config' object has no attribute '_files'



Most likely self._files in ovirt_hosted_engine_ha/env/config.py should be replaced by some mix of self._dynamic_files and self._static_files

Comment 3 Doron Fediuck 2015-08-10 11:23:06 UTC
Roy,
in the official 3.6 release the above scenario won't be possible due to the move from local to shared configuration.

Is this correct?

Comment 4 Jacek Kowalski 2015-08-10 13:20:28 UTC
This issue was fixed in this CR request: https://gerrit.ovirt.org/#/c/44306 (https://gerrit.ovirt.org/#/c/44306/15/ovirt_hosted_engine_ha/env/config.py), which was accepted today.

Comment 5 Roy Golan 2015-08-11 12:05:40 UTC
Apparently that's an invalid case and also the vm.conf is moving to shared storage configuration which is controlled by ovirt-engine.