bin/kvm-admin
author Jens Kasten <jens@kasten-edv.de>
Sat, 07 Apr 2012 16:38:10 +0200
changeset 112 0ca5084026ff
parent 108 8d893ea5aaeb
child 113 d180b27d13a9
permissions -rwxr-xr-x
update README.txt
106
Jens Kasten <jens@kasten-edv.de>
parents: 105
diff changeset
     1
#!/usr/bin/python2.7
37
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     2
#
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
     3
# Comamandline tool to manage a qemu-kvm domain.
37
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     4
#
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     5
# Usage: kvm-admin guest_name action [arguments]
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     6
#
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     7
# Depencies:
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     8
#           python-argparse
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
     9
#
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    10
# This program is free software; you can redistribute it and/or modify
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    11
# it under the terms of the GNU General Public License as published by
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    12
# the Free Software Foundation; either version 2 of the License, or
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    13
# (at your option) any later version.
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    14
#
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    15
# This program is distributed in the hope that it will be useful,
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    18
# GNU General Public License for more details.
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    19
# 
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    20
# You should have received a copy of the GNU General Public License
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    21
# along with this program; if not, write to the Free Software
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
    23
#
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    24
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    25
"""
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    26
(c) 2007-2012 Jens Kasten <jens@kasten-edv.de> 
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    27
"""
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    28
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    29
import os
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    30
import sys
71
31e017a5948c add argparse import for backward compatibility to python 2.4
Jens Kasten <jens@kasten-edv.de>
parents: 61
diff changeset
    31
# for backward compality use the shipped argparse 
31e017a5948c add argparse import for backward compatibility to python 2.4
Jens Kasten <jens@kasten-edv.de>
parents: 61
diff changeset
    32
# if python version does not support it
31e017a5948c add argparse import for backward compatibility to python 2.4
Jens Kasten <jens@kasten-edv.de>
parents: 61
diff changeset
    33
try:
31e017a5948c add argparse import for backward compatibility to python 2.4
Jens Kasten <jens@kasten-edv.de>
parents: 61
diff changeset
    34
    import argparse
31e017a5948c add argparse import for backward compatibility to python 2.4
Jens Kasten <jens@kasten-edv.de>
parents: 61
diff changeset
    35
except ImportError:
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    36
    import kvmtools.argparse as argparse
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    37
import gettext
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    38
54
17b08e781dc6 update and fixes befor merging branch
Jens Kasten <jens@kasten-edv.de>
parents: 53
diff changeset
    39
from kvmtools.kvm.action import Action
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    40
71
31e017a5948c add argparse import for backward compatibility to python 2.4
Jens Kasten <jens@kasten-edv.de>
parents: 61
diff changeset
    41
# TODO: have to create translation stuff
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    42
LOCALEAPP = sys.argv[0]
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    43
TRANSLATE = gettext.translation(LOCALEAPP, "/usr/share/locale", fallback=True)
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    44
_ = TRANSLATE.ugettext
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    45
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    46
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    47
class KvmAdmin(Action):
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    48
    """ Class for commandline usage for a qemu-kvm domain.
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    49
    Its offers methods for to start and stop the domain.
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    50
    A special method is the commandline monitor.
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    51
    In default configuration its create a socketfile for each domain and
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    52
    is it can use like the standard monitor.
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    53
    """
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    54
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    55
    def __init__(self):
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    56
        # load the methods which are available for doamin
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    57
        Action.__init__(self)
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    58
        self.value = None
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    59
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    60
    def run(self):
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    61
        """Do an action for a domain.
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    62
        Call a method based on commandline option.
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    63
        """
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    64
        kvm_method = "".join(["kvm_", self.action, "_action"])
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    65
        self.monitor_open()
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    66
        if "monitor" in self.action or "migrate" in self.action:
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
    67
            # build string from third option till end
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
    68
            cmd_monitor = " ".join(str(i) for i in self.monitor)
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
    69
            getattr(self, kvm_method)(cmd_monitor)
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    70
        else:
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    71
            getattr(self, kvm_method)()
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    72
        self.monitor_close()
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    73
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    74
    def show_error(self):
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    75
        """Display errors if the registered."""
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    76
        errors = self.kvm_errors
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    77
        if len(errors) > 0:
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    78
            for error in errors:
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    79
                print error
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    80
            return True
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    81
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    82
    def _set(self, value):
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    83
        self.value = value
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    84
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    85
    def _get(self):
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    86
        return self.value
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    87
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    88
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
    89
