Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1272045

Summary: lago fails to initialize workspace - network
Product: [Community] ovirt-system-tests Reporter: Anatoly Litovsky <tlitovsk>
Component: CoreAssignee: Yaniv Bronhaim <ybronhei>
Status: CLOSED DEFERRED QA Contact: Pavel Stehlik <pstehlik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.2CC: bugs, dcaroest, fdeutsch, ylavi
Target Milestone: ---Flags: rule-engine: planning_ack?
rule-engine: devel_ack?
rule-engine: testing_ack?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-27 19:38:47 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 Anatoly Litovsky 2015-10-15 10:51:15 UTC
Description of problem:
Initializing workspace fails


Steps to Reproduce:
1.
lagocli init /
$PWD/testd-eployment /
/usr/share/ovirtlago/config/virt/centos7.json /
--template-repo-path=$PWD/lago-template-repositories/office.json


Actual results:

2015-10-15 13:43:49,651 - root - DEBUG - Running command: qemu-img create -f qcow2 -b /home/tlitovsk/workspace/ci/lago_var/store/in_office_repo:centos7_host:v5 /home/tlitovsk/workspace/ci/lago_run/test-deployment/images/host0_root.qcow2
2015-10-15 13:43:49,651 - root - DEBUG - Running command: ['qemu-img', 'create', '-f', 'qcow2', '-b', u'/home/tlitovsk/workspace/ci/lago_var/store/in_office_repo:centos7_host:v5', u'/home/tlitovsk/workspace/ci/lago_run/test-deployment/images/host0_root.qcow2']
2015-10-15 13:43:49,750 - root - DEBUG - command exit with 0
2015-10-15 13:43:49,751 - root - DEBUG - command stdout: Formatting '/home/tlitovsk/workspace/ci/lago_run/test-deployment/images/host0_root.qcow2', fmt=qcow2 size=53687091200 backing_file='/home/tlitovsk/workspace/ci/lago_var/store/in_office_repo:centos7_host:v5' encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16

2015-10-15 13:43:49,751 - root - INFO - Successfully created disk at /home/tlitovsk/workspace/ci/lago_run/test-deployment/images/host0_root.qcow2
2015-10-15 13:43:49,753 - root - ERROR - Error occured, aborting
Traceback (most recent call last):
  File "/usr/bin/lagocli", line 531, in main
    func(args)
  File "/usr/bin/lagocli", line 78, in do_init
    prefix.virt_conf(virt_conf, repo, store)
  File "/usr/lib/python2.7/site-packages/lago/__init__.py", line 348, in virt_conf
    self._config_net_topology(conf)
  File "/usr/lib/python2.7/site-packages/lago/__init__.py", line 220, in _config_net_topology
    self._allocate_ips_to_nics(conf)
  File "/usr/lib/python2.7/site-packages/lago/__init__.py", line 202, in _allocate_ips_to_nics
    net['gw'],
KeyError: 'gw'


Expected results:
success

Additional info:
version : lago-0.2-153_g948690d.fc22.noarch.rpm

Comment 1 Yaniv Bronhaim 2015-10-22 10:50:30 UTC
we don't always have gw declared in the specific net value. here you use :

    "nets": {
        "lago": {
            "type": "nat",
            "dhcp": {
                "start": 100,
                "end": 254
            },
            "management": true
        }
    }

which does not state the gateway - so we should use default value in 
lago/__init__.py line 202
its part of commit 59411f1
>>.
                vacant = _create_ip(                                            
                    net['gw'],                                                  
                    set(range(2, 255)).difference(                              
                        set(                                                    
                            [                                                   
                                int(ip.split('.')[-1]) for ip in allocated      
                            ]                                                   
                        )                                                       
                    ).pop()                                                     
                )   
<<<

Comment 2 David Caro 2016-01-27 19:38:47 UTC
Moved to https://github.com/lago-project/lago/issues/59