From: Christos Sfakianakis csfakian@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@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)