I made the patch that corrected the following problem.
It is that virt-install hangs up, when I set keymap which doesn't
exist in keytable.
ex)
virt-install ... --keymap=abc
- # Try a simple lookup in the keytable
- if keytable.keytable.has_key(kt.lower()):
- keymap = keytable.keytable[kt]
- else:
- # Try a more intelligent lookup: strip out all '-' and '_', sort
- # the keytable keys putting the longest first, then compare
- # by string prefix
- def len_cmp(a, b):
- return len(b) - len(a)
-
- clean_kt = kt.replace("-", "").replace("_", "")
- sorted_keys = sorted(keytable.keytable.keys(), len_cmp)
-
- for key in sorted_keys:
- origkey = key
- key = key.replace("-", "").replace("_","")
-
- if clean_kt.startswith(key):
- keymap = keytable.keytable[origkey]
- break
+ keymap = check_keytable(kt)
if not keymap:
logging.debug("Didn't match keymap '%s' in keytable!" % kt)
@@ -599,6 +580,31 @@ def lookup_pool_by_path(conn, path):
return p
return None
+def check_keytable(kt):
+ import keytable
+ keymap = None
+ # Try a simple lookup in the keytable
+ if keytable.keytable.has_key(kt.lower()):
+ return keytable.keytable[kt]
+ else:
+ # Try a more intelligent lookup: strip out all '-' and '_', sort
+ # the keytable keys putting the longest first, then compare
+ # by string prefix
+ def len_cmp(a, b):
+ return len(b) - len(a)
+
+ clean_kt = kt.replace("-", "").replace("_", "")
+ sorted_keys = sorted(keytable.keytable.keys(), len_cmp)
+
+ for key in sorted_keys:
+ origkey = key
+ key = key.replace("-", "").replace("_","")
+
+ if clean_kt.startswith(key):
+ return keytable.keytable[origkey]
+
+ return keymap
+
def _test():
import doctest
doctest.testmod()
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools
03-18-2009, 02:54 PM
Cole Robinson
Fix check keymap option in virt-install
Takahashi Tomohiro wrote:
> Hi,
>
> I made the patch that corrected the following problem.
> It is that virt-install hangs up, when I set keymap which doesn't
> exist in keytable.
> ex)
> virt-install ... --keymap=abc
>
> If you have any comments, please suggest me.
>
> Signed-off-by: Tomohiro Takahashi <takatom@jp.fujitsu.com>
>
Applied now.
Thanks,
Cole
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools