Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-07 Thread Joseph Suh
Heng,

You can print the values in the HostState class. If you want to monitor the 
changes of the values, for example, you can print (either directly or using 
LOG.debug()), the values in the code where you want monitor, for example, 
consume_from_instance().

Thanks,

Joseph


(w) 703-248-6160
(c) 571-340-2434
(f) 703-812-3712
http://www.east.isi.edu/~jsuh

Information Sciences Institute
University of Southern California
3811 N. Fairfax Drive Suite 200
Arlington, VA, 22203, USA


- Original Message -
From: Jay Pipes jaypi...@gmail.com
To: Heng Xu shouhengzhang...@mail.utoronto.ca
Cc: openstack@lists.launchpad.net
Sent: Monday, August 6, 2012 12:11:58 PM
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

On 08/04/2012 07:48 AM, Heng Xu wrote:
 But I tried a few things in HostState class, I ran into error, because I 
 could not monitor the stats in hoststates class as opposed to a database, is 
 there a way to check the stats in HostState class as exists in memory?

cc'ing Sandy Walsh, who is vastly more familiar with the scheduler than
I am :) Sandy, see Heng's question above... seems like a great question
to me -- and also a possible mini-project for someone to work on that
would add a scheduler-diagnostics extension if such functionality isn't
readily available.

Best,
-jay

 Heng
 
 From: Jay Pipes [jaypi...@gmail.com]
 Sent: Friday, August 03, 2012 4:38 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler
 
 On 08/03/2012 09:28 AM, Heng Xu wrote:
 Another questions is, I can get all the status of a computing node in the 
 mysql nova database, and select * from compute_node, but now I am using json 
 filter, the only field I have success with now is the free_ram_db, if my 
 hint uses free_disk_gb, then I always get error, but the database is showing 
 my compute node has $free_disk_gb equal 17, so I was wondering, where to 
 find exactly what kind of json field can use in json filter, thanks in 
 advance
 
 The nova.scheduler.host_manager.HostState class is what is checked for
 attributes, not the ComputeNode model. So, you need to use
 $free_disk_mb, not free_disk_gb.
 
 Best,
 -jay
 
 

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-07 Thread Sandy Walsh
Hi Heng,

I think Joseph has the best suggestion for tracking the HostState data 
currently. Either that or use nova-manage to open a python shell and query the 
database yourself. 

Another possibility (more more work) would be to create an API extension that 
could query the scheduler for this information. A plug-in is recommended since 
it wouldn't have to be deployed to production. 

But, in the short term, I would just add some debug statements in there to see 
what it actually has access to. Sorry I can't be more specific, but I haven't 
looked at the scheduler code in a long time and I'm not really sure how it has 
changed. It's nice to see that your looking into the json filter though. If 
you're still having problems let me know and I'll dig deeper.

Cheers,
Sandy


From: openstack-bounces+sandy.walsh=rackspace@lists.launchpad.net 
[openstack-bounces+sandy.walsh=rackspace@lists.launchpad.net] on behalf of 
Joseph Suh [j...@isi.edu]
Sent: Tuesday, August 07, 2012 8:01 AM
To: Heng Xu
Cc: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Heng,

You can print the values in the HostState class. If you want to monitor the 
changes of the values, for example, you can print (either directly or using 
LOG.debug()), the values in the code where you want monitor, for example, 
consume_from_instance().

Thanks,

Joseph


(w) 703-248-6160
(c) 571-340-2434
(f) 703-812-3712
http://www.east.isi.edu/~jsuh

Information Sciences Institute
University of Southern California
3811 N. Fairfax Drive Suite 200
Arlington, VA, 22203, USA


- Original Message -
From: Jay Pipes jaypi...@gmail.com
To: Heng Xu shouhengzhang...@mail.utoronto.ca
Cc: openstack@lists.launchpad.net
Sent: Monday, August 6, 2012 12:11:58 PM
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

On 08/04/2012 07:48 AM, Heng Xu wrote:
 But I tried a few things in HostState class, I ran into error, because I 
 could not monitor the stats in hoststates class as opposed to a database, is 
 there a way to check the stats in HostState class as exists in memory?

cc'ing Sandy Walsh, who is vastly more familiar with the scheduler than
I am :) Sandy, see Heng's question above... seems like a great question
to me -- and also a possible mini-project for someone to work on that
would add a scheduler-diagnostics extension if such functionality isn't
readily available.

Best,
-jay

 Heng
 
 From: Jay Pipes [jaypi...@gmail.com]
 Sent: Friday, August 03, 2012 4:38 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 On 08/03/2012 09:28 AM, Heng Xu wrote:
 Another questions is, I can get all the status of a computing node in the 
 mysql nova database, and select * from compute_node, but now I am using json 
 filter, the only field I have success with now is the free_ram_db, if my 
 hint uses free_disk_gb, then I always get error, but the database is showing 
 my compute node has $free_disk_gb equal 17, so I was wondering, where to 
 find exactly what kind of json field can use in json filter, thanks in 
 advance

 The nova.scheduler.host_manager.HostState class is what is checked for
 attributes, not the ComputeNode model. So, you need to use
 $free_disk_mb, not free_disk_gb.

 Best,
 -jay



___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-04 Thread Heng Xu
But I tried a few things in HostState class, I ran into error, because I could 
not monitor the stats in hoststates class as opposed to a database, is there a 
way to check the stats in HostState class as exists in memory?
Thank you.
Heng

From: Jay Pipes [jaypi...@gmail.com]
Sent: Friday, August 03, 2012 4:38 PM
To: Heng Xu
Cc: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

