Explorar el Código

Add vm.is_networked()

Marek Marczykowski-Górecki hace 7 años
padre
commit
f5e102177c
Se han modificado 1 ficheros con 13 adiciones y 0 borrados
  1. 13 0
      qubesadmin/vm/__init__.py

+ 13 - 0
qubesadmin/vm/__init__.py

@@ -215,6 +215,19 @@ class QubesVM(qubesadmin.base.PropertyHolder):
 
         return self.get_power_state() != 'Halted'
 
+    def is_networked(self):
+        '''Check whether this VM can reach network (firewall notwithstanding).
+
+        :returns: :py:obj:`True` if is machine can reach network, \
+            :py:obj:`False` otherwise.
+        :rtype: bool
+        '''
+
+        if self.provides_network:
+            return True
+
+        return self.netvm is not None
+
     @property
     def volumes(self):
         '''VM disk volumes'''