Incorrect handling of virsh `domblkinfo` output

Bug #2025244 reported by Igor Brovtsin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Triaged
Medium
Igor Brovtsin

Bug Description

(originally found by ~peppepetra)

In some cases (network storage devices?), virsh `domblkinfo` command will return the following output:

```
Capacity: -
Allocation: -
Physical: -
```

(reference: https://github.com/libvirt/libvirt/blob/d725932a283fdc8b827d83cfc5d54b38cf40592b/tools/virsh-domain-monitor.c#L419)

This will cause rack to fail the virsh discovery with the following traceback:

```
2023-06-27 13:30:41 provisioningserver.rpc.pods: [critical] Failed to discover VM host.
        Traceback (most recent call last):
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 501, in errback
            self._startRunCallbacks(fail)
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
            self._runCallbacks()
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1475, in gotResult
            _inlineCallbacks(r, g, status)
        --- <exception caught here> ---
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
            result = result.throwExceptionIntoGenerator(g)
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
            return g.throw(self.type, self.value, self.tb)
          File "/snap/maas/28584/lib/python3.8/site-packages/provisioningserver/drivers/pod/virsh.py", line 1411, in discover
            discovered_machine = yield deferToThread(
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 250, in inContext
            result = inContext.theWork()
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 266, in <lambda>
            inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/snap/maas/28584/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
            return func(*args,**kw)
          File "/snap/maas/28584/lib/python3.8/site-packages/provisioningserver/utils/twisted.py", line 202, in wrapper
            result = func(*args, **kwargs)
          File "/snap/maas/28584/lib/python3.8/site-packages/provisioningserver/drivers/pod/virsh.py", line 713, in get_discovered_machine
            size = self.get_machine_local_storage(machine, device)
          File "/snap/maas/28584/lib/python3.8/site-packages/provisioningserver/drivers/pod/virsh.py", line 590, in get_machine_local_storage
            return int(self.get_key_value(output, "Capacity"))
        builtins.ValueError: invalid literal for int() with base 10: '-'
```

The workaround is to get rid of such storage devices and perform the discovery again.

I think we might want to handle '-' response separately. For a proper fix, we need to clarify in which cases virsh returns such responses and figure out how exactly do we want to handle storage in those cases.

Changed in maas:
milestone: none → 3.5.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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