Re: RE: Remove host from MySQL?
Thanks for that reply Jordan, when I did that, I got: mysql> delete from host where id=12; ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cloud`.`vm_instance`, CONSTRAINT `fk_vm_instance__last_host_id` FOREIGN KEY (`last_host_id`) REFERENCES `host` (`id`)) mysql> Any idea? Thanks, Jim
RE: RE: Remove host from MySQL?
This means in table vm_instance there are VM instances that are still noted to reside on that host. From what I have seen that is a common ACS behavior. What you need to do is go to that table, filter by host and make a list of those VMs. Find if they really exist as you don’t want to remove real ones. After that is verified you can delete them one by one based on VM id or all of them at once based on last_host_id. Regards, Jordan -Original Message- From: James Steele Sent: 07 септември 2021 г. 12:00 To: users@cloudstack.apache.org Subject: Re: RE: Remove host from MySQL? [X] This message came from outside your organization Thanks for that reply Jordan, when I did that, I got: mysql> delete from host where id=12; ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cloud`.`vm_instance`, CONSTRAINT `fk_vm_instance__last_host_id` FOREIGN KEY (`last_host_id`) REFERENCES `host` (`id`)) mysql> Any idea? Thanks, Jim
RE: RE: Remove host from MySQL?
Just saw Wei response, I suggest you take his approach as it is safer than mine. Best regards, Jordan -Original Message- From: Yordan Kostov Sent: 09 септември 2021 г. 8:41 To: users@cloudstack.apache.org Subject: RE: RE: Remove host from MySQL? [X] This message came from outside your organization This means in table vm_instance there are VM instances that are still noted to reside on that host. From what I have seen that is a common ACS behavior. What you need to do is go to that table, filter by host and make a list of those VMs. Find if they really exist as you don’t want to remove real ones. After that is verified you can delete them one by one based on VM id or all of them at once based on last_host_id. Regards, Jordan -Original Message- From: James Steele Sent: 07 септември 2021 г. 12:00 To: users@cloudstack.apache.org Subject: Re: RE: Remove host from MySQL? [X] This message came from outside your organization Thanks for that reply Jordan, when I did that, I got: mysql> delete from host where id=12; ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cloud`.`vm_instance`, CONSTRAINT `fk_vm_instance__last_host_id` FOREIGN KEY (`last_host_id`) REFERENCES `host` (`id`)) mysql> Any idea? Thanks, Jim