← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1314677] Re: nova-cells fails when using JSON file to store cell information

 

** Changed in: nova/icehouse
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1314677

Title:
  nova-cells fails when using JSON file to store cell information

Status in OpenStack Compute (Nova):
  Fix Released
Status in OpenStack Compute (nova) icehouse series:
  Fix Released
Status in nova package in Ubuntu:
  Fix Released
Status in nova source package in Trusty:
  Fix Released

Bug description:
  As recommended in http://docs.openstack.org/havana/config-
  reference/content/section_compute-cells.html#cell-config-optional-json
  I'm creating the nova-cells config with the cell information stored in
  a json file. However, when I do this nova-cells fails to start with
  this error in the logs:

  2014-04-29 11:52:05.240 16759 CRITICAL nova [-] __init__() takes exactly 3 arguments (1 given)
  2014-04-29 11:52:05.240 16759 TRACE nova Traceback (most recent call last):
  2014-04-29 11:52:05.240 16759 TRACE nova   File "/usr/bin/nova-cells", line 10, in <module>
  2014-04-29 11:52:05.240 16759 TRACE nova     sys.exit(main())
  2014-04-29 11:52:05.240 16759 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/cmd/cells.py", line 40, in main
  2014-04-29 11:52:05.240 16759 TRACE nova     manager=CONF.cells.manager)
  2014-04-29 11:52:05.240 16759 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 257, in create
  2014-04-29 11:52:05.240 16759 TRACE nova     db_allowed=db_allowed)
  2014-04-29 11:52:05.240 16759 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 139, in __init__
  2014-04-29 11:52:05.240 16759 TRACE nova     self.manager = manager_class(host=self.host, *args, **kwargs)
  2014-04-29 11:52:05.240 16759 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/cells/manager.py", line 87, in __init__
  2014-04-29 11:52:05.240 16759 TRACE nova     self.state_manager = cell_state_manager()
  2014-04-29 11:52:05.240 16759 TRACE nova TypeError: __init__() takes exactly 3 arguments (1 given)

  
  I have had a dig into the code and it appears that CellsManager creates an instance of CellStateManager with no arguments. CellStateManager __new__ runs and creates an instance of CellStateManagerFile which runs __new__ and __init__ with cell_state_cls and cells_config_path set. At this point __new__ returns CellStateManagerFile and the new instance's __init__() method is invoked (CellStateManagerFile.__init__) with the original arguments (there weren't any) which then results in the stack trace.

  It seems reasonable for CellStateManagerFile to derive the
  cells_config_path info for itself so I've patched it locally with

  === modified file 'state.py'
  --- state.py	2014-04-30 15:10:16 +0000
  +++ state.py	2014-04-30 15:10:26 +0000
  @@ -155,7 +155,7 @@
               config_path = CONF.find_file(cells_config)
               if not config_path:
                   raise cfg.ConfigFilesNotFoundError(config_files=[cells_config])
  -            return CellStateManagerFile(cell_state_cls, config_path)
  +            return CellStateManagerFile(cell_state_cls)
   
           return CellStateManagerDB(cell_state_cls)
   
  @@ -450,7 +450,9 @@
   
   
   class CellStateManagerFile(CellStateManager):
  -    def __init__(self, cell_state_cls, cells_config_path):
  +    def __init__(self, cell_state_cls=None):
  +        cells_config = CONF.cells.cells_config
  +        cells_config_path = CONF.find_file(cells_config)
           self.cells_config_path = cells_config_path
           super(CellStateManagerFile, self).__init__(cell_state_cls)
   

  
  Ubuntu: 14.04
  nova-cells: 1:2014.1-0ubuntu1

  nova.conf:

  [DEFAULT]
  dhcpbridge_flagfile=/etc/nova/nova.conf
  dhcpbridge=/usr/bin/nova-dhcpbridge
  logdir=/var/log/nova
  state_path=/var/lib/nova
  lock_path=/var/lock/nova
  force_dhcp_release=True
  iscsi_helper=tgtadm
  libvirt_use_virtio_for_bridges=True
  connection_type=libvirt
  root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
  verbose=True
  ec2_private_dns_show_ip=True
  api_paste_config=/etc/nova/api-paste.ini
  volumes_path=/var/lib/nova/volumes
  enabled_apis=ec2,osapi_compute,metadata
  auth_strategy=keystone
  compute_driver=libvirt.LibvirtDriver
  quota_driver=nova.quota.NoopQuotaDriver

  
  [cells]
  enable=True
  name=cell
  cell_type=compute
  cells_config=/etc/nova/cells.json

  
  cells.json: 
  {
      "parent": {
          "name": "parent",
          "api_url": "http://api.example.com:8774";,
          "transport_url": "rabbit://rabbit.example.com",
          "weight_offset": 0.0,
          "weight_scale": 1.0,
          "is_parent": true
      }
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1314677/+subscriptions


References