calling vm-host update fails second time

Bug #1972052 reported by Marian Gasparovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Alberto Donato

Bug Description

During deployment we call vm-host update to set overcommit racios. It works the first time but fails second time when VMs are defined.

2022-05-07-08:38:21 root DEBUG [localhost]: maas root vm-hosts read
2022-05-07-08:38:25 root DEBUG [localhost]: maas root version read
2022-05-07-08:38:28 root DEBUG [localhost]: maas root rack-controllers read hostname=infra1
2022-05-07-08:38:32 root DEBUG [localhost]: maas root vm-host update 1 memory_over_commit_ratio=10 cpu_over_commit_ratio=10
2022-05-07-08:39:22 root ERROR [localhost] Command failed: maas root vm-host update 1 memory_over_commit_ratio=10 cpu_over_commit_ratio=10
2022-05-07-08:39:22 root ERROR [localhost] STDOUT follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Error: Conflict Error</title>
  </head>
  <body>
    <h2 class="p-heading--four">
      Conflict error. Try your request again, as it will most likely succeed.
    </h2>
  </body>
</html>

It works fine in 3.1/stable

2022-05-07-08:07:03 root DEBUG [localhost]: maas root vm-hosts read
2022-05-07-08:07:07 root DEBUG [localhost]: maas root version read
2022-05-07-08:07:11 root DEBUG [localhost]: maas root rack-controllers read hostname=infra1
2022-05-07-08:07:14 root DEBUG [localhost]: maas root vm-host update 1 memory_over_commit_ratio=10 cpu_over_commit_ratio=10
2022-05-07-08:07:22 root DEBUG [localhost]: maas root machines read
2022-05-07-08:07:33 foundationcloudengine.layers.configuremaas INFO Machine juju-1 already exists in infra1
2022-05-07-08:07:33 root DEBUG [localhost]: maas root tags create name=juju
2022-05-07-08:07:36 root ERROR [localhost] Command failed: maas root tags create name=juju
2022-05-07-08:07:36 root ERROR [localhost] STDOUT follows:
{"name": ["Tag with this Name already exists."]}
2022-05-07-08:07:36 root ERROR [localhost] STDERR follows:
b''
2022-05-07-08:07:36 root DEBUG [localhost]: maas root tag update-nodes juju add=chnm3f
2022-05-07-08:07:40 foundationcloudengine.layers.configuremaas INFO Machine microk8s1-1 already exists in infra1
...

Related branches

Revision history for this message
Marian Gasparovic (marosg) wrote :
Alberto Donato (ack)
summary: - [3.2/beta] calling vm-host update fails second time
+ calling vm-host update fails second time
Changed in maas:
milestone: none → 3.2.0
Revision history for this message
Alberto Donato (ack) wrote :

Could you please provide the complete list of CLI calls that lead to this?
Also, is anything else interacting with maas at the same time?

I can't reproduce the issue locally simply by issuing repeated `maas $profile vm-host $id update` calls

Changed in maas:
status: New → Incomplete
Revision history for this message
Alberto Donato (ack) wrote :

Relevant log line:

2022-05-12 07:35:47 maasserver.utils.views: [error] Attempt #10 for /MAAS/api/2.0/vm-hosts/1/ failed; giving up (30.7s elapsed in total)

Changed in maas:
assignee: nobody → Alberto Donato (ack)
status: Incomplete → In Progress
importance: Undecided → High
Revision history for this message
Alberto Donato (ack) wrote :
Download full text (22.7 KiB)

The 409 comes from a unique index violation:

2022-05-12 10:00:32 maasserver.utils.views: [error] 409 Conflict @ /MAAS/api/2.0/vm-hosts/1/
Traceback (most recent call last):
  File "/snap/maas/x1/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "maasserver_virtualmachineinterface_iface_uniq"
DETAIL: Key (vm_id, mac_address, host_interface_id)=(17, 52:54:00:81:a4:c8, 3) already exists.
                                                                                                                                                                      ...

Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: 3.2.0 → 3.2.0-beta5
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.