Git repository of Karesansui.
Revision | 431f1d36cdae3846902ac8a0e1175df07f5aab52 (tree) |
---|---|
Time | 2010-01-25 12:14:40 |
Author | Taizo ITO <taizo@kare...> |
Commiter | Taizo ITO |
Merge branch 'dev'
@@ -0,0 +1,345 @@ | ||
1 | +#!/usr/bin/env python | |
2 | +# -*- coding: utf-8 -*- | |
3 | +# | |
4 | +# This file is part of Karesansui. | |
5 | +# | |
6 | +# Copyright (C) 2009-2010 HDE, Inc. | |
7 | +# | |
8 | +# This program is free software; you can redistribute it and/or | |
9 | +# modify it under the terms of the GNU General Public License | |
10 | +# as published by the Free Software Foundation; either version 2 | |
11 | +# of the License, or (at your option) any later version. | |
12 | +# | |
13 | + | |
14 | +import time | |
15 | +import re | |
16 | +import os | |
17 | +import sys | |
18 | +from optparse import OptionParser | |
19 | + | |
20 | +from ksscommand import KssCommand, KssCommandException, KssCommandOptException | |
21 | + | |
22 | +import __cmd__ | |
23 | + | |
24 | +try: | |
25 | + import karesansui | |
26 | + import libvirt | |
27 | + import libvirtmod | |
28 | + from karesansui import __app__,__version__,__release__ | |
29 | + from karesansui.lib.virt.virt import KaresansuiVirtConnection | |
30 | + from karesansui.lib.utils import load_locale | |
31 | + from karesansui.lib.utils import is_executable, execute_command | |
32 | + from karesansui.lib.utils import available_virt_uris | |
33 | + from karesansui.lib.utils import available_virt_mechs | |
34 | +except ImportError: | |
35 | + print >>sys.stderr, "[Error] karesansui package was not found." | |
36 | + sys.exit(1) | |
37 | + | |
38 | +_ = load_locale() | |
39 | + | |
40 | +usage = '%prog [options]' | |
41 | + | |
42 | +def getopts(): | |
43 | + optp = OptionParser(usage=usage, version=__version__) | |
44 | + optp.add_option('-a', '--all', dest='all', action="store_true", help=_('Print all information')) | |
45 | + optp.add_option('-i', '--node-info', action="store_true", dest='nodeinfo',help=_('Print node information')) | |
46 | + optp.add_option('-l', '--list', action="store_true", dest='list',help=_('Print domain list')) | |
47 | + optp.add_option('-n', '--net-list', action="store_true", dest='netlist',help=_('Print network list')) | |
48 | + return optp.parse_args() | |
49 | + | |
50 | +COMMAND_VIRSH = "/opt/hde/bin/virsh.dummy" | |
51 | +COMMAND_VIRSH = "/opt/hde/bin/virsh" | |
52 | +COMMAND_LIGHTTPD = "/opt/hde/sbin/lighttpd" | |
53 | + | |
54 | +class SysInfo(KssCommand): | |
55 | + | |
56 | + def showKaresansuiVersion(self): | |
57 | + print _("Using karesansui: %s %s.%s") %(__app__,__version__,__release__) | |
58 | + (rc,res) = execute_command([COMMAND_LIGHTTPD,"-v"]) | |
59 | + if rc == 0: | |
60 | + p = re.compile("lighttpd-([0-9\.]+) .*") | |
61 | + if p.search(res[0]): | |
62 | + lighttpdVersion = p.sub("\\1",res[0]) | |
63 | + print _("Using lighttpd: %s") %(lighttpdVersion) | |
64 | + | |
65 | + try: | |
66 | + from pysilhouette import __app__ as pysilhouette_app | |
67 | + from pysilhouette import __version__ as pysilhouette_ver | |
68 | + from pysilhouette import __release__ as pysilhouette_rel | |
69 | + print _("Using pysilhouette: %s %s.%s") %(pysilhouette_app,pysilhouette_ver,pysilhouette_rel) | |
70 | + except: | |
71 | + pass | |
72 | + | |
73 | + def process(self): | |
74 | + (opts, args) = getopts() | |
75 | + | |
76 | + start_msg = _("Generated by karesansui on %s") % time.strftime("%Y/%m/%d %H:%M:%S", time.localtime()) | |
77 | + print "# " + start_msg | |
78 | + | |
79 | + #import pdb; pdb.set_trace() | |
80 | + if is_executable(COMMAND_VIRSH): | |
81 | + old_lang = os.environ.get('LANG') | |
82 | + os.environ['LANG'] = "C" | |
83 | + | |
84 | + if opts.all is True or (opts.list is not True and opts.netlist is not True and opts.nodeinfo is not True): | |
85 | + """ Show version """ | |
86 | + print "" | |
87 | + print "## Version" | |
88 | + (rc,res) = execute_command([COMMAND_VIRSH,"version"]) | |
89 | + if rc == 0: | |
90 | + for line in res: | |
91 | + if line != "": | |
92 | + print line | |
93 | + self.showKaresansuiVersion() | |
94 | + | |
95 | + if opts.all is True: | |
96 | + """ Show uri """ | |
97 | + print "" | |
98 | + print "## URI" | |
99 | + (rc,res) = execute_command([COMMAND_VIRSH,"uri"]) | |
100 | + if rc == 0: | |
101 | + print _("Connecting URI: %s") %(res[0]) | |
102 | + | |
103 | + """ Show hostname """ | |
104 | + print "" | |
105 | + print "## Hostname" | |
106 | + (rc,res) = execute_command([COMMAND_VIRSH,"hostname"]) | |
107 | + if rc == 0: | |
108 | + print _("Hypervisor hostname: %s") %(res[0]) | |
109 | + | |
110 | + if opts.all is True or opts.nodeinfo is True: | |
111 | + """ Show nodeinfo """ | |
112 | + print "" | |
113 | + print "## Node Information" | |
114 | + (rc,res) = execute_command([COMMAND_VIRSH,"nodeinfo"]) | |
115 | + if rc == 0: | |
116 | + for line in res: | |
117 | + if line != "": | |
118 | + print line | |
119 | + | |
120 | + if opts.all is True or opts.list is True: | |
121 | + """ Show dom list """ | |
122 | + print "" | |
123 | + print "## Domain List" | |
124 | + (rc,res) = execute_command([COMMAND_VIRSH,"list","--all"]) | |
125 | + if rc == 0: | |
126 | + for line in res: | |
127 | + if line != "": | |
128 | + print line | |
129 | + | |
130 | + if opts.all is True or opts.netlist is True: | |
131 | + """ Show net list """ | |
132 | + print "" | |
133 | + print "## Network List" | |
134 | + (rc,res) = execute_command([COMMAND_VIRSH,"net-list","--all"]) | |
135 | + if rc == 0: | |
136 | + for line in res: | |
137 | + if line != "": | |
138 | + print line | |
139 | + | |
140 | + os.environ['LANG'] = old_lang | |
141 | + else: | |
142 | + try: | |
143 | + conn = libvirt.openReadOnly(None) | |
144 | + hvType = conn.getType() | |
145 | + | |
146 | + if opts.all is True or (opts.list is not True and opts.netlist is not True and opts.nodeinfo is not True): | |
147 | + """ Show version """ | |
148 | + print "" | |
149 | + print "## Version" | |
150 | + ret = libvirtmod.virGetVersion(hvType) | |
151 | + libVersion = ret[0] | |
152 | + apiVersion = ret[1] | |
153 | + | |
154 | + libVersion_major = libVersion / 1000000 | |
155 | + libVersion %= 1000000 | |
156 | + libVersion_minor = libVersion / 1000 | |
157 | + libVersion_rel = libVersion % 1000 | |
158 | + apiVersion_major = apiVersion / 1000000 | |
159 | + apiVersion %= 1000000 | |
160 | + apiVersion_minor = apiVersion / 1000 | |
161 | + apiVersion_rel = apiVersion % 1000 | |
162 | + | |
163 | + print _("Using library: libvir %d.%d.%d") %(libVersion_major, libVersion_minor, libVersion_rel) | |
164 | + print _("Using API: %s %d.%d.%d") %(hvType, apiVersion_major, apiVersion_minor, apiVersion_rel) | |
165 | + | |
166 | + try: | |
167 | + # See https://www.redhat.com/archives/libvir-list/2010-January/msg00723.html | |
168 | + ret = libvirtmod.virConnectGetVersion(conn._o) | |
169 | + hvVersion = ret | |
170 | + hvVersion_major = hvVersion / 1000000 | |
171 | + hvVersion %= 1000000 | |
172 | + hvVersion_minor = hvVersion / 1000 | |
173 | + hvVersion_rel = hvVersion % 1000 | |
174 | + print _("Running hypervisor: %s %d.%d.%d") %(hvType, hvVersion_major, hvVersion_minor, hvVersion_rel) | |
175 | + except: | |
176 | + if hvType == "QEMU": | |
177 | + (rc,res) = execute_command(["qemu","--version"]) | |
178 | + if rc == 0: | |
179 | + p = re.compile("QEMU PC emulator version ([0-9\.]+),.*") | |
180 | + if p.search(res[0]): | |
181 | + qemuVersion = p.sub("\\1",res[0]) | |
182 | + print _("Running hypervisor: %s %s") %(hvType, qemuVersion) | |
183 | + | |
184 | + self.showKaresansuiVersion() | |
185 | + | |
186 | + if opts.all is True: | |
187 | + """ Show uri """ | |
188 | + print "" | |
189 | + print "## URI" | |
190 | + uri = conn.getURI() | |
191 | + print _("Connecting URI: %s") %(uri) | |
192 | + | |
193 | + """ Show hostname """ | |
194 | + print "" | |
195 | + print "## Hostname" | |
196 | + hostname = conn.getHostname() | |
197 | + print _("Hypervisor hostname: %s") %(hostname) | |
198 | + | |
199 | + if opts.all is True or opts.nodeinfo is True: | |
200 | + """ Show nodeinfo """ | |
201 | + print "" | |
202 | + print "## Node Information" | |
203 | + nodeInfo = conn.getInfo() | |
204 | + print "%-20s %s" % (_("CPU model:") ,nodeInfo[0]) | |
205 | + print "%-20s %s" % (_("CPU(s):") ,nodeInfo[2]) | |
206 | + print "%-20s %s MHz"% (_("CPU frequency:") ,nodeInfo[3]) | |
207 | + print "%-20s %s" % (_("CPU socket(s):") ,nodeInfo[5]) | |
208 | + print "%-20s %s" % (_("Core(s) per socket:"),nodeInfo[6]) | |
209 | + print "%-20s %s" % (_("Thread(s) per core:"),nodeInfo[7]) | |
210 | + print "%-20s %s" % (_("NUMA cell(s):") ,nodeInfo[4]) | |
211 | + print "%-20s %lu kB"% (_("Memory size:") ,(float)(nodeInfo[1])*1024) | |
212 | + | |
213 | + if opts.all is True or opts.list is True: | |
214 | + """ Show dom list """ | |
215 | + print "" | |
216 | + print "## Domain List" | |
217 | + state_flags = [ | |
218 | + "no state", # VIR_DOMAIN_NOSTATE | |
219 | + "running", # VIR_DOMAIN_RUNNING | |
220 | + "idle", # VIR_DOMAIN_BLOCKED | |
221 | + "paused", # VIR_DOMAIN_PAUSED | |
222 | + "in shutdown", # VIR_DOMAIN_SHUTDOWN | |
223 | + "shut off", # VIR_DOMAIN_SHUTOFF | |
224 | + "crashed", # VIR_DOMAIN_CRASHED | |
225 | + ] | |
226 | + #print "%3s %-20s %s" %(_("Id"), _("Name"), _("State")) | |
227 | + #print "----------------------------------" | |
228 | + print "%3s %-20s %-12s %-37s %-10s %-12s %-12s %-3s %-12s" %(_("Id"), _("Name"), _("State"), _("UUID"), _("Autostart"), _("MaxMem"), _("Memory"), _("Vcpus"), _("CPUTime"), ) | |
229 | + print "---------------------------------------------------------------------------" | |
230 | + | |
231 | + domains_ids = conn.listDomainsID() | |
232 | + for id in domains_ids: | |
233 | + dom = conn.lookupByID(id) | |
234 | + name = dom.name() | |
235 | + domID = id | |
236 | + domInfo = dom.info() | |
237 | + domUUID = dom.UUIDString() | |
238 | + domAutostart = dom.autostart() | |
239 | + if domAutostart == True: | |
240 | + locale_domAutostart = _("enable") | |
241 | + else: | |
242 | + locale_domAutostart = _("disable") | |
243 | + state = domInfo[0] | |
244 | + if domID == -1: | |
245 | + #print "%3s %-20s %s" %("-", name, state_flags[state]) | |
246 | + print "%3s %-20s %-12s %-37s %-10s %-12ld %-12ld %-3d %-12ld" %("-", name, state_flags[state], domUUID, locale_domAutostart, domInfo[1], domInfo[2], domInfo[3], domInfo[4]) | |
247 | + else: | |
248 | + #print "%3d %-20s %s" %(domID, name, state_flags[state]) | |
249 | + print "%3d %-20s %-12s %-37s %-10s %-12ld %-12ld %-3d %-12ld" %(domID, name, state_flags[state], domUUID, locale_domAutostart, domInfo[1], domInfo[2], domInfo[3], domInfo[4]) | |
250 | + | |
251 | + defined_domains = conn.listDefinedDomains() | |
252 | + for name in defined_domains: | |
253 | + dom = conn.lookupByName(name) | |
254 | + #print dom.memoryStats() | |
255 | + domID = dom.ID() | |
256 | + domInfo = dom.info() | |
257 | + domUUID = dom.UUIDString() | |
258 | + domAutostart = dom.autostart() | |
259 | + if domAutostart == True: | |
260 | + locale_domAutostart = _("enable") | |
261 | + else: | |
262 | + locale_domAutostart = _("disable") | |
263 | + state = domInfo[0] | |
264 | + if domID == -1: | |
265 | + #print "%3s %-20s %s" %("-", name, state_flags[state]) | |
266 | + print "%3s %-20s %-12s %-37s %-10s %-12ld %-12ld %-3d %-12ld" %("-", name, state_flags[state], domUUID, locale_domAutostart, domInfo[1], domInfo[2], domInfo[3], domInfo[4]) | |
267 | + else: | |
268 | + #print "%3d %-20s %s" %(domID, name, state_flags[state]) | |
269 | + print "%3d %-20s %-12s %-37s %-10s %-12ld %-12ld %-3d %-12ld" %(domID, name, state_flags[state], domUUID, locale_domAutostart, domInfo[1], domInfo[2], domInfo[3], domInfo[4]) | |
270 | + | |
271 | + if opts.all is True or opts.netlist is True: | |
272 | + """ Show net list """ | |
273 | + print "" | |
274 | + print "## Network List" | |
275 | + #print "%-20s %-10s %-10s" %(_("Name"), _("State"), _("Autostart")) | |
276 | + #print "-----------------------------------------" | |
277 | + print "%-20s %-10s %-37s %-10s" %(_("Name"), _("State"), _("UUID"), _("Autostart"), ) | |
278 | + print "--------------------------------------------------------------------------" | |
279 | + networks = conn.listNetworks() | |
280 | + for name in networks: | |
281 | + net = conn.networkLookupByName(name) | |
282 | + netUUID = net.UUIDString() | |
283 | + netAutostart = net.autostart() | |
284 | + if netAutostart == True: | |
285 | + locale_netAutostart = _("yes") | |
286 | + else: | |
287 | + locale_netAutostart = _("no") | |
288 | + | |
289 | + print "%-20s %-10s %-37s %-10s" %(name, _("active"), netUUID, locale_netAutostart) | |
290 | + | |
291 | + """ | |
292 | + defined_networks = conn.listDefinedNetworks() | |
293 | + for name in defined_networks: | |
294 | + net = conn.networkLookupByName(name) | |
295 | + netUUID = net.UUIDString() | |
296 | + netAutostart = net.autostart() | |
297 | + if netAutostart == True: | |
298 | + locale_netAutostart = _("yes") | |
299 | + else: | |
300 | + locale_netAutostart = _("no") | |
301 | + | |
302 | + print "%-20s %-10s %-37s %-10s" %(name, _("inactive"), netUUID, locale_netAutostart) | |
303 | + """ | |
304 | + | |
305 | + except: | |
306 | + pass | |
307 | + | |
308 | + if opts.all is True: | |
309 | + """ Show available uris """ | |
310 | + print "" | |
311 | + print "## Available URIs" | |
312 | + for mech,uri in available_virt_uris().iteritems(): | |
313 | + print uri | |
314 | + | |
315 | + """ Show available mechs """ | |
316 | + print "" | |
317 | + print "## Available mechanisms" | |
318 | + for mech in available_virt_mechs(): | |
319 | + print mech | |
320 | + | |
321 | + """ Show installed packages """ | |
322 | + print "" | |
323 | + print "## Installed packages" | |
324 | + (rc,res) = execute_command(["rpm","-qa",'--queryformat=%{NAME}\t%{VERSION}\t%{RELEASE}\t%{INSTALLTIME}\t%{BUILDHOST}\n']) | |
325 | + if rc == 0: | |
326 | + print "%-25s %-10s %-10s %-20s" %(_("Name"), _("Version"), _("Release"), _("InstallTime"), ) | |
327 | + print "------------------------------------------------------------------" | |
328 | + p = re.compile("hde\.co\.jp") | |
329 | + output = [] | |
330 | + for aline in res: | |
331 | + arr = aline.split("\t") | |
332 | + if p.search(arr[4]): | |
333 | + str = "%-25s %-10s %-10s %-20s" %(arr[0],arr[1],arr[2],time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(float(arr[3]))),) | |
334 | + output.append(str) | |
335 | + print "\n".join(sorted(output)) | |
336 | + | |
337 | + finish_msg = _("Completed on %s") % time.strftime("%Y/%m/%d %H:%M:%S", time.localtime()) | |
338 | + print "" | |
339 | + print "# " + finish_msg | |
340 | + | |
341 | + return True | |
342 | + | |
343 | +if __name__ == "__main__": | |
344 | + target = SysInfo() | |
345 | + sys.exit(target.run()) |
@@ -76,7 +76,6 @@ class UpdateSoftware(KssCommand): | ||
76 | 76 | ret = yu.update() |
77 | 77 | self.up_progress(40) |
78 | 78 | except: |
79 | - import pdb; pdb.set_trace() | |
80 | 79 | raise KssCommandException('failed to update software.') |
81 | 80 | |
82 | 81 | if ret: |
@@ -2534,6 +2534,7 @@ msgstr "" | ||
2534 | 2534 | |
2535 | 2535 | #: /root/src/karesansui/karesansui/templates/default/guestby1/guestby1.html:51 |
2536 | 2536 | #: /root/src/karesansui/karesansui/templates/default/host/host.html:45 |
2537 | +#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:43 | |
2537 | 2538 | msgid "Summary" |
2538 | 2539 | msgstr "" |
2539 | 2540 |
@@ -2937,6 +2938,7 @@ msgid "Snapshot Settings" | ||
2937 | 2938 | msgstr "" |
2938 | 2939 | |
2939 | 2940 | #: /root/src/karesansui/karesansui/templates/default/guestby1snapshot/guestby1snapshot.part:188 |
2941 | +#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:91 | |
2940 | 2942 | msgid "Size" |
2941 | 2943 | msgstr "" |
2942 | 2944 |
@@ -3388,7 +3390,7 @@ msgstr "" | ||
3388 | 3390 | |
3389 | 3391 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:92 |
3390 | 3392 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:28 |
3391 | -msgid "Pkg_Name" | |
3393 | +msgid "Package Name" | |
3392 | 3394 | msgstr "" |
3393 | 3395 | |
3394 | 3396 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:93 |
@@ -3397,11 +3399,11 @@ msgid "Arch" | ||
3397 | 3399 | msgstr "" |
3398 | 3400 | |
3399 | 3401 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:94 |
3400 | -msgid "RPM Version" | |
3402 | +msgid "Current Version" | |
3401 | 3403 | msgstr "" |
3402 | 3404 | |
3403 | 3405 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:95 |
3404 | -msgid "Yum Version" | |
3406 | +msgid "Latest Version" | |
3405 | 3407 | msgstr "" |
3406 | 3408 | |
3407 | 3409 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:96 |
@@ -3416,18 +3418,10 @@ msgstr "" | ||
3416 | 3418 | msgid "Release" |
3417 | 3419 | msgstr "" |
3418 | 3420 | |
3419 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:43 | |
3420 | -msgid "Pkg_Summary" | |
3421 | -msgstr "" | |
3422 | - | |
3423 | 3421 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:53 |
3424 | 3422 | msgid "URL" |
3425 | 3423 | msgstr "" |
3426 | 3424 | |
3427 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:58 | |
3428 | -msgid "Copyright" | |
3429 | -msgstr "" | |
3430 | - | |
3431 | 3425 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:63 |
3432 | 3426 | msgid "License" |
3433 | 3427 | msgstr "" |
@@ -3440,10 +3434,6 @@ msgstr "" | ||
3440 | 3434 | msgid "Group" |
3441 | 3435 | msgstr "" |
3442 | 3436 | |
3443 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:91 | |
3444 | -msgid "Pkg_Size" | |
3445 | -msgstr "" | |
3446 | - | |
3447 | 3437 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:96 |
3448 | 3438 | msgid "Build Host" |
3449 | 3439 | msgstr "" |
@@ -11,6 +11,7 @@ | ||
11 | 11 | # of the License, or (at your option) any later version. |
12 | 12 | # |
13 | 13 | |
14 | + | |
14 | 15 | """ |
15 | 16 | @authors: Kei Funagayama <kei@karesansui-project.info> |
16 | 17 | Junichi Shinohara <junichi@karesansui-project.info> |
@@ -142,6 +142,7 @@ class GuestBy1(Rest): | ||
142 | 142 | info['os'] = guest_info["OSType"] |
143 | 143 | info['hypervisor'] = guest_info["hypervisor"] |
144 | 144 | info['type'] = guest_info["VMType"] |
145 | + info['hv_version'] = guest_info["hv_version"] | |
145 | 146 | |
146 | 147 | guest_diskinfo = guest.info["virt"].get_disk_info() |
147 | 148 | disks = [] |
@@ -149,16 +150,22 @@ class GuestBy1(Rest): | ||
149 | 150 | disks.append("%s(%sMB)" % (disk['target']['dev'],disk['source']['size'])) |
150 | 151 | diskinfo = disks |
151 | 152 | |
152 | - guest_interfaceinfo = guest.info["virt"].get_interface_info() | |
153 | 153 | inters = [] |
154 | + nics = [] | |
155 | + | |
156 | + guest_interfaceinfo = guest.info["virt"].get_interface_info() | |
154 | 157 | for inter in guest_interfaceinfo: |
155 | 158 | inters.append(inter["type"]) |
159 | + try: | |
160 | + nics.append(inter["source"]["bridge"]) | |
161 | + except: | |
162 | + pass | |
156 | 163 | interfaceinfo = inters |
157 | 164 | |
158 | - guest_netinfo = guest.info["virt"].get_netinfo() | |
159 | - nics = [] | |
160 | - for nic in guest_netinfo.keys(): | |
161 | - nics.append(nic) | |
165 | + if len(nics) == 0: | |
166 | + guest_netinfo = guest.info["virt"].get_netinfo() | |
167 | + for nic in guest_netinfo.keys(): | |
168 | + nics.append(nic) | |
162 | 169 | netinfo = nics |
163 | 170 | |
164 | 171 | if self.__template__["media"] == 'json': |
@@ -1045,6 +1045,16 @@ class KaresansuiVirtGuest: | ||
1045 | 1045 | |
1046 | 1046 | document = XMLParse(dom.XMLDesc(1)) |
1047 | 1047 | vm_type= XMLXpath(document,'/domain/@type') |
1048 | + hypervisor = self._conn.getType() | |
1049 | + try: | |
1050 | + hvVersion = libvirtmod.virConnectGetVersion(self._conn._o) | |
1051 | + hvVersion_major = hvVersion / 1000000 | |
1052 | + hvVersion %= 1000000 | |
1053 | + hvVersion_minor = hvVersion / 1000 | |
1054 | + hvVersion_rel = hvVersion % 1000 | |
1055 | + hv_version = "%s %d.%d.%d" %(hypervisor, hvVersion_major, hvVersion_minor, hvVersion_rel) | |
1056 | + except: | |
1057 | + hv_version = None | |
1048 | 1058 | return { |
1049 | 1059 | "state" : data[0], |
1050 | 1060 | "maxMem" : data[1], |
@@ -1053,17 +1063,23 @@ class KaresansuiVirtGuest: | ||
1053 | 1063 | "cpuTime" : data[4], |
1054 | 1064 | "OSType" : os_type, |
1055 | 1065 | "VMType" : vm_type.upper(), |
1056 | - "hypervisor": self._conn.getType(), | |
1066 | + "hypervisor": hypervisor, | |
1067 | + "hv_version": hv_version, | |
1057 | 1068 | } |
1058 | 1069 | |
1059 | 1070 | def get_netinfo(self): |
1060 | 1071 | info = {} |
1061 | 1072 | dom = self._conn.lookupByName(self.get_domain_name()) |
1062 | 1073 | dom_id = dom.ID() |
1063 | - vif_info = get_ifconfig_info("regex:^vif%d\.[0-9]" % dom_id) | |
1064 | - for dev,value in vif_info.iteritems(): | |
1065 | - dev = dev.replace("vif%d." % (dom_id,), "eth") | |
1066 | - info[dev] = value | |
1074 | + if self.get_info()["VMType"] == "KVM": | |
1075 | + eth_info = get_ifconfig_info("regex:^eth") | |
1076 | + for dev,value in eth_info.iteritems(): | |
1077 | + info[dev] = value | |
1078 | + else: | |
1079 | + vif_info = get_ifconfig_info("regex:^vif%d\.[0-9]" % dom_id) | |
1080 | + for dev,value in vif_info.iteritems(): | |
1081 | + dev = dev.replace("vif%d." % (dom_id,), "eth") | |
1082 | + info[dev] = value | |
1067 | 1083 | return info |
1068 | 1084 | |
1069 | 1085 | def get_disk_info(self): |
@@ -9,7 +9,7 @@ msgstr "" | ||
9 | 9 | "Project-Id-Version: PROJECT VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" |
11 | 11 | "POT-Creation-Date: 2009-01-06 15:17+0900\n" |
12 | -"PO-Revision-Date: 2010-01-06 17:01+0900\n" | |
12 | +"PO-Revision-Date: 2010-01-08 16:43+0900\n" | |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: en <LL@li.org>\n" |
15 | 15 | "Plural-Forms: nplurals=2; plural=(n != 1)\n" |
@@ -2535,6 +2535,7 @@ msgstr "" | ||
2535 | 2535 | |
2536 | 2536 | #: /root/src/karesansui/karesansui/templates/default/guestby1/guestby1.html:51 |
2537 | 2537 | #: /root/src/karesansui/karesansui/templates/default/host/host.html:45 |
2538 | +#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:43 | |
2538 | 2539 | msgid "Summary" |
2539 | 2540 | msgstr "" |
2540 | 2541 |
@@ -2938,6 +2939,7 @@ msgid "Snapshot Settings" | ||
2938 | 2939 | msgstr "" |
2939 | 2940 | |
2940 | 2941 | #: /root/src/karesansui/karesansui/templates/default/guestby1snapshot/guestby1snapshot.part:188 |
2942 | +#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:91 | |
2941 | 2943 | msgid "Size" |
2942 | 2944 | msgstr "" |
2943 | 2945 |
@@ -3389,8 +3391,8 @@ msgstr "" | ||
3389 | 3391 | |
3390 | 3392 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:92 |
3391 | 3393 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:28 |
3392 | -msgid "Pkg_Name" | |
3393 | -msgstr "Name" | |
3394 | +msgid "Package Name" | |
3395 | +msgstr "" | |
3394 | 3396 | |
3395 | 3397 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:93 |
3396 | 3398 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:48 |
@@ -3398,11 +3400,11 @@ msgid "Arch" | ||
3398 | 3400 | msgstr "" |
3399 | 3401 | |
3400 | 3402 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:94 |
3401 | -msgid "RPM Version" | |
3403 | +msgid "Current Version" | |
3402 | 3404 | msgstr "" |
3403 | 3405 | |
3404 | 3406 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:95 |
3405 | -msgid "Yum Version" | |
3407 | +msgid "Latest Version" | |
3406 | 3408 | msgstr "" |
3407 | 3409 | |
3408 | 3410 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:96 |
@@ -3417,18 +3419,10 @@ msgstr "" | ||
3417 | 3419 | msgid "Release" |
3418 | 3420 | msgstr "" |
3419 | 3421 | |
3420 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:43 | |
3421 | -msgid "Pkg_Summary" | |
3422 | -msgstr "Summary" | |
3423 | - | |
3424 | 3422 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:53 |
3425 | 3423 | msgid "URL" |
3426 | 3424 | msgstr "" |
3427 | 3425 | |
3428 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:58 | |
3429 | -msgid "Copyright" | |
3430 | -msgstr "" | |
3431 | - | |
3432 | 3426 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:63 |
3433 | 3427 | msgid "License" |
3434 | 3428 | msgstr "" |
@@ -3441,10 +3435,6 @@ msgstr "" | ||
3441 | 3435 | msgid "Group" |
3442 | 3436 | msgstr "" |
3443 | 3437 | |
3444 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:91 | |
3445 | -msgid "Pkg_Size" | |
3446 | -msgstr "Size" | |
3447 | - | |
3448 | 3438 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:96 |
3449 | 3439 | msgid "Build Host" |
3450 | 3440 | msgstr "" |
@@ -8,7 +8,7 @@ msgstr "" | ||
8 | 8 | "Project-Id-Version: PROJECT VERSION\n" |
9 | 9 | "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" |
10 | 10 | "POT-Creation-Date: 2009-01-06 15:17+0900\n" |
11 | -"PO-Revision-Date: 2010-01-06 17:01+0900\n" | |
11 | +"PO-Revision-Date: 2010-01-08 16:43+0900\n" | |
12 | 12 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
13 | 13 | "Language-Team: ja <LL@li.org>\n" |
14 | 14 | "Plural-Forms: nplurals=1; plural=0\n" |
@@ -2536,6 +2536,7 @@ msgstr "トップ" | ||
2536 | 2536 | |
2537 | 2537 | #: /root/src/karesansui/karesansui/templates/default/guestby1/guestby1.html:51 |
2538 | 2538 | #: /root/src/karesansui/karesansui/templates/default/host/host.html:45 |
2539 | +#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:43 | |
2539 | 2540 | msgid "Summary" |
2540 | 2541 | msgstr "サマリ" |
2541 | 2542 |
@@ -2941,6 +2942,7 @@ msgid "Snapshot Settings" | ||
2941 | 2942 | msgstr "スナップショット設定" |
2942 | 2943 | |
2943 | 2944 | #: /root/src/karesansui/karesansui/templates/default/guestby1snapshot/guestby1snapshot.part:188 |
2945 | +#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:91 | |
2944 | 2946 | msgid "Size" |
2945 | 2947 | msgstr "サイズ" |
2946 | 2948 |
@@ -3392,65 +3394,53 @@ msgstr "No." | ||
3392 | 3394 | |
3393 | 3395 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:92 |
3394 | 3396 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:28 |
3395 | -msgid "Pkg_Name" | |
3396 | -msgstr "Name" | |
3397 | +msgid "Package Name" | |
3398 | +msgstr "パッケージ名" | |
3397 | 3399 | |
3398 | 3400 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:93 |
3399 | 3401 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:48 |
3400 | 3402 | msgid "Arch" |
3401 | -msgstr "Arch" | |
3403 | +msgstr "アーキテクチャ" | |
3402 | 3404 | |
3403 | 3405 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:94 |
3404 | -msgid "RPM Version" | |
3405 | -msgstr "RPM Version" | |
3406 | +msgid "Current Version" | |
3407 | +msgstr "現在のバージョン" | |
3406 | 3408 | |
3407 | 3409 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:95 |
3408 | -msgid "Yum Version" | |
3409 | -msgstr "Yum Version" | |
3410 | +msgid "Latest Version" | |
3411 | +msgstr "最新のバージョン" | |
3410 | 3412 | |
3411 | 3413 | #: /root/src/karesansui/karesansui/templates/default/hostby1updater/hostby1updater.part:96 |
3412 | 3414 | msgid "Availability" |
3413 | -msgstr "Availability" | |
3415 | +msgstr "利用可能" | |
3414 | 3416 | |
3415 | 3417 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:33 |
3416 | 3418 | msgid "Version" |
3417 | -msgstr "Version" | |
3419 | +msgstr "バージョン" | |
3418 | 3420 | |
3419 | 3421 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:38 |
3420 | 3422 | msgid "Release" |
3421 | -msgstr "Release" | |
3422 | - | |
3423 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:43 | |
3424 | -msgid "Pkg_Summary" | |
3425 | -msgstr "Summary" | |
3423 | +msgstr "リリース" | |
3426 | 3424 | |
3427 | 3425 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:53 |
3428 | 3426 | msgid "URL" |
3429 | 3427 | msgstr "URL" |
3430 | 3428 | |
3431 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:58 | |
3432 | -msgid "Copyright" | |
3433 | -msgstr "Copyright" | |
3434 | - | |
3435 | 3429 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:63 |
3436 | 3430 | msgid "License" |
3437 | -msgstr "License" | |
3431 | +msgstr "ライセンス" | |
3438 | 3432 | |
3439 | 3433 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:68 |
3440 | 3434 | msgid "Vendor" |
3441 | -msgstr "Vendor" | |
3435 | +msgstr "ベンダー" | |
3442 | 3436 | |
3443 | 3437 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:73 |
3444 | 3438 | msgid "Group" |
3445 | -msgstr "Group" | |
3446 | - | |
3447 | -#: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:91 | |
3448 | -msgid "Pkg_Size" | |
3449 | -msgstr "Size" | |
3439 | +msgstr "グループ" | |
3450 | 3440 | |
3451 | 3441 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:96 |
3452 | 3442 | msgid "Build Host" |
3453 | -msgstr "Build Host" | |
3443 | +msgstr "作成ホスト" | |
3454 | 3444 | |
3455 | 3445 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:101 |
3456 | 3446 | msgid "OS" |
@@ -3458,23 +3448,23 @@ msgstr "OS" | ||
3458 | 3448 | |
3459 | 3449 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:106 |
3460 | 3450 | msgid "Description" |
3461 | -msgstr "Description" | |
3451 | +msgstr "説明" | |
3462 | 3452 | |
3463 | 3453 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:111 |
3464 | 3454 | msgid "Build Date" |
3465 | -msgstr "Build Date" | |
3455 | +msgstr "作成日時" | |
3466 | 3456 | |
3467 | 3457 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:116 |
3468 | 3458 | msgid "Install Date" |
3469 | -msgstr "Install Date" | |
3459 | +msgstr "インストール日時" | |
3470 | 3460 | |
3471 | 3461 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:121 |
3472 | 3462 | msgid "Requires" |
3473 | -msgstr "Requires" | |
3463 | +msgstr "依存関係" | |
3474 | 3464 | |
3475 | 3465 | #: /root/src/karesansui/karesansui/templates/default/hostby1updaterby1/hostby1updaterby1.part:130 |
3476 | 3466 | msgid "Packager" |
3477 | -msgstr "Packager" | |
3467 | +msgstr "パッケージャ" | |
3478 | 3468 | |
3479 | 3469 | #: /root/src/karesansui/karesansui/templates/default/include/base.html:86 |
3480 | 3470 | msgid "Domain tree" |
@@ -242,6 +242,13 @@ class YumUpdater(Updater): | ||
242 | 242 | if proxy is not None: |
243 | 243 | parser.set('main', 'proxy', proxy['http']) |
244 | 244 | |
245 | + """ | |
246 | + prevent overwriting karesansui source under development environment. | |
247 | + """ | |
248 | + cwd = os.path.dirname(os.path.abspath(__file__)) | |
249 | + if os.path.exists(cwd+"/../../.git/"): | |
250 | + parser.set('main', 'exclude', 'karesansui*') | |
251 | + | |
245 | 252 | fp = open(self._ftemp, "w") |
246 | 253 | parser.write(fp) |
247 | 254 | fp.close() |
@@ -64,6 +64,9 @@ $("#guests div").each(function(){ | ||
64 | 64 | var type = ""; |
65 | 65 | if(data.info["type"] != null){ |
66 | 66 | type = data.info["type"]; |
67 | + if(data.info["hv_version"] != null){ | |
68 | + type += " ("+data.info["hv_version"]+")"; | |
69 | + } | |
67 | 70 | } else { |
68 | 71 | type = "${_('Unknown')}"; |
69 | 72 | } |
@@ -258,6 +258,9 @@ renew_main_event("#tool_renew", "${ctx.homepath}${ctx.path}"); | ||
258 | 258 | <td> |
259 | 259 | %if not info["type"] is None: |
260 | 260 | ${info["type"] | h} |
261 | + %if not info["hv_version"] is None and not info["hv_version"] == -1: | |
262 | + (${info["hv_version"] | h}) | |
263 | + %endif | |
261 | 264 | %else: |
262 | 265 | ${_('Unknown')} |
263 | 266 | %endif |
@@ -89,10 +89,10 @@ $(document).ready(function(){ | ||
89 | 89 | <!-- |
90 | 90 | <th>${_('No.')}</th> |
91 | 91 | --> |
92 | - <th>${_('Pkg_Name')}</th> | |
92 | + <th>${_('Package Name')}</th> | |
93 | 93 | <th>${_('Arch')}</th> |
94 | - <th>${_('RPM Version')}</th> | |
95 | - <th>${_('Yum Version')}</th> | |
94 | + <th>${_('Current Version')}</th> | |
95 | + <th>${_('Latest Version')}</th> | |
96 | 96 | <th>${_('Availability')}</th> |
97 | 97 | </tr> |
98 | 98 | </thead> |
@@ -25,7 +25,7 @@ def time_format(text): | ||
25 | 25 | <td> |
26 | 26 | <table cellspacing="0" class="border detail-sub-contents"> |
27 | 27 | <tr> |
28 | - <th>${_('Pkg_Name')}</th> | |
28 | + <th>${_('Name')}</th> | |
29 | 29 | <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td> |
30 | 30 | <td><pre>${pkg['name'] | h}</pre></td> |
31 | 31 | </tr> |
@@ -40,7 +40,7 @@ def time_format(text): | ||
40 | 40 | <td><pre>${pkg['release'] | h}</pre></td> |
41 | 41 | </tr> |
42 | 42 | <tr> |
43 | - <th>${_('Pkg_Summary')}</th> | |
43 | + <th>${_('Summary')}</th> | |
44 | 44 | <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td> |
45 | 45 | <td><pre>${pkg['summary'] | h}</pre></td> |
46 | 46 | </tr> |
@@ -55,11 +55,6 @@ def time_format(text): | ||
55 | 55 | <td><pre>${pkg['url'] | h}</pre></td> |
56 | 56 | </tr> |
57 | 57 | <tr> |
58 | - <th>${_('Copyright')}</th> | |
59 | - <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td> | |
60 | - <td><pre>${pkg['copyright'] | h}</pre></td> | |
61 | - </tr> | |
62 | - <tr> | |
63 | 58 | <th>${_('License')}</th> |
64 | 59 | <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td> |
65 | 60 | <td><pre>${pkg['license'] | h}</pre></td> |
@@ -88,7 +83,7 @@ def time_format(text): | ||
88 | 83 | <td> |
89 | 84 | <table cellspacing="0" class="border detail-sub-contents"> |
90 | 85 | <tr> |
91 | - <th>${_('Pkg_Size')}</th> | |
86 | + <th>${_('Size')}</th> | |
92 | 87 | <td class="detail-separator"><img src="${ctx.homepath}/static/images/table-space.gif" alt="" /></td> |
93 | 88 | <td><pre>${pkg['size'] | h}</pre></td> |
94 | 89 | </tr> |
@@ -139,4 +134,4 @@ def time_format(text): | ||
139 | 134 | </td> |
140 | 135 | </tr> |
141 | 136 | </table> |
142 | -</div> | |
\ No newline at end of file | ||
137 | +</div> |
@@ -19,6 +19,15 @@ $(document).ready(function(){ | ||
19 | 19 | if($(this).html() == "RUN"){ |
20 | 20 | $("#job_run").attr("src", "${ctx.homepath}/static/images/stat-on.gif"); |
21 | 21 | state = false; |
22 | + | |
23 | + timer = setTimeout(function(){ | |
24 | + renew_msg(true); | |
25 | + }, 5000); | |
26 | + } else if($(this).html() == "PEND"){ | |
27 | + timer = setTimeout(function(){ | |
28 | + renew_msg(true); | |
29 | + }, 5000); | |
30 | + | |
22 | 31 | } else if(state){ |
23 | 32 | /* DO NOT REACH WHEN CHANGE $("#job_run").attr("src")*/ |
24 | 33 | $("#job_run").attr("src", "${ctx.homepath}/static/images/stat-off.gif"); |