From 94751d41ac40a366c03428ed1e182b205dcdafe6 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 16 Aug 2023 13:42:21 +0200 Subject: [PATCH] Fix vdi-ref when static vdis are used When static vdis are used there is no snapshots and we don't want to call method from XAPI. Upstream PR: https://github.com/xapi-project/sm/pull/631 Signed-off-by: Guillaume --- drivers/LVHDSR.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/LVHDSR.py b/drivers/LVHDSR.py index 666af83f0..ec10fe74e 100755 --- a/drivers/LVHDSR.py +++ b/drivers/LVHDSR.py @@ -1509,10 +1509,11 @@ def detach(self, sr_uuid, vdi_uuid): elif self.sr.provision == "thick": needDeflate = False # except for snapshots, which are always deflated - vdi_ref = self.sr.srcmd.params['vdi_ref'] - snap = self.session.xenapi.VDI.get_is_a_snapshot(vdi_ref) - if snap: - needDeflate = True + if self.sr.srcmd.cmd != 'vdi_detach_from_config': + vdi_ref = self.sr.srcmd.params['vdi_ref'] + snap = self.session.xenapi.VDI.get_is_a_snapshot(vdi_ref) + if snap: + needDeflate = True if needDeflate: try: