nova-compute get_connection cannot be found

Asked by fred yang

I am following http://wiki.openstack.org/InstallFromSource to install single node nova from nova-2011.2.tar.gz. (Is the link good for the installtion for Cactus?)
But I get instance always on "scheduling" and scheduler.log shows "NoValidHost: Scheduler was unable to locate a host for this request. Is the appropriate service running?"
I then run "bin/nova-compute" and got "Class get_connection cannot be found"
I have tried also launchpad trunk, got similar NoValiodHost, though I can install Bexar from source perfectly base on http://wiki.openstack.org/NovaInstall/Bexar
Did I missed any thing? Thanks,
(Was posted into wrong project)

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
fred yang
Solved:
Last query:
Last reply:
Revision history for this message
Vish Ishaya (vishvananda) said :
#1

It looks like you are missing a dependency. if you start nova-compute with --verbose you could get a debug message in the log with a little more info about which import failed. Once you know the missing import it is probably as simple as an apt-get or pip install.

Vish

On May 11, 2011, at 10:20 AM, fred yang wrote:

> Question #157068 on OpenStack Compute (nova) changed:
> https://answers.launchpad.net/nova/+question/157068
>
> Project: Glance => OpenStack Compute (nova)
>
> Description changed to:
> I am following http://wiki.openstack.org/InstallFromSource to install single node nova from nova-2011.2.tar.gz. (Is the link good for the installtion for Cactus?)
> But I get instance always on "scheduling" and scheduler.log shows "NoValidHost: Scheduler was unable to locate a host for this request. Is the appropriate service running?"
> I then run "bin/nova-compute" and got "Class get_connection cannot be found"
> I have tried also launchpad trunk, got similar NoValiodHost, though I can install Bexar from source perfectly base on http://wiki.openstack.org/NovaInstall/Bexar
> Did I missed any thing? Thanks,
> (Was posted into wrong project)
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).

Revision history for this message
fred yang (fred-yang) said :
#2

Debug output shows

2011-05-11 19:38:28,554 DEBUG nova.utils [-] Inner Exception: No module named glance from (pid=16719) import_class /home/fred/openstack/nova/nova/utils.py:65
2011-05-11 19:38:28,554 ERROR nova [-] in Service.create()
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File "/home/fred/openstack/nova/nova/service.py", line 275, in serve
(nova): TRACE: services = [Service.create()]
(nova): TRACE: File "/home/fred/openstack/nova/nova/service.py", line 173, in create
(nova): TRACE: report_interval, periodic_interval)
(nova): TRACE: File "/home/fred/openstack/nova/nova/service.py", line 73, in __init__
(nova): TRACE: self.manager = manager_class(host=self.host, *args, **kwargs)
(nova): TRACE: File "/home/fred/openstack/nova/nova/compute/manager.py", line 127, in __init__
(nova): TRACE: utils.import_object(compute_driver),
(nova): TRACE: File "/home/fred/openstack/nova/nova/utils.py", line 75, in import_object
(nova): TRACE: cls = import_class(import_str)
(nova): TRACE: File "/home/fred/openstack/nova/nova/utils.py", line 66, in import_class
(nova): TRACE: raise exception.NotFound(_('Class %s cannot be found') % class_str)

 utils.import_object(compute_driver) is defined as nova.virt.connection.get_connection
 and utils.py has following code
def import_class(import_str):
    """Returns a class from a string including module and class"""
    mod_str, _sep, class_str = import_str.rpartition('.')
    try:
        __import__(mod_str)
        return getattr(sys.modules[mod_str], class_str)
    except (ImportError, ValueError, AttributeError), exc:
        LOG.debug(_('Inner Exception: %s'), exc)
        raise exception.NotFound(_('Class %s cannot be found') % class_str)

def import_object(import_str):
    """Returns an object including a module or module and class"""
    try:
        __import__(import_str)
        return sys.modules[import_str]
    except ImportError:
        cls = import_class(import_str) <======== line#75
        return cls()

