<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The users are using nova CLI, not euca. The 'deleted' field is
already 1. The delete fails because the id is a foreign key in the
virtual_interfaces table. The question is how to excise an instance
from the database without screwing anything up. Here is the whole
row, which has a few unexpected values for a deleted instance, and
the error. I am trying to determine if a bug should be filed. Of
course I cannot reproduce this.<br>
<br>
SQL query:<br>
<br>
DELETE FROM `nova`.`instances` WHERE `instances`.`id` =155<br>
<br>
MySQL said: Documentation<br>
#1451 - Cannot delete or update a parent row: a foreign key
constraint fails (`nova`.`virtual_interfaces`, CONSTRAINT
`virtual_interfaces_ibfk_1` FOREIGN KEY (`instance_id`) REFERENCES
`instances` (`id`)) <br>
<br>
created_at: "2012-01-26 21:31:44"<br>
updated_at: "2012-02-27 22:35:24"<br>
deleted_at: "2012-02-27 22:35:35"<br>
deleted: 1<br>
id: 155<br>
user_id: "xxxxxxxxxxxxxxxxxx"<br>
project_id: "test"<br>
image_ref: 51<br>
kernel_id: 7<br>
ramdisk_id: ""<br>
launch_index: 0<br>
key_name: "li"<br>
key_data: "ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAAAgQCywTW0xypa949d2U5RBjTU9ip9yGapOy/9HwcRL5fgQh0EApVB5eUT7Pg3NgtB1AAVnsvNBguCRNmRzHwu2/kGc8AYNJEwgVGvR8eArrRltV7JriYxtC7/LirHM5EjdJ5paYKGOQAleb5fpfjlYuHd4H8RkYqcBRcriNzmGlJNPQ==
nova@xg03\n"<br>
power_state: 5<br>
vm_state: "active"<br>
memory_mb: 2048<br>
vcpus: 1<br>
local_gb: 20<br>
hostname: "testworker2"<br>
host: "xg01"<br>
user_data: ""<br>
reservation_id: "r-u29wsnpn"<br>
launched_at: "2012-02-23 16:08:37"<br>
display_name: "testworker2"<br>
display_description: "testworker2"<br>
locked: 0<br>
launched_on: "xg01"<br>
instance_type_id: 5<br>
uuid: "36741362-b755-4aff-a6c4-7b292acfda0b"<br>
root_device_name: "/dev/vda"<br>
config_drive: ""<br>
task_state: "rebooting"<br>
default_local_device: "/dev/vdb"<br>
<br>
<br>
On 3/20/2012 11:27 AM, Leandro Reox wrote:
<blockquote
cite="mid:CAC9jWxMCx86g13qqAzcahTYb79ZOzJ6Msh0cWPEkbcjOkAr5mg@mail.gmail.com"
type="cite">I think that the quick solution is set deteled to 1 on
the offending instances
<div><br>
</div>
<div>Are u using euca tools ? some inconsistencies are generated
by them often</div>
<div><br>
</div>
<div>Regards<br>
Lean<br>
<br>
<div class="gmail_quote">
On Tue, Mar 20, 2012 at 12:19 PM, David Kranz <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:david.kranz@qrclab.com">david.kranz@qrclab.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
In a diablo/kvm cluster that has been running for a long
time, a user reported problems with some vms, tried
rebooting them and eventually deleted them. I recently
noticed messages in the nova compute log like: Found 13 in
the database and 10 on the hypervisor.<br>
<br>
Looking at the source code I understand that this means the
instances have been deleted as far as the hypervisor is
concerned, but nova still thinks they are there.<br>
I found the offending instances in the database and they
were still listed as in the active state even though they<br>
had a deletion date recorded. I tried to delete them but was
unable due to a foreign key error with virtual_interfaces. I
could play around with deleting various things from the
database but there are real users. Is their a documented way
to "clean up" the state of the nova database in such
situations? It seems like a bug that the database could get
into this state.<br>
<br>
Also, it seems that deleted instances are never removed from
the database. Is that a bug?<br>
<br>
-David<br>
<br>
_______________________________________________<br>
Mailing list: <a moz-do-not-send="true"
href="https://launchpad.net/%7Eopenstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to : <a moz-do-not-send="true"
href="mailto:openstack@lists.launchpad.net"
target="_blank">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a moz-do-not-send="true"
href="https://launchpad.net/%7Eopenstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help : <a moz-do-not-send="true"
href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>