On 08/03/2012 09:28 AM, Heng Xu wrote:
 Another questions is, I can get all the status of a computing node in the 
 mysql nova database, and select * from compute_node, but now I am using json 
 filter, the only field I have success with now is the free_ram_db, if my hint 
 uses free_disk_gb, then I always get error, but the database is showing my 
 compute node has $free_disk_gb equal 17, so I was wondering, where to find 
 exactly what kind of json field can use in json filter, thanks in advance

The nova.scheduler.host_manager.HostState class is what is checked for
attributes, not the ComputeNode model. So, you need to use
$free_disk_mb, not free_disk_gb.

Best,
-jay



___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-03 Thread Heng Xu
Thank you guys, my issue is solved for the moment.
Sincerely, Heng


From: openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
[openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
behalf of Jay Pipes [jaypi...@gmail.com]
Sent: Friday, August 03, 2012 12:08 AM
To: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Sorry for top-posting, but there's not really a good place to inline
comment.

First, let's tackle logging in devstack...

When using devstack, you noticed that it logs to the screen session by
default. To make devstack ALSO log to a file, put the following in your
localrc:

LOG_COLOR=False
SCREEN_LOGDIR=/opt/stack/logs

And re-run stack.sh. You will now find the various service log files in
/opt/stack/logs.

Second, let's handle the JSON issue...

Nova isn't trying to decode a file. It's trying to JSON-decode the
string you're putting on the command line:

--hint query=['=','$free_ram_mb',1024]

The novaclient is passing the string ['=','$free_ram_mb',1024] to the
jsonutils.loads() function, which is what is failing. You can try
parsing this string yourself and see that the failure is raised the same
as appears in the log:

jpipes@uberbox:~/repos/tempest$ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type help, copyright, credits or license for more information.
 import json
 p = json.loads(['=','$free_ram_mb',1024])
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/json/__init__.py, line 326, in loads
return _default_decoder.decode(s)
  File /usr/lib/python2.7/json/decoder.py, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
raise ValueError(No JSON object could be decoded)
ValueError: No JSON object could be decoded

The problem is the string needs to be properly formatted JSON, and
single-quotes are not allowed -- you need to use double-quotes:

 p = json.loads('[=,$free_ram_mb,1024]')
 print p
[u'=', u'$free_ram_mb', 1024]

Try your command like this instead:

nova --debug boot --image 827d564a-e636-4fc4-a376-d36f7ebe1747 --flavor
1 --hint query='[=,$free_ram_mb,1024]' server1

And I think you should be fine, as the following proof shows:

jpipes@uberbox:~/repos/tempest$ echo '[=,$free_ram_mb,1024]' |
python -mjson.tool
[
=,
$free_ram_mb,
1024
]


Best,
-jay


On 08/02/2012 02:09 PM, Heng Xu wrote:
 Hi, attached is the json_filter file I was used, but I it just came with 
 devstack script installation, I did not even modify it.
 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 6:07 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Post your filter file. Might be a typo.

 PJ

 On Thu, Aug 2, 2012 at 1:02 PM, Heng Xu
 shouhengzhang...@mail.utoronto.ca wrote:
 Hi, I recorded the error message, below

 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/scheduler/filters/json_filter.py, line 141, in 
 host_passes
 2012-08-02 13:51:02 TRACE nova.rpc.amqp result = 
 self._process_filter(jsonutils.loads(query), host_state)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/openstack/common/jsonutils.py, line 123, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return json.loads(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/__init__.py, line 326, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return _default_decoder.decode(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 366, in decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp obj, end = self.raw_decode(s, 
 idx=_w(s, 0).end())
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp raise ValueError(No JSON object 
 could be decoded)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp ValueError: No JSON object could be 
 decoded
 2012-08-02 13:51:02 TRACE nova.rpc.amqp

 it seems that the filter cannot find my json file, so although I was using 
 the --hint functionality, whatever typed after the hint did not went to the 
 filter host_passed function, so it could not locate the json object, any 
 thoughts?
 Thanks. Heng

 
 From: 
 openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
 [openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
 behalf of Heng Xu [shouhengzhang...@mail.utoronto.ca]
 Sent: Thursday, August 02, 2012 4:47 PM
 To: Pengjun Pan
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi PJ

 I don't know what happen, I could not find the file in my

Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-03 Thread Heng Xu
Another questions is, I can get all the status of a computing node in the mysql 
nova database, and select * from compute_node, but now I am using json filter, 
the only field I have success with now is the free_ram_db, if my hint uses 
free_disk_gb, then I always get error, but the database is showing my compute 
node has $free_disk_gb equal 17, so I was wondering, where to find exactly what 
kind of json field can use in json filter, thanks in advance

Heng

From: openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
[openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
behalf of Heng Xu [shouhengzhang...@mail.utoronto.ca]
Sent: Friday, August 03, 2012 12:08 PM
To: Jay Pipes; openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Thank you guys, my issue is solved for the moment.
Sincerely, Heng


From: openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
[openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
behalf of Jay Pipes [jaypi...@gmail.com]
Sent: Friday, August 03, 2012 12:08 AM
To: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Sorry for top-posting, but there's not really a good place to inline
comment.

First, let's tackle logging in devstack...

When using devstack, you noticed that it logs to the screen session by
default. To make devstack ALSO log to a file, put the following in your
localrc:

LOG_COLOR=False
SCREEN_LOGDIR=/opt/stack/logs

And re-run stack.sh. You will now find the various service log files in
/opt/stack/logs.

Second, let's handle the JSON issue...

Nova isn't trying to decode a file. It's trying to JSON-decode the
string you're putting on the command line:

--hint query=['=','$free_ram_mb',1024]

The novaclient is passing the string ['=','$free_ram_mb',1024] to the
jsonutils.loads() function, which is what is failing. You can try
parsing this string yourself and see that the failure is raised the same
as appears in the log:

jpipes@uberbox:~/repos/tempest$ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type help, copyright, credits or license for more information.
 import json
 p = json.loads(['=','$free_ram_mb',1024])
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/json/__init__.py, line 326, in loads
return _default_decoder.decode(s)
  File /usr/lib/python2.7/json/decoder.py, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
raise ValueError(No JSON object could be decoded)
ValueError: No JSON object could be decoded

The problem is the string needs to be properly formatted JSON, and
single-quotes are not allowed -- you need to use double-quotes:

 p = json.loads('[=,$free_ram_mb,1024]')
 print p
[u'=', u'$free_ram_mb', 1024]

Try your command like this instead:

nova --debug boot --image 827d564a-e636-4fc4-a376-d36f7ebe1747 --flavor
1 --hint query='[=,$free_ram_mb,1024]' server1

And I think you should be fine, as the following proof shows:

jpipes@uberbox:~/repos/tempest$ echo '[=,$free_ram_mb,1024]' |
python -mjson.tool
[
=,
$free_ram_mb,
1024
]


Best,
-jay


On 08/02/2012 02:09 PM, Heng Xu wrote:
 Hi, attached is the json_filter file I was used, but I it just came with 
 devstack script installation, I did not even modify it.
 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 6:07 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Post your filter file. Might be a typo.

 PJ

 On Thu, Aug 2, 2012 at 1:02 PM, Heng Xu
 shouhengzhang...@mail.utoronto.ca wrote:
 Hi, I recorded the error message, below

 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/scheduler/filters/json_filter.py, line 141, in 
 host_passes
 2012-08-02 13:51:02 TRACE nova.rpc.amqp result = 
 self._process_filter(jsonutils.loads(query), host_state)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/openstack/common/jsonutils.py, line 123, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return json.loads(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/__init__.py, line 326, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return _default_decoder.decode(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 366, in decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp obj, end = self.raw_decode(s, 
 idx=_w(s, 0).end())
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp raise ValueError(No JSON object 
 could be decoded

Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-03 Thread Jay Pipes
On 08/03/2012 09:28 AM, Heng Xu wrote:
 Another questions is, I can get all the status of a computing node in the 
 mysql nova database, and select * from compute_node, but now I am using json 
 filter, the only field I have success with now is the free_ram_db, if my hint 
 uses free_disk_gb, then I always get error, but the database is showing my 
 compute node has $free_disk_gb equal 17, so I was wondering, where to find 
 exactly what kind of json field can use in json filter, thanks in advance

The nova.scheduler.host_manager.HostState class is what is checked for
attributes, not the ComputeNode model. So, you need to use
$free_disk_mb, not free_disk_gb.

Best,
-jay

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Heng Xu
Hello Joseph:
I am not sure where to find the log, so I just used the screen to n-sch,
and one of the error is 
TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
and I have no idea why this happened?
Thank you.
Heng


From: Joseph Suh [j...@isi.edu]
Sent: Thursday, August 02, 2012 3:28 PM
To: Heng Xu
Cc: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Heng,

Does scheduler log show any error message or complaints?

Thanks,

Joseph


(w) 703-248-6160
(f) 703-812-3712
http://www.east.isi.edu/~jsuh

Information Sciences Institute
University of Southern California
3811 N. Fairfax Drive Suite 200
Arlington, VA, 22203, USA


- Original Message -
From: Heng Xu shouhengzhang...@mail.utoronto.ca
To: openstack@lists.launchpad.net
Sent: Thursday, August 2, 2012 10:57:53 AM
Subject: [Openstack] Cannot pass hint to Nova Scheduler



Hi folks:
I am new to openstack, I am current trying to test the json filter, I changed 
my /etc/nova/nova.conf as follow

scheduler_driver=nova.
scheduler.multi.MultiScheduler
compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
scheduler_available_filters=nova.scheduler.filters.standard_filters
scheduler_default_filters=JsonFilter
least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
compute_fill_first_cost_fn_weight=-1.0

so I can use the json filter
however, when I was using it, if I boot a vm without any --hint to the 
scheduler, then the vm started fine, but if I use

nova --debug boot --image 827d564a-e636-4fc4-a376-
d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

my vm started with error, and the following were output from the command above

+-
+--+
| Property | Value |
+-+--+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | instance-002b |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | error |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | dKvrsv4MZtfc |
| config_drive | |
| created | 2012-08-02T14:25:10Z |
| flavor | m1.tiny |
| hostId | |
| id | 9d4a5855-3c69-40ba-b50d-3a2aa6a92edc |
| image | cirros-0.3.0-x86_64-uec |
| key_name | |
| metadata | {} |
| name | server1 |
| progress | 0 |
| status | BUILD |
| tenant_id | d99ffa1b0c43455ab8dbbd81cf4380a7 |
| updated | 2012-08-02T14:25:10Z |
| user_id | d5e02f1810a44575b99a147f94507da1 |
+-+--+

as you can see, the vm is in error, this also happens whenever I need to pass a 
hint to the scheduler, as in samehostfilter and differenthostfilter,

Does anyone know what's going on, thanks in advance.
Heng


___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Pengjun Pan
Hi Heng,

The log should be in /var/log/nova/nova-scheduler.log.

PJ

On Thu, Aug 2, 2012 at 10:44 AM, Heng Xu
shouhengzhang...@mail.utoronto.ca wrote:
 Hello Joseph:
 I am not sure where to find the log, so I just used the screen to n-sch,
 and one of the error is
 TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
 and I have no idea why this happened?
 Thank you.
 Heng

 
 From: Joseph Suh [j...@isi.edu]
 Sent: Thursday, August 02, 2012 3:28 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Heng,

 Does scheduler log show any error message or complaints?

 Thanks,

 Joseph

 
 (w) 703-248-6160
 (f) 703-812-3712
 http://www.east.isi.edu/~jsuh

 Information Sciences Institute
 University of Southern California
 3811 N. Fairfax Drive Suite 200
 Arlington, VA, 22203, USA


 - Original Message -
 From: Heng Xu shouhengzhang...@mail.utoronto.ca
 To: openstack@lists.launchpad.net
 Sent: Thursday, August 2, 2012 10:57:53 AM
 Subject: [Openstack] Cannot pass hint to Nova Scheduler



 Hi folks:
 I am new to openstack, I am current trying to test the json filter, I changed 
 my /etc/nova/nova.conf as follow

 scheduler_driver=nova.
 scheduler.multi.MultiScheduler
 compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
 volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
 scheduler_available_filters=nova.scheduler.filters.standard_filters
 scheduler_default_filters=JsonFilter
 least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
 compute_fill_first_cost_fn_weight=-1.0

 so I can use the json filter
 however, when I was using it, if I boot a vm without any --hint to the 
 scheduler, then the vm started fine, but if I use

 nova --debug boot --image 827d564a-e636-4fc4-a376-
 d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

 my vm started with error, and the following were output from the command above

 +-
 +--+
 | Property | Value |
 +-+--+
 | OS-DCF:diskConfig | MANUAL |
 | OS-EXT-SRV-ATTR:host | None |
 | OS-EXT-SRV-ATTR:hypervisor_hostname | None |
 | OS-EXT-SRV-ATTR:instance_name | instance-002b |
 | OS-EXT-STS:power_state | 0 |
 | OS-EXT-STS:task_state | scheduling |
 | OS-EXT-STS:vm_state | error |
 | accessIPv4 | |
 | accessIPv6 | |
 | adminPass | dKvrsv4MZtfc |
 | config_drive | |
 | created | 2012-08-02T14:25:10Z |
 | flavor | m1.tiny |
 | hostId | |
 | id | 9d4a5855-3c69-40ba-b50d-3a2aa6a92edc |
 | image | cirros-0.3.0-x86_64-uec |
 | key_name | |
 | metadata | {} |
 | name | server1 |
 | progress | 0 |
 | status | BUILD |
 | tenant_id | d99ffa1b0c43455ab8dbbd81cf4380a7 |
 | updated | 2012-08-02T14:25:10Z |
 | user_id | d5e02f1810a44575b99a147f94507da1 |
 +-+--+

 as you can see, the vm is in error, this also happens whenever I need to pass 
 a hint to the scheduler, as in samehostfilter and differenthostfilter,

 Does anyone know what's going on, thanks in advance.
 Heng


 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp



 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Heng Xu
Hi PJ

I don't know what happen, I could not find the file in my Ubuntu filesystem, I 
searched for it, no result, but I just used ./stack.sh to install it, I it is 
just me could not find the file? Any thoughts?
thank you

Heng

From: Pengjun Pan [panpeng...@gmail.com]
Sent: Thursday, August 02, 2012 4:42 PM
To: Heng Xu
Cc: Joseph Suh; openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Hi Heng,

The log should be in /var/log/nova/nova-scheduler.log.

PJ

On Thu, Aug 2, 2012 at 10:44 AM, Heng Xu
shouhengzhang...@mail.utoronto.ca wrote:
 Hello Joseph:
 I am not sure where to find the log, so I just used the screen to n-sch,
 and one of the error is
 TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
 and I have no idea why this happened?
 Thank you.
 Heng

 
 From: Joseph Suh [j...@isi.edu]
 Sent: Thursday, August 02, 2012 3:28 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Heng,

 Does scheduler log show any error message or complaints?

 Thanks,

 Joseph

 
 (w) 703-248-6160
 (f) 703-812-3712
 http://www.east.isi.edu/~jsuh

 Information Sciences Institute
 University of Southern California
 3811 N. Fairfax Drive Suite 200
 Arlington, VA, 22203, USA


 - Original Message -
 From: Heng Xu shouhengzhang...@mail.utoronto.ca
 To: openstack@lists.launchpad.net
 Sent: Thursday, August 2, 2012 10:57:53 AM
 Subject: [Openstack] Cannot pass hint to Nova Scheduler



 Hi folks:
 I am new to openstack, I am current trying to test the json filter, I changed 
 my /etc/nova/nova.conf as follow

 scheduler_driver=nova.
 scheduler.multi.MultiScheduler
 compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
 volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
 scheduler_available_filters=nova.scheduler.filters.standard_filters
 scheduler_default_filters=JsonFilter
 least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
 compute_fill_first_cost_fn_weight=-1.0

 so I can use the json filter
 however, when I was using it, if I boot a vm without any --hint to the 
 scheduler, then the vm started fine, but if I use

 nova --debug boot --image 827d564a-e636-4fc4-a376-
 d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

 my vm started with error, and the following were output from the command above

 +-
 +--+
 | Property | Value |
 +-+--+
 | OS-DCF:diskConfig | MANUAL |
 | OS-EXT-SRV-ATTR:host | None |
 | OS-EXT-SRV-ATTR:hypervisor_hostname | None |
 | OS-EXT-SRV-ATTR:instance_name | instance-002b |
 | OS-EXT-STS:power_state | 0 |
 | OS-EXT-STS:task_state | scheduling |
 | OS-EXT-STS:vm_state | error |
 | accessIPv4 | |
 | accessIPv6 | |
 | adminPass | dKvrsv4MZtfc |
 | config_drive | |
 | created | 2012-08-02T14:25:10Z |
 | flavor | m1.tiny |
 | hostId | |
 | id | 9d4a5855-3c69-40ba-b50d-3a2aa6a92edc |
 | image | cirros-0.3.0-x86_64-uec |
 | key_name | |
 | metadata | {} |
 | name | server1 |
 | progress | 0 |
 | status | BUILD |
 | tenant_id | d99ffa1b0c43455ab8dbbd81cf4380a7 |
 | updated | 2012-08-02T14:25:10Z |
 | user_id | d5e02f1810a44575b99a147f94507da1 |
 +-+--+

 as you can see, the vm is in error, this also happens whenever I need to pass 
 a hint to the scheduler, as in samehostfilter and differenthostfilter,

 Does anyone know what's going on, thanks in advance.
 Heng


 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp



 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Pengjun Pan
Hi Heng,

I didn't know that you were using devstack. The path I provided is for
manually installation of openstack. I didn't try it with devstack.

According to https://answers.launchpad.net/nova/+question/176973,
devstack outputs the log to the screen. Try Vish's suggestion.

Good luck.

PJ

On Thu, Aug 2, 2012 at 11:47 AM, Heng Xu
shouhengzhang...@mail.utoronto.ca wrote:
 Hi PJ

 I don't know what happen, I could not find the file in my Ubuntu filesystem, 
 I searched for it, no result, but I just used ./stack.sh to install it, I it 
 is just me could not find the file? Any thoughts?
 thank you

 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 4:42 PM
 To: Heng Xu
 Cc: Joseph Suh; openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi Heng,

 The log should be in /var/log/nova/nova-scheduler.log.

 PJ

 On Thu, Aug 2, 2012 at 10:44 AM, Heng Xu
 shouhengzhang...@mail.utoronto.ca wrote:
 Hello Joseph:
 I am not sure where to find the log, so I just used the screen to n-sch,
 and one of the error is
 TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
 and I have no idea why this happened?
 Thank you.
 Heng

 
 From: Joseph Suh [j...@isi.edu]
 Sent: Thursday, August 02, 2012 3:28 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Heng,

 Does scheduler log show any error message or complaints?

 Thanks,

 Joseph

 
 (w) 703-248-6160
 (f) 703-812-3712
 http://www.east.isi.edu/~jsuh

 Information Sciences Institute
 University of Southern California
 3811 N. Fairfax Drive Suite 200
 Arlington, VA, 22203, USA


 - Original Message -
 From: Heng Xu shouhengzhang...@mail.utoronto.ca
 To: openstack@lists.launchpad.net
 Sent: Thursday, August 2, 2012 10:57:53 AM
 Subject: [Openstack] Cannot pass hint to Nova Scheduler



 Hi folks:
 I am new to openstack, I am current trying to test the json filter, I 
 changed my /etc/nova/nova.conf as follow

 scheduler_driver=nova.
 scheduler.multi.MultiScheduler
 compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
 volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
 scheduler_available_filters=nova.scheduler.filters.standard_filters
 scheduler_default_filters=JsonFilter
 least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
 compute_fill_first_cost_fn_weight=-1.0

 so I can use the json filter
 however, when I was using it, if I boot a vm without any --hint to the 
 scheduler, then the vm started fine, but if I use

 nova --debug boot --image 827d564a-e636-4fc4-a376-
 d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

 my vm started with error, and the following were output from the command 
 above

 +-
 +--+
 | Property | Value |
 +-+--+
 | OS-DCF:diskConfig | MANUAL |
 | OS-EXT-SRV-ATTR:host | None |
 | OS-EXT-SRV-ATTR:hypervisor_hostname | None |
 | OS-EXT-SRV-ATTR:instance_name | instance-002b |
 | OS-EXT-STS:power_state | 0 |
 | OS-EXT-STS:task_state | scheduling |
 | OS-EXT-STS:vm_state | error |
 | accessIPv4 | |
 | accessIPv6 | |
 | adminPass | dKvrsv4MZtfc |
 | config_drive | |
 | created | 2012-08-02T14:25:10Z |
 | flavor | m1.tiny |
 | hostId | |
 | id | 9d4a5855-3c69-40ba-b50d-3a2aa6a92edc |
 | image | cirros-0.3.0-x86_64-uec |
 | key_name | |
 | metadata | {} |
 | name | server1 |
 | progress | 0 |
 | status | BUILD |
 | tenant_id | d99ffa1b0c43455ab8dbbd81cf4380a7 |
 | updated | 2012-08-02T14:25:10Z |
 | user_id | d5e02f1810a44575b99a147f94507da1 |
 +-+--+

 as you can see, the vm is in error, this also happens whenever I need to 
 pass a hint to the scheduler, as in samehostfilter and differenthostfilter,

 Does anyone know what's going on, thanks in advance.
 Heng


 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp



 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp



___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Heng Xu
Hi, I recorded the error message, below

2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
/opt/stack/nova/nova/scheduler/filters/json_filter.py, line 141, in 
host_passes
2012-08-02 13:51:02 TRACE nova.rpc.amqp result = 
self._process_filter(jsonutils.loads(query), host_state)
2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
/opt/stack/nova/nova/openstack/common/jsonutils.py, line 123, in loads
2012-08-02 13:51:02 TRACE nova.rpc.amqp return json.loads(s)
2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
/usr/lib/python2.7/json/__init__.py, line 326, in loads
2012-08-02 13:51:02 TRACE nova.rpc.amqp return _default_decoder.decode(s)
2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
/usr/lib/python2.7/json/decoder.py, line 366, in decode
2012-08-02 13:51:02 TRACE nova.rpc.amqp obj, end = self.raw_decode(s, 
idx=_w(s, 0).end())
2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
/usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
2012-08-02 13:51:02 TRACE nova.rpc.amqp raise ValueError(No JSON object 
could be decoded)
2012-08-02 13:51:02 TRACE nova.rpc.amqp ValueError: No JSON object could be 
decoded
2012-08-02 13:51:02 TRACE nova.rpc.amqp 

it seems that the filter cannot find my json file, so although I was using the 
--hint functionality, whatever typed after the hint did not went to the filter 
host_passed function, so it could not locate the json object, any thoughts?
Thanks. Heng


From: openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
[openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
behalf of Heng Xu [shouhengzhang...@mail.utoronto.ca]
Sent: Thursday, August 02, 2012 4:47 PM
To: Pengjun Pan
Cc: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Hi PJ

I don't know what happen, I could not find the file in my Ubuntu filesystem, I 
searched for it, no result, but I just used ./stack.sh to install it, I it is 
just me could not find the file? Any thoughts?
thank you

Heng

From: Pengjun Pan [panpeng...@gmail.com]
Sent: Thursday, August 02, 2012 4:42 PM
To: Heng Xu
Cc: Joseph Suh; openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Hi Heng,

The log should be in /var/log/nova/nova-scheduler.log.

PJ

On Thu, Aug 2, 2012 at 10:44 AM, Heng Xu
shouhengzhang...@mail.utoronto.ca wrote:
 Hello Joseph:
 I am not sure where to find the log, so I just used the screen to n-sch,
 and one of the error is
 TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
 and I have no idea why this happened?
 Thank you.
 Heng

 
 From: Joseph Suh [j...@isi.edu]
 Sent: Thursday, August 02, 2012 3:28 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Heng,

 Does scheduler log show any error message or complaints?

 Thanks,

 Joseph

 
 (w) 703-248-6160
 (f) 703-812-3712
 http://www.east.isi.edu/~jsuh

 Information Sciences Institute
 University of Southern California
 3811 N. Fairfax Drive Suite 200
 Arlington, VA, 22203, USA


 - Original Message -
 From: Heng Xu shouhengzhang...@mail.utoronto.ca
 To: openstack@lists.launchpad.net
 Sent: Thursday, August 2, 2012 10:57:53 AM
 Subject: [Openstack] Cannot pass hint to Nova Scheduler



 Hi folks:
 I am new to openstack, I am current trying to test the json filter, I changed 
 my /etc/nova/nova.conf as follow

 scheduler_driver=nova.
 scheduler.multi.MultiScheduler
 compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
 volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
 scheduler_available_filters=nova.scheduler.filters.standard_filters
 scheduler_default_filters=JsonFilter
 least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
 compute_fill_first_cost_fn_weight=-1.0

 so I can use the json filter
 however, when I was using it, if I boot a vm without any --hint to the 
 scheduler, then the vm started fine, but if I use

 nova --debug boot --image 827d564a-e636-4fc4-a376-
 d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

 my vm started with error, and the following were output from the command above

 +-
 +--+
 | Property | Value |
 +-+--+
 | OS-DCF:diskConfig | MANUAL |
 | OS-EXT-SRV-ATTR:host | None |
 | OS-EXT-SRV-ATTR:hypervisor_hostname | None |
 | OS-EXT-SRV-ATTR:instance_name | instance-002b |
 | OS-EXT-STS:power_state | 0 |
 | OS-EXT-STS:task_state | scheduling |
 | OS-EXT-STS:vm_state | error |
 | accessIPv4 | |
 | accessIPv6 | |
 | adminPass | dKvrsv4MZtfc |
 | config_drive | |
 | created | 2012-08-02T14:25:10Z |
 | flavor | m1.tiny |
 | hostId | |
 | id | 9d4a5855-3c69-40ba-b50d-3a2aa6a92edc |
 | image

Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Pengjun Pan
Post your filter file. Might be a typo.

PJ

On Thu, Aug 2, 2012 at 1:02 PM, Heng Xu
shouhengzhang...@mail.utoronto.ca wrote:
 Hi, I recorded the error message, below

 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/scheduler/filters/json_filter.py, line 141, in 
 host_passes
 2012-08-02 13:51:02 TRACE nova.rpc.amqp result = 
 self._process_filter(jsonutils.loads(query), host_state)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/openstack/common/jsonutils.py, line 123, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return json.loads(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/__init__.py, line 326, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return _default_decoder.decode(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 366, in decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp obj, end = self.raw_decode(s, 
 idx=_w(s, 0).end())
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp raise ValueError(No JSON object 
 could be decoded)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp ValueError: No JSON object could be 
 decoded
 2012-08-02 13:51:02 TRACE nova.rpc.amqp

 it seems that the filter cannot find my json file, so although I was using 
 the --hint functionality, whatever typed after the hint did not went to the 
 filter host_passed function, so it could not locate the json object, any 
 thoughts?
 Thanks. Heng

 
 From: openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
 [openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
 behalf of Heng Xu [shouhengzhang...@mail.utoronto.ca]
 Sent: Thursday, August 02, 2012 4:47 PM
 To: Pengjun Pan
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi PJ

 I don't know what happen, I could not find the file in my Ubuntu filesystem, 
 I searched for it, no result, but I just used ./stack.sh to install it, I it 
 is just me could not find the file? Any thoughts?
 thank you

 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 4:42 PM
 To: Heng Xu
 Cc: Joseph Suh; openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi Heng,

 The log should be in /var/log/nova/nova-scheduler.log.

 PJ

 On Thu, Aug 2, 2012 at 10:44 AM, Heng Xu
 shouhengzhang...@mail.utoronto.ca wrote:
 Hello Joseph:
 I am not sure where to find the log, so I just used the screen to n-sch,
 and one of the error is
 TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
 and I have no idea why this happened?
 Thank you.
 Heng

 
 From: Joseph Suh [j...@isi.edu]
 Sent: Thursday, August 02, 2012 3:28 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Heng,

 Does scheduler log show any error message or complaints?

 Thanks,

 Joseph

 
 (w) 703-248-6160
 (f) 703-812-3712
 http://www.east.isi.edu/~jsuh

 Information Sciences Institute
 University of Southern California
 3811 N. Fairfax Drive Suite 200
 Arlington, VA, 22203, USA


 - Original Message -
 From: Heng Xu shouhengzhang...@mail.utoronto.ca
 To: openstack@lists.launchpad.net
 Sent: Thursday, August 2, 2012 10:57:53 AM
 Subject: [Openstack] Cannot pass hint to Nova Scheduler



 Hi folks:
 I am new to openstack, I am current trying to test the json filter, I 
 changed my /etc/nova/nova.conf as follow

 scheduler_driver=nova.
 scheduler.multi.MultiScheduler
 compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
 volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
 scheduler_available_filters=nova.scheduler.filters.standard_filters
 scheduler_default_filters=JsonFilter
 least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
 compute_fill_first_cost_fn_weight=-1.0

 so I can use the json filter
 however, when I was using it, if I boot a vm without any --hint to the 
 scheduler, then the vm started fine, but if I use

 nova --debug boot --image 827d564a-e636-4fc4-a376-
 d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

 my vm started with error, and the following were output from the command 
 above

 +-
 +--+
 | Property | Value |
 +-+--+
 | OS-DCF:diskConfig | MANUAL |
 | OS-EXT-SRV-ATTR:host | None |
 | OS-EXT-SRV-ATTR:hypervisor_hostname | None |
 | OS-EXT-SRV-ATTR:instance_name | instance-002b |
 | OS-EXT-STS:power_state | 0 |
 | OS-EXT-STS:task_state | scheduling |
 | OS-EXT-STS:vm_state | error |
 | accessIPv4 | |
 | accessIPv6

Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Heng Xu
Hi, attached is the json_filter file I was used, but I it just came with 
devstack script installation, I did not even modify it.
Heng

From: Pengjun Pan [panpeng...@gmail.com]
Sent: Thursday, August 02, 2012 6:07 PM
To: Heng Xu
Cc: openstack@lists.launchpad.net
Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

Post your filter file. Might be a typo.

PJ

On Thu, Aug 2, 2012 at 1:02 PM, Heng Xu
shouhengzhang...@mail.utoronto.ca wrote:
 Hi, I recorded the error message, below

 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/scheduler/filters/json_filter.py, line 141, in 
 host_passes
 2012-08-02 13:51:02 TRACE nova.rpc.amqp result = 
 self._process_filter(jsonutils.loads(query), host_state)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/openstack/common/jsonutils.py, line 123, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return json.loads(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/__init__.py, line 326, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return _default_decoder.decode(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 366, in decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp obj, end = self.raw_decode(s, 
 idx=_w(s, 0).end())
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp raise ValueError(No JSON object 
 could be decoded)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp ValueError: No JSON object could be 
 decoded
 2012-08-02 13:51:02 TRACE nova.rpc.amqp

 it seems that the filter cannot find my json file, so although I was using 
 the --hint functionality, whatever typed after the hint did not went to the 
 filter host_passed function, so it could not locate the json object, any 
 thoughts?
 Thanks. Heng

 
 From: openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
 [openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
 behalf of Heng Xu [shouhengzhang...@mail.utoronto.ca]
 Sent: Thursday, August 02, 2012 4:47 PM
 To: Pengjun Pan
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi PJ

 I don't know what happen, I could not find the file in my Ubuntu filesystem, 
 I searched for it, no result, but I just used ./stack.sh to install it, I it 
 is just me could not find the file? Any thoughts?
 thank you

 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 4:42 PM
 To: Heng Xu
 Cc: Joseph Suh; openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi Heng,

 The log should be in /var/log/nova/nova-scheduler.log.

 PJ

 On Thu, Aug 2, 2012 at 10:44 AM, Heng Xu
 shouhengzhang...@mail.utoronto.ca wrote:
 Hello Joseph:
 I am not sure where to find the log, so I just used the screen to n-sch,
 and one of the error is
 TRACE nova.rpc.amqp ValueError: No JSON object could be decoded
 and I have no idea why this happened?
 Thank you.
 Heng

 
 From: Joseph Suh [j...@isi.edu]
 Sent: Thursday, August 02, 2012 3:28 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Heng,

 Does scheduler log show any error message or complaints?

 Thanks,

 Joseph

 
 (w) 703-248-6160
 (f) 703-812-3712
 http://www.east.isi.edu/~jsuh

 Information Sciences Institute
 University of Southern California
 3811 N. Fairfax Drive Suite 200
 Arlington, VA, 22203, USA


 - Original Message -
 From: Heng Xu shouhengzhang...@mail.utoronto.ca
 To: openstack@lists.launchpad.net
 Sent: Thursday, August 2, 2012 10:57:53 AM
 Subject: [Openstack] Cannot pass hint to Nova Scheduler



 Hi folks:
 I am new to openstack, I am current trying to test the json filter, I 
 changed my /etc/nova/nova.conf as follow

 scheduler_driver=nova.
 scheduler.multi.MultiScheduler
 compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
 volume_scheduler_driver=nova.scheduler.chance.ChanceScheduler
 scheduler_available_filters=nova.scheduler.filters.standard_filters
 scheduler_default_filters=JsonFilter
 least_cost_functions=nova.scheduler.least_cost.compute_fill_first_cost_fn
 compute_fill_first_cost_fn_weight=-1.0

 so I can use the json filter
 however, when I was using it, if I boot a vm without any --hint to the 
 scheduler, then the vm started fine, but if I use

 nova --debug boot --image 827d564a-e636-4fc4-a376-
 d36f7ebe1747 --flavor 1 --hint query=['=','$free_ram_mb',1024] server1

 my vm started with error, and the following were output from the command 
 above

 +-
 +--+
 | Property | Value

Re: [Openstack] Cannot pass hint to Nova Scheduler

2012-08-02 Thread Jay Pipes
Sorry for top-posting, but there's not really a good place to inline
comment.

First, let's tackle logging in devstack...

When using devstack, you noticed that it logs to the screen session by
default. To make devstack ALSO log to a file, put the following in your
localrc:

LOG_COLOR=False
SCREEN_LOGDIR=/opt/stack/logs

And re-run stack.sh. You will now find the various service log files in
/opt/stack/logs.

Second, let's handle the JSON issue...

Nova isn't trying to decode a file. It's trying to JSON-decode the
string you're putting on the command line:

--hint query=['=','$free_ram_mb',1024]

The novaclient is passing the string ['=','$free_ram_mb',1024] to the
jsonutils.loads() function, which is what is failing. You can try
parsing this string yourself and see that the failure is raised the same
as appears in the log:

jpipes@uberbox:~/repos/tempest$ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type help, copyright, credits or license for more information.
 import json
 p = json.loads(['=','$free_ram_mb',1024])
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/json/__init__.py, line 326, in loads
return _default_decoder.decode(s)
  File /usr/lib/python2.7/json/decoder.py, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
raise ValueError(No JSON object could be decoded)
ValueError: No JSON object could be decoded

The problem is the string needs to be properly formatted JSON, and
single-quotes are not allowed -- you need to use double-quotes:

 p = json.loads('[=,$free_ram_mb,1024]')
 print p
[u'=', u'$free_ram_mb', 1024]

Try your command like this instead:

nova --debug boot --image 827d564a-e636-4fc4-a376-d36f7ebe1747 --flavor
1 --hint query='[=,$free_ram_mb,1024]' server1

And I think you should be fine, as the following proof shows:

jpipes@uberbox:~/repos/tempest$ echo '[=,$free_ram_mb,1024]' |
python -mjson.tool
[
=,
$free_ram_mb,
1024
]


Best,
-jay


On 08/02/2012 02:09 PM, Heng Xu wrote:
 Hi, attached is the json_filter file I was used, but I it just came with 
 devstack script installation, I did not even modify it.
 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 6:07 PM
 To: Heng Xu
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler
 
 Post your filter file. Might be a typo.
 
 PJ
 
 On Thu, Aug 2, 2012 at 1:02 PM, Heng Xu
 shouhengzhang...@mail.utoronto.ca wrote:
 Hi, I recorded the error message, below

 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/scheduler/filters/json_filter.py, line 141, in 
 host_passes
 2012-08-02 13:51:02 TRACE nova.rpc.amqp result = 
 self._process_filter(jsonutils.loads(query), host_state)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /opt/stack/nova/nova/openstack/common/jsonutils.py, line 123, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return json.loads(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/__init__.py, line 326, in loads
 2012-08-02 13:51:02 TRACE nova.rpc.amqp return _default_decoder.decode(s)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 366, in decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp obj, end = self.raw_decode(s, 
 idx=_w(s, 0).end())
 2012-08-02 13:51:02 TRACE nova.rpc.amqp   File 
 /usr/lib/python2.7/json/decoder.py, line 384, in raw_decode
 2012-08-02 13:51:02 TRACE nova.rpc.amqp raise ValueError(No JSON object 
 could be decoded)
 2012-08-02 13:51:02 TRACE nova.rpc.amqp ValueError: No JSON object could be 
 decoded
 2012-08-02 13:51:02 TRACE nova.rpc.amqp

 it seems that the filter cannot find my json file, so although I was using 
 the --hint functionality, whatever typed after the hint did not went to the 
 filter host_passed function, so it could not locate the json object, any 
 thoughts?
 Thanks. Heng

 
 From: 
 openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net 
 [openstack-bounces+shouhengzhang.xu=mail.utoronto...@lists.launchpad.net] on 
 behalf of Heng Xu [shouhengzhang...@mail.utoronto.ca]
 Sent: Thursday, August 02, 2012 4:47 PM
 To: Pengjun Pan
 Cc: openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi PJ

 I don't know what happen, I could not find the file in my Ubuntu filesystem, 
 I searched for it, no result, but I just used ./stack.sh to install it, I it 
 is just me could not find the file? Any thoughts?
 thank you

 Heng
 
 From: Pengjun Pan [panpeng...@gmail.com]
 Sent: Thursday, August 02, 2012 4:42 PM
 To: Heng Xu
 Cc: Joseph Suh; openstack@lists.launchpad.net
 Subject: Re: [Openstack] Cannot pass hint to Nova Scheduler

 Hi Heng,

 The log