Skip to content

Commit b297949

Browse files
docs: Fix xcp/net/ifrename/* for Sphinx-autodoc generation
Signed-off-by: Bernhard Kaindl <[email protected]>
1 parent 64bcb08 commit b297949

File tree

2 files changed

+46
-31
lines changed

2 files changed

+46
-31
lines changed

xcp/net/ifrename/logic.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,29 @@ def rename_logic( static_rules,
128128
old_state ):
129129
"""
130130
Core logic of renaming the current state based on the rules and past state.
131+
131132
This function assumes all inputs have been suitably sanitised.
132-
@param static_rules
133+
134+
Parameters
135+
----------
136+
static_rules : list
133137
List of MACPCI objects representing rules
134-
@param cur_state
138+
cur_state : list
135139
List of MACPCI objects representing the current state
136-
@param last_state
140+
last_state : list
137141
List of MACPCI objects representing the last boot state
138-
@param old_state
142+
old_state : list
139143
List of MACPCI objects representing the old state
140-
@returns List of tuples...
141-
@throws AssertionError (Should not be thrown, but better to know about logic
142-
errors if they occur)
144+
145+
Returns
146+
-------
147+
list
148+
List of tuples representing name transactions.
149+
150+
Raises
151+
------
152+
AssertionError
153+
Should not be thrown, but better to know about logic errors if they occur.
143154
"""
144155

145156
transactions = []
@@ -365,26 +376,31 @@ def rename_logic( static_rules,
365376
util.niceformat(cur_state)))
366377
return transactions
367378

368-
def rename( static_rules,
369-
cur_state,
370-
last_state,
371-
old_state ):
379+
def rename(static_rules, cur_state, last_state, old_state):
372380
"""
373381
Rename current state based on the rules and past state.
374-
This function sanitises the input and delegates the renaming logic to
375-
__rename.
376-
@param static_rules
382+
383+
This function sanitises the input and delegates the renaming logic to __rename.
384+
385+
Parameters
386+
----------
387+
static_rules : list
377388
List of MACPCI objects representing rules
378-
@param cur_state
389+
cur_state : list
379390
List of MACPCI objects representing the current state
380-
@param last_state
391+
last_state : list
381392
List of MACPCI objects representing the last boot state
382-
@param old_state
393+
old_state : list
383394
List of MACPCI objects representing the old state
384395
385-
@throws StaticRuleError, CurrentStateError, LastStateError, TypeError
396+
Returns
397+
-------
398+
list
399+
List of tuples of name changes required
386400
387-
@returns list of tuples of name changes required
401+
Raises
402+
------
403+
StaticRuleError, CurrentStateError, LastStateError, TypeError
388404
"""
389405

390406
if len(static_rules):

xcp/net/ifrename/static.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@
2525
Object for manipulating static rules.
2626
2727
Rules are of the form:
28-
<target name>: <id method> = "value"
28+
<target name>: <id method> = "value"
2929
30-
target name must be in the form eth*
31-
id methods are:
32-
mac: value should be the mac address of a device (e.g. DE:AD:C0:DE:00:00)
33-
pci: value should be the pci bus location of the device, optionally with an index (e.g. 0000:01:01.1[0])
34-
ppn: value should be the result of the biosdevname physical naming policy of a device (e.g. p1p1)
35-
label: value should be the SMBios label of a device (for SMBios 2.6 or above)
36-
37-
Any line starting with '#' is considered to be a comment
30+
target name must be in the form eth*
31+
id methods are:
32+
- mac: value should be the mac address of a device (e.g. DE:AD:C0:DE:00:00)
33+
- pci: value should be the pci bus location of the device, optionally with an index (e.g. 0000:01:01.1[0])
34+
- ppn: value should be the result of the biosdevname physical naming policy of a device (e.g. p1p1)
35+
- label: value should be the SMBios label of a device (for SMBios 2.6 or above)
3836
37+
Any line starting with '#' is considered to be a comment.
3938
"""
4039

4140
from __future__ import unicode_literals
@@ -82,9 +81,9 @@ class StaticRules(object):
8281
"""
8382
Object for parsing the static rules configuration.
8483
85-
There are two distinct usecases; the installer needs to write the
86-
static rules from scratch, whereas interface-rename.py in dom0 needs
87-
to read them.
84+
There are two distinct use cases:
85+
- The installer needs to write the static rules from scratch.
86+
- interface-rename.py in dom0 needs to read them.
8887
"""
8988

9089
methods = ["mac", "pci", "ppn", "label", "guess"]

0 commit comments

Comments
 (0)