From 4b9fe24d0a75ff591e68a7e82384d0456a31815d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 29 Sep 2021 02:52:44 +0200 Subject: [PATCH] storage: add Volume.ephemeral property QubesOS/qubes-issues#904 --- qubesadmin/storage.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qubesadmin/storage.py b/qubesadmin/storage.py index 91632667..4b94d069 100644 --- a/qubesadmin/storage.py +++ b/qubesadmin/storage.py @@ -164,6 +164,21 @@ def rw(self, value): self._qubesd_call('Set.rw', str(value).encode('ascii')) self._info = None + @property + def ephemeral(self): + """True if volume is read-write.""" + try: + self._fetch_info() + except qubesadmin.exc.QubesDaemonAccessError: + raise qubesadmin.exc.QubesPropertyAccessError('ephemeral') + return self._info.get('ephemeral', 'False') == 'True' + + @ephemeral.setter + def ephemeral(self, value): + """Set rw property""" + self._qubesd_call('Set.ephemeral', str(value).encode('ascii')) + self._info = None + @property def snap_on_start(self): """Create a snapshot from source on VM start."""