Verifying you have this bug:
select * from nova_bm.bm_nodes where uuid='$SOMEUUID' \G
If the instance_uuid returned is not present in nova.instances or is present but deleted == id for that row, then this is invalid: nova has deleted the instance but nova baremetal has not.
To fix:
update nova_bm.bm_nodes set instance_uuid=NULL where instance_uuid='thebaduuidreturnedbytheearlierquery';
2013-05-07 23:26:57,899.899 30255 ERROR nova.compute.manager [req-2903f513-9892-41ce-aa5e-e6e7b656bee9 baa113f6f7994ddd9c7d86945768616e 0d4df5d4fee24f18b8b5f425eb81e0c4] [instance: 6d0128f8-a9fb-4036-974d-4caaa915d45d] Error: ['Traceback (most recent call last):\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/compute/manager.py", line 942, in _build_instance\n set_access_ip=set_access_ip)\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/compute/manager.py", line 1204, in _spawn\n LOG.exception(_(\'Instance failed to spawn\'), instance=instance)\n', ' File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__\n self.gen.next()\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/compute/manager.py", line 1200, in _spawn\n block_device_info)\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/virt/baremetal/driver.py", line 237, in spawn\n \'task_state\': baremetal_states.BUILDING})\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/virt/baremetal/db/api.py", line 121, in bm_node_associate_and_update\n return IMPL.bm_node_associate_and_update(context, node_uuid, values)\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 97, in wrapper\n return f(*args, **kwargs)\n', ' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/virt/baremetal/db/sqlalchemy/api.py", line 214, in bm_node_associate_and_update\n \'n_uuid\': node_uuid})\n', 'NovaException: Failed to associate instance 6d0128f8-a9fb-4036-974d-4caaa915d45d to baremetal node a476f747-6f05-469f-8a40-a7e38b7499c0.\n']
2013-05-07 23:26:57,938.938 1475 ERROR nova.scheduler.filter_scheduler [req-2903f513-9892-41ce-aa5e-e6e7b656bee9 baa113f6f7994ddd9c7d86945768616e 0d4df5d4fee24f18b8b5f425eb81e0c4] [instance: 6d0128f8-a9fb-4036-974d-4caaa915d45d] Error from last host: ubuntu (node a476f747-6f05-469f-8a40-a7e38b7499c0): [u'Traceback (most recent call last):\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/compute/manager.py", line 942, in _build_instance\n set_access_ip=set_access_ip)\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/compute/manager.py", line 1204, in _spawn\n LOG.exception(_(\'Instance failed to spawn\'), instance=instance)\n', u' File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__\n self.gen.next()\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/compute/manager.py", line 1200, in _spawn\n block_device_info)\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/virt/baremetal/driver.py", line 237, in spawn\n \'task_state\': baremetal_states.BUILDING})\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/virt/baremetal/db/api.py", line 121, in bm_node_associate_and_update\n return IMPL.bm_node_associate_and_update(context, node_uuid, values)\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 97, in wrapper\n return f(*args, **kwargs)\n', u' File "/opt/stack/venvs/nova/local/lib/python2.7/site-packages/nova/virt/baremetal/db/sqlalchemy/api.py", line 214, in bm_node_associate_and_update\n \'n_uuid\': node_uuid})\n', u'NovaException: Failed to associate instance 6d0128f8-a9fb-4036-974d-4caaa915d45d to baremetal node a476f747-6f05-469f-8a40-a7e38b7499c0.\n']
select * from bm_nodes; ------- ------- -+----- ------- ------- --+---- ------- -+----- ----+-- --+---- --+---- ------- +------ ----+-- ------- ----+-- ------- ------+ ------- ------+ ------- ------- +------ ------- -----+- ------- ------- ------- ------- ------- --+---- ------- -+----- ------- ---+--- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ---+--- ------+ ------- --+---- ------- ------- ------- ------- ------+ ------- ------- -+ ------- ------- -+----- ------- ------- --+---- ------- -+----- ----+-- --+---- --+---- ------- +------ ----+-- ------- ----+-- ------- ------+ ------- ------+ ------- ------- +------ ------- -----+- ------- ------- ------- ------- ------- --+---- ------- -+----- ------- ---+--- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ------- ------- ------- ---+--- ------- ------- ------- ------- ---+--- ------+ ------- --+---- ------- ------- ------- ------- ------+ ------- ------- -+ ef18-4804- be34-206b122724 f1 | error | NULL | /var/lib/ nova/instances/ instance- 00000005/ disk | /tftpboot/ 0690eecc- ef18-4804- be34-206b122724 f1/config | QIZMMZKBKGABI3N I24JPQQO2A221ZC FO | 10240 | 1 | a3b04bf3- 351f-4f7d- 8d7b-878dec5b79 6d | foo | edf8-4dbc- 911c-430c0ff60a 31 | building | NULL | /var/lib/ nova/instances/ instance- 00000003/ disk | /tftpboot/ b74cbb15- edf8-4dbc- 911c-430c0ff60a 31/config | I0RJ5KCT69L1PCF 1NGDQLNFQC8OASB EC | 10240 | 1 | 08bea2d7- e0ac-4224- 8ee8-98495b93a1 3b | bmtest3 | c550-4b9d- 9f9e-bcf1528351 61 | building | NULL | /var/lib/ nova/instances/ instance- 00000004/ disk | /tftpboot/ 952b9558- c550-4b9d- 9f9e-bcf1528351 61/config | 4PRO1Q1Z249Z65C 0NQYVSNK7BDGV52 GN | 10240 | 1 | f665421b- 65f4-4a6c- 82d5-4e54bb647c ff | bmtest-cmsj1 | 0d00-465a- bb93-8fa7a89672 e3 | building | NULL | /var/lib/ nova/instances/ instance- 0000000c/ disk | /tftpboot/ fdbb2896- 0d00-465a- bb93-8fa7a89672 e3/config | 99MV3CH4CF9IERW H4WWKQD0H8VOMTU Z2 | 10240 | 1 | a476f74...
+------
| created_at | updated_at | deleted_at | deleted | id | cpus | memory_mb | local_gb | pm_address | pm_user | pm_password | service_host | prov_mac_address | instance_uuid | task_state | terminal_port | image_path | pxe_config_path | deploy_key | root_mb | swap_mb | uuid | instance_name |
+------
| 2013-05-07 02:18:07 | 2013-05-07 22:14:01 | NULL | 0 | 1 | 1 | 512 | 10 | x.x.x.47 | Administrator | xxx | ubuntu | NULL | 0690eecc-
| 2013-05-07 03:15:24 | 2013-05-07 03:29:25 | NULL | 0 | 2 | 1 | 512 | 10 | x.x.x.46 | Administrator | xxx | ubuntu | NULL | b74cbb15-
| 2013-05-07 03:27:40 | 2013-05-07 20:40:31 | NULL | 0 | 3 | 1 | 512 | 10 | x.x.x.45 | Administrator | xxx | ubuntu | NULL | 952b9558-
| 2013-05-07 22:27:31 | 2013-05-07 22:49:32 | NULL | 0 | 6 | 1 | 4096 | 20 | x.x.x.49 | Administrator | xxx | ubuntu | NULL | fdbb2896-