From c78995f0e2d4660e1cceb36991fd3b55e61aee40 Mon Sep 17 00:00:00 2001 From: Guido Trotter Date: Mon, 20 Oct 2008 13:44:06 +0000 Subject: [PATCH] LUCreateInstance: accept mac = VALUE_GENERATE VALUE_GENERATE is handled exactly the same as VALUE_AUTO and the mac address is generated randomly. Forward-port-of: r1886, Reviewed-by: iustinp Reviewed-by: imsnah --- lib/cmdlib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index eefb44f..c7370c7 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3334,7 +3334,7 @@ class LUCreateInstance(LogicalUnit): self.check_ip = hostname1.ip # MAC address verification - if self.op.mac != "auto": + if self.op.mac not in (constants.VALUE_AUTO, constants.VALUE_GENERATE): if not utils.IsValidMac(self.op.mac.lower()): raise errors.OpPrereqError("invalid MAC address specified: %s" % self.op.mac) @@ -3588,7 +3588,7 @@ class LUCreateInstance(LogicalUnit): instance = self.op.instance_name pnode_name = self.pnode.name - if self.op.mac == "auto": + if self.op.mac in (constants.VALUE_AUTO, constants.VALUE_GENERATE): mac_address = self.cfg.GenerateMAC() else: mac_address = self.op.mac -- 1.7.10.4