[node-patches] Change in ovirt-node[master]: fix previous commit
hadong0720 at gmail.com
hadong0720 at gmail.com
Wed Jul 10 10:23:09 UTC 2013
hadong has uploaded a new change for review.
Change subject: fix previous commit
......................................................................
fix previous commit
Previous commit:http://gerrit.ovirt.org/#/c/16471/
fix BZ#981560 to didn't allow input an empty string
for "iscsi initiator name".
Now fix it as removing all iscsi related stuff when
inputting an empty string for "iscsi initiator name"
Change-Id: I6149a2ee6d2f040b82335d01a9a2cc0e5423ddd8
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/config/defaults.py
M src/ovirt/node/setup/core/remote_storage_page.py
M src/ovirt/node/utils/storage.py
3 files changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/61/16661/1
diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 56ae68f..a00e5a7 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -1144,7 +1144,7 @@
@NodeConfigFileSection.map_and_update_defaults_decorator
def update(self, name, target_name, target_host, target_port):
# FIXME add more validation
- valid.IQN()(name)
+ (valid.Empty(or_none=True) | valid.IQN())(name)
(valid.Empty(or_none=True) | valid.IQN())(target_name)
(valid.Empty(or_none=True) | valid.FQDNOrIPAddress())(target_host)
(valid.Empty(or_none=True) | valid.Port())(target_port)
diff --git a/src/ovirt/node/setup/core/remote_storage_page.py b/src/ovirt/node/setup/core/remote_storage_page.py
index 810efc5..cf5acee 100644
--- a/src/ovirt/node/setup/core/remote_storage_page.py
+++ b/src/ovirt/node/setup/core/remote_storage_page.py
@@ -47,7 +47,7 @@
return model
def validators(self):
- return {"iscsi.initiator_name": valid.IQN(),
+ return {"iscsi.initiator_name": (valid.Empty() | valid.IQN()),
"nfsv4.domain": (valid.Empty() | valid.FQDN()),
}
diff --git a/src/ovirt/node/utils/storage.py b/src/ovirt/node/utils/storage.py
index 973ec17..06884e0 100644
--- a/src/ovirt/node/utils/storage.py
+++ b/src/ovirt/node/utils/storage.py
@@ -19,7 +19,7 @@
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-from ovirt.node import base
+from ovirt.node import base, valid
from ovirt.node.utils import process
from ovirt.node.utils.fs import File
import os
@@ -31,7 +31,7 @@
def initiator_name(self, initiator_name=None):
try:
import ovirtnode.iscsi as oiscsi
- if initiator_name:
+ if (valid.Empty() | valid.IQN()).validate(initiator_name):
oiscsi.set_iscsi_initiator(initiator_name)
return oiscsi.get_current_iscsi_initiator_name()
except ImportError as e:
--
To view, visit http://gerrit.ovirt.org/16661
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6149a2ee6d2f040b82335d01a9a2cc0e5423ddd8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>
More information about the node-patches
mailing list