From: Ondrej Lichtner <olichtne(a)redhat.com>
The functional use of the Enum base class causes problems with
attempting to pickle the enum values. This is due to how the pickling
module tries to figure out which module the enum was defined in. This
can be improved by adding an explicit `module=` kwarg to the function
call; however, an additional issue is that the "VirtType" name needs to
also be identical to the "VirtioType" name that the object is being
assinged to.
As such there are two issues with the functional definiton of an enum.
I'm replacing this with the class based definition of an Enum as it
resolves both issues and is more easily understood and should be exactly
equivalent to the previous definition.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Recipes/ENRT/BasePvPRecipe.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lnst/Recipes/ENRT/BasePvPRecipe.py b/lnst/Recipes/ENRT/BasePvPRecipe.py
index 3e8e2b0d..cff2e2ce 100644
--- a/lnst/Recipes/ENRT/BasePvPRecipe.py
+++ b/lnst/Recipes/ENRT/BasePvPRecipe.py
@@ -12,7 +12,9 @@
from lnst.RecipeCommon.Perf.Measurements import StatCPUMeasurement
from lnst.RecipeCommon.Perf.Evaluators import NonzeroFlowEvaluator
-VirtioType = Enum('VirtType', 'VHOST_USER, VHOST_NET')
+class VirtioType(Enum):
+ VHOST_USER = 1
+ VHOST_NET = 2
class VirtioDevice(object):
--
2.31.1
Show replies by thread