On Fri, May 24, 2019 at 07:26:48PM +0200, csfakian(a)redhat.com wrote:
From: Christos Sfakianakis <csfakian(a)redhat.com>
Allow device removal. Destroy the device, remove it from the
database and log a relevant message. This is useful when a new
device with the same name identifier needs to be created.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
lnst/Controller/Host.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lnst/Controller/Host.py b/lnst/Controller/Host.py
index ee36803..70fece5 100644
--- a/lnst/Controller/Host.py
+++ b/lnst/Controller/Host.py
@@ -15,6 +15,7 @@ from lnst.Common.Parameters import Parameters
from lnst.Controller.Common import ControllerError
from lnst.Controller.Namespace import Namespace
from lnst.Controller.NetNamespace import NetNamespace
+import logging
class Hosts(object):
"""Container object for Host class instances
@@ -82,3 +83,8 @@ class Host(Namespace):
self._machine.send_class(cls)
return self._machine.init_remote_class(cls, *args, **kwargs)
+
+ def remove_dev(self, dev):
+ logging.debug("Device %s is being removed intentionally." % dev.name)
+ dev.destroy()
+ self._unset(dev)
--
2.17.1
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://getfedora.org/code-of-conduct.html
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...
I'm not sure about this, this is introducing a new tester facing api
call that might need more consideration before commiting to something
like this...
I think explicitly doing the following in a Recipe might be best for
now:
h.my_device.destroy()
del h.my_device
...
h.my_device = MyDevice()
-Ondrej