How can I fix it? Thanks,

Revision history for this message
fred yang (fred-yang) said :
#3

Ok, fixed glance import_class issue by adding --image_service=nova.image.local.LocalImageService into nova.conf.
Now the vm is always on "Networking" mode -
fred@stoky:~/openstack/nova$ euca-describe-instances
RESERVATION r-f28bcye7 Ras default
INSTANCE i-00000003 ami-60db44f3 networking nova_key (Ras, stoky) 0 m1.tiny 2011-05-12T06:01:39Z nova

Find network.log with following error, is this the possible issue?

2011-05-11 22:56:08,633 CRITICAL nova [-] f(ile) should be int, str, unicode or file, not <open GreenPipe '<fd:5>', mode 'wb' at 0x2fe0f80>
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File "./bin/nova-network", line 48, in <module>
(nova): TRACE: service.serve()
(nova): TRACE: File "/home/fred/openstack/nova/nova/service.py", line 295, in serve
(nova): TRACE: x.start()
(nova): TRACE: File "/home/fred/openstack/nova/nova/service.py", line 84, in start
(nova): TRACE: self.manager.init_host()
(nova): TRACE: File "/home/fred/openstack/nova/nova/network/manager.py", line 499, in init_host
(nova): TRACE: super(VlanManager, self).init_host()
(nova): TRACE: File "/home/fred/openstack/nova/nova/network/manager.py", line 128, in init_host
(nova): TRACE: self.driver.init_host()
(nova): TRACE: File "/home/fred/openstack/nova/nova/network/linux_net.py", line 378, in init_host
(nova): TRACE: iptables_manager.apply()
(nova): TRACE: File "/home/fred/openstack/nova/nova/utils.py", line 607, in inner
(nova): TRACE: retval = f(*args, **kwargs)
(nova): TRACE: File "/home/fred/openstack/nova/nova/network/linux_net.py", line 286, in apply
(nova): TRACE: attempts=5)
(nova): TRACE: File "/home/fred/openstack/nova/nova/network/linux_net.py", line 666, in _execute
(nova): TRACE: return utils.execute(*cmd, **kwargs)
(nova): TRACE: File "/home/fred/openstack/nova/nova/utils.py", line 158, in execute
(nova): TRACE: env=env)
(nova): TRACE: File "/usr/lib/pymodules/python2.6/eventlet/green/subprocess.py", line 31, in __init__
(nova): TRACE: wrapped_pipe = greenio.GreenPipe(pipe, pipe.mode, bufsize)
(nova): TRACE: File "/usr/lib/pymodules/python2.6/eventlet/greenio.py", line 376, in __init__
(nova): TRACE: raise TypeError('f(ile) should be int, str, unicode or file, not %r' % f)
(nova): TRACE: TypeError: f(ile) should be int, str, unicode or file, not <open GreenPipe '<fd:5>', mode 'wb' at 0x2fe0f80>
(nova): TRACE:

Revision history for this message
fred yang (fred-yang) said :
#4

 "--image_service=nova.image.local.LocalImageService" must be specified to fix glance import_class error, though Administrator guide indicates it is as default.
Thanks,

Revision history for this message
Vish Ishaya (vishvananda) said :
#5

Or you could just install glance via
apt-get install python-glance (if you are using the ppa)
or
pip install glance (+ any dependencies)
On May 12, 2011, at 6:16 AM, fred yang wrote:

> Question #157068 on OpenStack Compute (nova) changed:
> https://answers.launchpad.net/nova/+question/157068
>
> Status: Open => Solved
>
> fred yang confirmed that the question is solved:
> "--image_service=nova.image.local.LocalImageService" must be specified to fix glance import_class error, though Administrator guide indicates it is as default.
> Thanks,
>
> --
> You received this question notification because you are a member of Nova
> Core, which is an answer contact for OpenStack Compute (nova).