aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/resource/linux
diff options
context:
space:
mode:
Diffstat (limited to 'vicn/resource/linux')
-rw-r--r--vicn/resource/linux/certificate.py8
-rw-r--r--vicn/resource/linux/net_device.py4
-rw-r--r--vicn/resource/linux/numa_mgr.py24
-rw-r--r--vicn/resource/linux/package_manager.py2
4 files changed, 18 insertions, 20 deletions
diff --git a/vicn/resource/linux/certificate.py b/vicn/resource/linux/certificate.py
index 7f9b8a74..dd451770 100644
--- a/vicn/resource/linux/certificate.py
+++ b/vicn/resource/linux/certificate.py
@@ -43,12 +43,12 @@ class Certificate(Resource):
Implements a SSL certificate.
"""
- node = Attribute(Node,
+ node = Attribute(Node,
description = 'Node on which the certificate is created',
mandatory = True,
multiplicity = Multiplicity.ManyToOne)
cert = Attribute(String, description = 'Certificate path',
- mandatory = True)
+ mandatory = True)
key = Attribute(String, description = 'Key path',
mandatory = True)
@@ -69,8 +69,8 @@ class Certificate(Resource):
return self._cert_file.__get__() | self._key_file.__get__()
def __create__(self):
- return BashTask(None, CMD_CREATE, {'self': self})
-
+ return BashTask(self.node, CMD_CREATE, {'self': self})
+
def __delete__(self):
return self._cert_file.__delete__() | self._key_file.__delete__()
diff --git a/vicn/resource/linux/net_device.py b/vicn/resource/linux/net_device.py
index 40d3edb7..c393ac1a 100644
--- a/vicn/resource/linux/net_device.py
+++ b/vicn/resource/linux/net_device.py
@@ -34,8 +34,6 @@ from vicn.resource.interface import Interface
# parse_ip_addr inspired from:
# From: https://github.com/ohmu/poni/blob/master/poni/cloud_libvirt.py
-LXD_FIX = lambda cmd: 'sleep 1 && {}'.format(cmd)
-
MAX_DEVICE_NAME_SIZE = 15
IPV4=4
@@ -50,7 +48,7 @@ RX_INTERFACE_GET = '.*?(?P<ifname>{})@{}:'
log = logging.getLogger(__name__)
-CMD_GET = LXD_FIX('ip link show {netdevice.device_name}')
+CMD_GET = 'ip link show {netdevice.device_name}'
CMD_CREATE = 'ip link add name {netdevice.device_name} ' \
'type {netdevice.netdevice_type}'
CMD_CREATE_PARENT = 'ip link add name {netdevice.device_name} ' \
diff --git a/vicn/resource/linux/numa_mgr.py b/vicn/resource/linux/numa_mgr.py
index 632264ce..90c526a8 100644
--- a/vicn/resource/linux/numa_mgr.py
+++ b/vicn/resource/linux/numa_mgr.py
@@ -56,7 +56,7 @@ def parse_lscpu_rv(rv):
ret.append(parse_lscpu_line(line))
return ret
-#------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
class NumaManager(Resource):
"""
@@ -68,36 +68,36 @@ class NumaManager(Resource):
multiplicity = Multiplicity.OneToOne,
reverse_auto = True,
reverse_name = 'numa_mgr')
- numa_repartitor = Attribute(CycleType,
+ numa_repartitor = Attribute(CycleType,
description = 'Tool to separate cores/CPUs/sockets',
- multiplicity = Multiplicity.OneToMany,
+ multiplicity = Multiplicity.OneToMany,
ro = True)
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Resource lifecycle
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
__create__ = None
__delete__ = None
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Constructor and Accessors
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.current_numa_node = 0
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
# Attributes
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
def _get_numa_repartitor(self):
return BashTask(self.node, CMD_LSCPU, parse=parse_lscpu_rv)
- #--------------------------------------------------------------------------
- # Public API
- #--------------------------------------------------------------------------
+ #--------------------------------------------------------------------------
+ # Public API
+ #--------------------------------------------------------------------------
def get_numa_core(self, numa_node=None):
if numa_node is None:
diff --git a/vicn/resource/linux/package_manager.py b/vicn/resource/linux/package_manager.py
index 1b9d518c..93241502 100644
--- a/vicn/resource/linux/package_manager.py
+++ b/vicn/resource/linux/package_manager.py
@@ -41,7 +41,7 @@ apt-get update
'''
# We need to double { } we want to preserve
-CMD_PKG_TEST='dpkg -s {self.package_name}'
+CMD_PKG_TEST='dpkg -s {self.package_name} | grep "Status:.* install "'
CMD_PKG_INSTALL='''
# Installing package {package_name}