def main():
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    90
    """Handle the commandline arguments."""
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
    91
    kvm_admin = KvmAdmin()
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
    92
    actions = kvm_admin.available_actions()
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    93
    domains = kvm_admin.available_domains()
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    94
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
    95
    # manage the commandline arguments
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
    96
    parser = argparse.ArgumentParser()
59
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
    97
    parser.add_argument("--debug", default=False, action="store_true",
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
    98
        help="Print full python traceback.")
108
8d893ea5aaeb add info about arguments order
Jens Kasten <jens@kasten-edv.de>
parents: 106
diff changeset
    99
    
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   100
    # add action as subparser
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   101
    subparser = parser.add_subparsers(title="All commands for kvm-admin",
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   102
        description="valid kvm-admin commands",
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   103
        help="additional help")
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   104
    for i in actions:
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   105
        my_help = getattr(kvm_admin, "kvm_%s_action" % i).__doc__
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   106
        action = subparser.add_parser(i)
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   107
        action.add_argument(i, action="store", metavar=("domain_name"), help=my_help)
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   108
        if i == "monitor":               
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   109
            action.add_argument("args_monitor", nargs="*", default=[],
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   110
                metavar=("monitor argument"),
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   111
                help=_("One ore more arguments to pass to the qemu-kvm monitor."))
108
8d893ea5aaeb add info about arguments order
Jens Kasten <jens@kasten-edv.de>
parents: 106
diff changeset
   112
    
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
   113
    args = parser.parse_args()
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   114
    
61
abba9906ca66 updates and fixes
Jens Kasten <jens@kasten-edv.de>
parents: 59
diff changeset
   115
    kvm_admin.debug = args.debug
105
938d696a213e restructe:
Jens Kasten <jens@kasten-edv.de>
parents: 71
diff changeset
   116
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   117
    # assign the action and domain name dynamically
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   118
    for action in actions:
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   119
        if action in args: 
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   120
            kvm_admin.action = action
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   121
            kvm_admin.kvm_domain_name = str(getattr(args, action))
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   122
            break
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   123
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   124
    # assign the optional monitor arguments 
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   125
    if "args_monitor" in args and len(args.args_monitor) > 0:
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   126
        kvm_admin.monitor = args.args_monitor        
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   127
    else:
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   128
        # set default monitor to help
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   129
        kvm_admin.monitor =["help"] 
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   130
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   131
    # assign all as domain name its used for status
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   132
    if kvm_admin.kvm_domain_name == "all" and kvm_admin.action == "status":
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   133
        domains.append("all")
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   134
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   135
    # check if the domain name has a config file and is not create
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   136
    if not kvm_admin.kvm_domain_name in domains and not "create" == kvm_admin.action:  
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   137
        parser.error(_("Available domains\n%s") % domains)
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   138
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   139
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   140
    # check if some error occurs
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   141
    if not kvm_admin.action == "modify" and kvm_admin.show_error():
55
1d4c061d1502 update and fixes for new structur
Jens Kasten <jens@kasten-edv.de>
parents: 54
diff changeset
   142
        sys.exit(1)
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   143
    
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   144
    # run it
59
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   145
    if args.debug:
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   146
        kvm_admin.run()
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   147
    else:
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   148
        try:
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   149
            kvm_admin.run()
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   150
        except Exception, error_msg:
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   151
            print error_msg
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   152
            sys.exit(1)
59
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   153
            
8465f1e93a07 remove content from kvmtools/__init__.py; fix: kvm-admin argparse stuff
Jens Kasten <jens@kasten-edv.de>
parents: 55
diff changeset
   154
        
23
06bcb6cf751c add hgignore; move kvm-admin to bin/kvm-admin and do small fixes; add setup.py for installation
Jens Kasten <jens@kasten-edv.de>
parents:
diff changeset
   155
if __name__ == "__main__":
37
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
   156
    try:
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
   157
        main()
7aec53b71183 update and some fixes
Jens Kasten <jens@kasten-edv.de>
parents: 33
diff changeset
   158
    except KeyboardInterrupt:
53
9eb8be6341f3 new structur for file and class layout
Jens Kasten <jens@kasten-edv.de>
parents: 44
diff changeset
   159
        print _("\rUser break.")
112
0ca5084026ff update README.txt
Jens Kasten <jens@kasten-edv.de>
parents: 108
diff changeset
   160
        sys.exit(1)