[project-kimchi] [PATCH] Organize python imports
by Rodrigo Trujillo
Follow this rule:
1) Import common modules
import ...
import ...
from ... import ...
from ... import ...
2) Import kimchi modules
import kimchi.<mod>
import kimchi.<mod>
from kimchi import ...
from kimchi import ...
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
plugins/sample/__init__.py | 8 ++++++--
plugins/sample/model.py | 2 +-
src/kimchi/model.py | 4 ++--
src/kimchi/server.py | 2 +-
src/kimchi/sslcert.py | 2 +-
src/kimchi/websocket.py | 17 ++++++++++++++---
src/kimchi/websockify.py | 15 +++++++++++++--
tests/test_exception.py | 6 ++++--
tests/test_mockmodel.py | 5 +++--
tests/test_model.py | 18 ++++++++++--------
tests/test_networkxml.py | 4 +++-
tests/test_osinfo.py | 3 +++
tests/test_plugin.py | 4 +++-
tests/test_rest.py | 10 +++++++---
tests/test_server.py | 4 ++--
tests/test_vmtemplate.py | 2 ++
tests/utils.py | 15 +++++++++------
17 files changed, 84 insertions(+), 37 deletions(-)
diff --git a/plugins/sample/__init__.py b/plugins/sample/__init__.py
index a20f5e6..7064904 100644
--- a/plugins/sample/__init__.py
+++ b/plugins/sample/__init__.py
@@ -22,12 +22,16 @@
import json
import os
+
+
from cherrypy import expose
-from kimchi.controller import Resource, Collection
+
+
+from kimchi.controller import Collection, Resource
from model import Model
-model = Model()
+model = Model()
class Drawings(Resource):
def __init__(self):
diff --git a/plugins/sample/model.py b/plugins/sample/model.py
index f6da5d0..9a2f22f 100644
--- a/plugins/sample/model.py
+++ b/plugins/sample/model.py
@@ -20,7 +20,7 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-from kimchi.exception import NotFoundError, InvalidOperation
+from kimchi.exception import InvalidOperation, NotFoundError
class Model(object):
diff --git a/src/kimchi/model.py b/src/kimchi/model.py
index 73c18ac..1e4dac2 100644
--- a/src/kimchi/model.py
+++ b/src/kimchi/model.py
@@ -42,9 +42,9 @@ import time
import uuid
-from collections import defaultdict
from cherrypy.process.plugins import BackgroundTask
from cherrypy.process.plugins import SimplePlugin
+from collections import defaultdict
from xml.etree import ElementTree
@@ -69,7 +69,7 @@ from kimchi.networkxml import to_network_xml
from kimchi.objectstore import ObjectStore
from kimchi.scan import Scanner
from kimchi.screenshot import VMScreenshot
-from kimchi.utils import kimchi_log, is_digit, get_enabled_plugins
+from kimchi.utils import get_enabled_plugins, is_digit, kimchi_log
from kimchi.vmtemplate import VMTemplate
diff --git a/src/kimchi/server.py b/src/kimchi/server.py
index 6ff6fa0..114a3a0 100644
--- a/src/kimchi/server.py
+++ b/src/kimchi/server.py
@@ -33,7 +33,7 @@ from kimchi import config
from kimchi import model
from kimchi import mockmodel
from kimchi.root import Root
-from kimchi.utils import import_class, get_enabled_plugins
+from kimchi.utils import get_enabled_plugins, import_class
LOGGING_LEVEL = {"debug": logging.DEBUG,
diff --git a/src/kimchi/sslcert.py b/src/kimchi/sslcert.py
index 70441f2..529699d 100644
--- a/src/kimchi/sslcert.py
+++ b/src/kimchi/sslcert.py
@@ -28,7 +28,7 @@
import time
-from M2Crypto import X509, EVP, RSA, ASN1
+from M2Crypto import ASN1, EVP, RSA, X509
class SSLCert(object):
diff --git a/src/kimchi/websocket.py b/src/kimchi/websocket.py
index a98fc6d..945676d 100644
--- a/src/kimchi/websocket.py
+++ b/src/kimchi/websocket.py
@@ -16,9 +16,20 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates
'''
-import os, sys, time, errno, signal, socket, traceback, select
-import array, struct
-from base64 import b64encode, b64decode
+import array
+import errno
+import os
+import select
+import signal
+import socket
+import struct
+import sys
+import time
+import traceback
+
+
+from base64 import b64decode, b64encode
+
# Imports that vary by python version
diff --git a/src/kimchi/websockify.py b/src/kimchi/websockify.py
index 1154d92..2857e7c 100755
--- a/src/kimchi/websockify.py
+++ b/src/kimchi/websockify.py
@@ -11,15 +11,26 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates
'''
-import signal, socket, optparse, time, os, sys, subprocess
+import optparse
+import os
+import signal
+import socket
+import subprocess
+import sys
+import time
+
+
from select import select
-import websocket
try:
from urllib.parse import parse_qs, urlparse
except:
from cgi import parse_qs
from urlparse import urlparse
+
+import websocket
+
+
class WebSocketProxy(websocket.WebSocketServer):
"""
Proxy traffic to and from a WebSockets client to a normal TCP
diff --git a/tests/test_exception.py b/tests/test_exception.py
index 9b5355a..cb60995 100644
--- a/tests/test_exception.py
+++ b/tests/test_exception.py
@@ -20,14 +20,16 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import unittest
-import os
import json
+import os
+import unittest
+
import kimchi.mockmodel
import kimchi.server
from utils import *
+
test_server = None
model = None
host = None
diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
index b819172..0830a24 100644
--- a/tests/test_mockmodel.py
+++ b/tests/test_mockmodel.py
@@ -20,16 +20,17 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import unittest
import cherrypy
import json
import os
+import unittest
+
import kimchi.mockmodel
import kimchi.controller
-
from utils import *
+
#utils.silence_server()
test_server = None
model = None
diff --git a/tests/test_model.py b/tests/test_model.py
index fb7d6dd..07b68b1 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -21,21 +21,23 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import unittest
-import threading
import os
-import time
-import tempfile
-import psutil
import platform
+import psutil
+import tempfile
+import threading
+import time
+import unittest
import uuid
+
+import iso_gen
import kimchi.model
import kimchi.objectstore
-from kimchi.exception import *
-from kimchi import netinfo
import utils
-import iso_gen
+from kimchi import netinfo
+from kimchi.exception import *
+
class ModelTests(unittest.TestCase):
def setUp(self):
diff --git a/tests/test_networkxml.py b/tests/test_networkxml.py
index 4eeeaa2..3073bce 100644
--- a/tests/test_networkxml.py
+++ b/tests/test_networkxml.py
@@ -20,10 +20,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+import ipaddr
import unittest
+
+
import kimchi.networkxml as nxml
from kimchi.xmlutils import xpath_get_text
-import ipaddr
class NetworkXmlTests(unittest.TestCase):
diff --git a/tests/test_osinfo.py b/tests/test_osinfo.py
index f92567d..1dcfdaf 100644
--- a/tests/test_osinfo.py
+++ b/tests/test_osinfo.py
@@ -21,8 +21,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import unittest
+
+
from kimchi.osinfo import *
+
class OSInfoTests(unittest.TestCase):
def test_default_lookup(self):
name, entry = lookup(None, None)
diff --git a/tests/test_plugin.py b/tests/test_plugin.py
index 20cc598..f12b11f 100644
--- a/tests/test_plugin.py
+++ b/tests/test_plugin.py
@@ -20,17 +20,19 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import unittest
import json
import os
import sys
+import unittest
from functools import partial
+
import kimchi.mockmodel
import kimchi.server
import utils
from kimchi import config
+
test_server = None
model = None
host = None
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 73b5243..61369c3 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -20,16 +20,20 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import unittest
import json
-import time
import os
+import time
+import unittest
+
+
from functools import partial
+
import kimchi.mockmodel
import kimchi.server
-from utils import *
from kimchi.asynctask import AsyncTask
+from utils import *
+
test_server = None
model = None
diff --git a/tests/test_server.py b/tests/test_server.py
index 9bb0034..734a618 100644
--- a/tests/test_server.py
+++ b/tests/test_server.py
@@ -20,12 +20,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import unittest
import json
import os
+import unittest
-import utils
+import utils
import kimchi.mockmodel
#utils.silence_server()
diff --git a/tests/test_vmtemplate.py b/tests/test_vmtemplate.py
index 81382c7..92c7385 100644
--- a/tests/test_vmtemplate.py
+++ b/tests/test_vmtemplate.py
@@ -23,9 +23,11 @@
import unittest
import uuid
+
from kimchi.vmtemplate import *
from kimchi.xmlutils import xpath_get_text
+
class VMTemplateTests(unittest.TestCase):
def test_minimal_construct(self):
fields = (('name', 'test'), ('os_distro', 'unknown'),
diff --git a/tests/utils.py b/tests/utils.py
index c114813..a7596e8 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -21,16 +21,19 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
-import httplib
+import base64
import cherrypy
-import threading
-import time
+import httplib
import os
-import sys
import socket
-from contextlib import closing
+import sys
+import threading
+import time
import unittest
-import base64
+
+
+from contextlib import closing
+
import kimchi.server
import kimchi.model
--
1.8.1.4
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
11 years
[project-kimchi] [PATCH] do Chinese translation for release 1.1
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Update en_US.po, kimchi.pot and zh_CN.po.
Do not touch pt_BR.po
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
po/en_US.po | 357 +++++++++++++++++++++++++++++++++++++++------------------
po/kimchi.pot | 271 +++++++++++++++++++++++++++++++------------
po/zh_CN.po | 361 +++++++++++++++++++++++++++++++++++++++-------------------
3 files changed, 690 insertions(+), 299 deletions(-)
diff --git a/po/en_US.po b/po/en_US.po
index 86d7c81..7b6b1d7 100644
--- a/po/en_US.po
+++ b/po/en_US.po
@@ -6,14 +6,14 @@ msgid ""
msgstr ""
"Project-Id-Version: kimchi 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-11-25 16:33+0800\n"
+"POT-Creation-Date: 2013-12-18 23:43+0800\n"
"PO-Revision-Date: 2013-07-11 17:32-0400\n"
"Last-Translator: Crístian Viana <vianac(a)linux.vnet.ibm.com>\n"
"Language-Team: English\n"
+"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: en_US\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
@@ -144,6 +144,24 @@ msgstr "Memory"
msgid "Create"
msgstr "Create"
+msgid "Edit Guest"
+msgstr "Edit Guest"
+
+msgid "Name"
+msgstr "Name"
+
+msgid "CPUs"
+msgstr "CPUs"
+
+msgid "Icon"
+msgstr "Icon"
+
+msgid "Cancel"
+msgstr "Cancel"
+
+msgid "Save"
+msgstr "Save"
+
msgid "Reset"
msgstr "Reset"
@@ -156,20 +174,8 @@ msgstr "Stop"
msgid "Actions"
msgstr "Actions"
-msgid "Name"
-msgstr "Name"
-
-msgid "CPU"
-msgstr "CPU"
-
-msgid "Network I/O"
-msgstr "Network I/O"
-
-msgid "Disk I/O"
-msgstr "Disk I/O"
-
-msgid "Livetile"
-msgstr "Livetile"
+msgid "Edit"
+msgstr "Edit"
msgid "Failed to list the template"
msgstr "Failed to list the template"
@@ -213,6 +219,9 @@ msgstr "Failed to list guests"
msgid "Failed to create template"
msgstr "Failed to create template"
+msgid "Create template successfully"
+msgstr "Create template successfully"
+
msgid "No iso found"
msgstr "No iso found"
@@ -228,8 +237,70 @@ msgstr "Delete Confirmation"
msgid "OK"
msgstr "OK"
-msgid "Cancel"
-msgstr "Cancel"
+msgid "Max:"
+msgstr "Max:"
+
+msgid "Utilization"
+msgstr "Utilization"
+
+msgid "Available"
+msgstr "Available"
+
+msgid "Read Rate"
+msgstr "Read Rate"
+
+msgid "Write Rate"
+msgstr "Write Rate"
+
+msgid "Received"
+msgstr "Received"
+
+msgid "Sent"
+msgstr "Sent"
+
+msgid "Confirm"
+msgstr "Confirm"
+
+msgid ""
+"Debug report will be removed permanently and can't be recovered. Do you want "
+"to continue?"
+msgstr ""
+"Debug report will be removed permanently and can't be recovered. Do you want "
+"to continue?"
+
+msgid "Debug Reports"
+msgstr "Debug Reports"
+
+msgid "File Path"
+msgstr "File Path"
+
+msgid "Generated Time"
+msgstr "Generated Time"
+
+msgid "Generate"
+msgstr "Generate"
+
+msgid "Generating..."
+msgstr "Generating..."
+
+msgid "Rename"
+msgstr "Rename"
+
+msgid "Remove"
+msgstr "Remove"
+
+msgid "Download"
+msgstr "Download"
+
+msgid "Some VM(s) are running!"
+msgstr "Some VM(s) are running!"
+
+msgid ""
+"Shutting down or restarting host will cause unsaved work lost. Continue to "
+"shut down/restarting?"
+msgstr ""
+"Shutting down or restarting host will cause unsaved work lost. Continue to "
+"shut down/restarting?"
msgid ""
"This will delete the VM and its virtual disks. This operation cannot be "
@@ -298,6 +369,12 @@ msgstr "The storage pool is not active now."
msgid "Failed to delete template."
msgstr "Failed to delete template."
+msgid "unavailable"
+msgstr "unavailable"
+
+msgid "Network"
+msgstr "Network"
+
msgid "isolated"
msgstr "isolated"
@@ -323,15 +400,16 @@ msgstr "Create a network"
msgid "Warning"
msgstr "Warning"
+msgid ""
+"It will format your disk and you will loose any data in there, are you sure "
+"to continue? "
+msgstr ""
+"It will format your disk and you will loose any data in there, are you sure "
+"to continue? "
+
msgid "Log out"
msgstr "Log out"
-msgid "unavailable"
-msgstr "unavailable"
-
-msgid "Network"
-msgstr "Network"
-
msgid "Log In"
msgstr "Log In"
@@ -341,9 +419,136 @@ msgstr "Name"
msgid "Password"
msgstr "Password"
+msgid "Generate a New Debug Report"
+msgstr "Generate a New Debug Report"
+
+msgid "Report Name"
+msgstr "Report Name"
+
+msgid ""
+"The name used to identify the report. If omitted, a name will be chosen "
+"based on current time. Name can contain: letters, digits, \"-\", \"_\", or "
+"\".\"."
+msgstr ""
+"The name used to identify the report. If omitted, a name will be chosen "
+"based on current time. Name can contain: letters, digits, \"-\", \"_\", or "
+"\".\"."
+
+msgid "Define a New Storage Pool"
+msgstr "Define a New Storage Pool"
+
+msgid "Storage Pool Name"
+msgstr "Storage Pool Name"
+
+msgid ""
+"The name used to identify the storage pools, and it should not be empty."
+msgstr ""
+"The name used to identify the storage pools, and it should not be empty."
+
+msgid "Storage Pool Type"
+msgstr "Storage Pool Type"
+
+msgid "Storage Path"
+msgstr "Storage Path"
+
+msgid ""
+"The path of the Storage Pool. Each Storage Pool must have a unique path."
+msgstr ""
+"The path of the Storage Pool. Each Storage Pool must have a unique path."
+
+msgid "NFS server IP"
+msgstr "NFS server IP"
+
+msgid "NFS server IP or hostname. It should not be empty."
+msgstr "NFS server IP or hostname. It should not be empty."
+
+msgid "NFS Path"
+msgstr "NFS Path"
+
+msgid "The nfs exported path on nfs server"
+msgstr "The nfs exported path on nfs server"
+
+msgid "Device Path"
+msgstr "Device Path"
+
+msgid "CPU"
+msgstr "CPU"
+
+msgid "Network I/O"
+msgstr "Network I/O"
+
+msgid "Disk I/O"
+msgstr "Disk I/O"
+
+msgid "Livetile"
+msgstr "Livetile"
+
+msgid "No guests found."
+msgstr "No guests found."
+
+msgid "Shut down"
+msgstr "Shut down"
+
+msgid "Restart"
+msgstr "Restart"
+
+msgid "Connect"
+msgstr "Connect"
+
+msgid "Basic Information"
+msgstr "Basic Information"
+
+msgid "OS Distro"
+msgstr "OS Distro"
+
+msgid "OS Code Name"
+msgstr "OS Code Name"
+
+msgid "Processor"
+msgstr "Processor"
+
+msgid "System Statistics"
+msgstr "System Statistics"
+
+msgid "Collecting data after leaving this page"
+msgstr "Collecting data after leaving this page"
+
+msgid "Network Name"
+msgstr "Network Name"
+
msgid "State"
msgstr "State"
+msgid "Network Type"
+msgstr "Network Type"
+
+msgid "Interface"
+msgstr "Interface"
+
+msgid "Address Space"
+msgstr "Address Space"
+
+msgid "Alphanumeric and '_' characters only."
+msgstr "Alphanumeric and '_' characters only."
+
+msgid "Isolated: no physical network connection"
+msgstr "Isolated: no physical network connection"
+
+msgid "NAT: outbound physical network connection only"
+msgstr "NAT: outbound physical network connection only"
+
+msgid "Bridged: VMs are connected to physical network directly"
+msgstr "Bridged: VMs are connected to physical network directly"
+
+msgid "Destination"
+msgstr "Destination"
+
+msgid "No templates found."
+msgstr "No templates found."
+
+msgid "Version"
+msgstr "Version"
+
msgid "Location"
msgstr "Location"
@@ -377,25 +582,6 @@ msgstr "Format"
msgid "Allocation"
msgstr "Allocation"
-msgid "Define a New Storage Pool"
-msgstr "Define a New Storage Pool"
-
-msgid "Storage Pool Name"
-msgstr "Storage Pool Name"
-
-msgid ""
-"The name used to identify the storage pools, and it should not be empty."
-msgstr ""
-"The name used to identify the storage pools, and it should not be empty."
-
-msgid "Storage Path"
-msgstr "Storage Path"
-
-msgid ""
-"The path of the Storage Pool. Each Storage Pool must have a unique path."
-msgstr ""
-"The path of the Storage Pool. Each Storage Pool must have a unique path."
-
msgid "Add Template"
msgstr "Add Template"
@@ -408,6 +594,12 @@ msgstr "Local ISO Image"
msgid "Remote ISO Image"
msgstr "Remote ISO Image"
+msgid "Search ISOs"
+msgstr "Search ISOs"
+
+msgid "Please, wait..."
+msgstr "Please, wait..."
+
msgid "The following ISOs are available:"
msgstr "The following ISOs are available:"
@@ -423,6 +615,9 @@ msgstr "Version: "
msgid "Size: "
msgstr "Size: "
+msgid "Search more ISOs"
+msgstr "Search more ISOs"
+
msgid "Create Templates from Selected ISO"
msgstr "Create Templates from Selected ISO"
@@ -438,74 +633,14 @@ msgstr "Edit Template"
msgid "Vendor"
msgstr "Vendor"
-msgid "Version"
-msgstr "Version"
-
-msgid "Icon"
-msgstr "Icon"
-
-msgid "Default"
-msgstr "Default"
-
-msgid "Background Color"
-msgstr "Background Color"
-
-msgid "Overlay Type"
-msgstr "Overlay Type"
+msgid "CPU Number"
+msgstr "CPU Number"
-msgid "Overlay Type Icon"
-msgstr "Overlay Type Icon"
+msgid "Disk (GB)"
+msgstr "Disk (GB)"
-msgid "Overlay Type Text"
-msgstr "Overlay Type Text"
+msgid "CDROM"
+msgstr "CDROM"
-msgid "Button Finish Style"
-msgstr "Button Finish Style"
-
-msgid "Button Finish Style Gloss"
-msgstr "Button Finish Style Gloss"
-
-msgid "Button Finish Style Gradient"
-msgstr "Button Finish Style Gradient"
-
-msgid "Save"
-msgstr "Save"
-
-msgid "No templates found."
-msgstr "No templates found."
-
-msgid "Edit"
-msgstr "Edit"
-
-msgid "Default Settings"
-msgstr "Default Settings"
-
-msgid "CPUs"
-msgstr "CPUs"
-
-msgid "Network Name"
-msgstr "Network Name"
-
-msgid "Network Type"
-msgstr "Network Type"
-
-msgid "Interface"
-msgstr "Interface"
-
-msgid "Address Space"
-msgstr "Address Space"
-
-msgid "Alphanumeric and '_' characters only."
-msgstr "Alphanumeric and '_' characters only."
-
-msgid "Isolated: no physical network connection"
-msgstr "Isolated: no physical network connection"
-
-msgid "NAT: outbound physical network connection only"
-msgstr "NAT: outbound physical network connection only"
-
-msgid "Bridged: VMs are connected to physical network directly"
-msgstr "Bridged: VMs are connected to physical network directly"
-
-msgid "Destination"
-msgstr "Destination"
+msgid "Storage Pool"
+msgstr "Storage Pool"
diff --git a/po/kimchi.pot b/po/kimchi.pot
index 1d2c688..c83f089 100644
--- a/po/kimchi.pot
+++ b/po/kimchi.pot
@@ -8,10 +8,11 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-11-25 16:33+0800\n"
+"POT-Creation-Date: 2013-12-18 23:43+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -141,31 +142,37 @@ msgstr ""
msgid "Create"
msgstr ""
-msgid "Reset"
+msgid "Edit Guest"
msgstr ""
-msgid "Start"
+msgid "Name"
msgstr ""
-msgid "Stop"
+msgid "CPUs"
msgstr ""
-msgid "Actions"
+msgid "Icon"
msgstr ""
-msgid "Name"
+msgid "Cancel"
msgstr ""
-msgid "CPU"
+msgid "Save"
msgstr ""
-msgid "Network I/O"
+msgid "Reset"
msgstr ""
-msgid "Disk I/O"
+msgid "Start"
msgstr ""
-msgid "Livetile"
+msgid "Stop"
+msgstr ""
+
+msgid "Actions"
+msgstr ""
+
+msgid "Edit"
msgstr ""
msgid "Failed to list the template"
@@ -210,6 +217,9 @@ msgstr ""
msgid "Failed to create template"
msgstr ""
+msgid "Create template successfully"
+msgstr ""
+
msgid "No iso found"
msgstr ""
@@ -225,7 +235,65 @@ msgstr ""
msgid "OK"
msgstr ""
-msgid "Cancel"
+msgid "Max:"
+msgstr ""
+
+msgid "Utilization"
+msgstr ""
+
+msgid "Available"
+msgstr ""
+
+msgid "Read Rate"
+msgstr ""
+
+msgid "Write Rate"
+msgstr ""
+
+msgid "Received"
+msgstr ""
+
+msgid "Sent"
+msgstr ""
+
+msgid "Confirm"
+msgstr ""
+
+msgid ""
+"Debug report will be removed permanently and can't be recovered. Do you want "
+"to continue?"
+msgstr ""
+
+msgid "Debug Reports"
+msgstr ""
+
+msgid "File Path"
+msgstr ""
+
+msgid "Generated Time"
+msgstr ""
+
+msgid "Generate"
+msgstr ""
+
+msgid "Generating..."
+msgstr ""
+
+msgid "Rename"
+msgstr ""
+
+msgid "Remove"
+msgstr ""
+
+msgid "Download"
+msgstr ""
+
+msgid "Some VM(s) are running!"
+msgstr ""
+
+msgid ""
+"Shutting down or restarting host will cause unsaved work lost. Continue to "
+"shut down/restarting?"
msgstr ""
msgid ""
@@ -290,6 +358,12 @@ msgstr ""
msgid "Failed to delete template."
msgstr ""
+msgid "unavailable"
+msgstr ""
+
+msgid "Network"
+msgstr ""
+
msgid "isolated"
msgstr ""
@@ -313,13 +387,12 @@ msgstr ""
msgid "Warning"
msgstr ""
-msgid "Log out"
-msgstr ""
-
-msgid "unavailable"
+msgid ""
+"It will format your disk and you will loose any data in there, are you sure "
+"to continue? "
msgstr ""
-msgid "Network"
+msgid "Log out"
msgstr ""
msgid "Log In"
@@ -331,169 +404,223 @@ msgstr ""
msgid "Password"
msgstr ""
-msgid "State"
+msgid "Generate a New Debug Report"
msgstr ""
-msgid "Location"
+msgid "Report Name"
msgstr ""
-msgid "Type"
+msgid ""
+"The name used to identify the report. If omitted, a name will be chosen "
+"based on current time. Name can contain: letters, digits, \"-\", \"_\", or "
+"\".\"."
msgstr ""
-msgid "Capacity"
+msgid "Define a New Storage Pool"
msgstr ""
-msgid "Allocated"
+msgid "Storage Pool Name"
msgstr ""
-msgid "active"
+msgid ""
+"The name used to identify the storage pools, and it should not be empty."
msgstr ""
-msgid "inactive"
+msgid "Storage Pool Type"
msgstr ""
-msgid "Deactivate"
+msgid "Storage Path"
msgstr ""
-msgid "Activate"
+msgid ""
+"The path of the Storage Pool. Each Storage Pool must have a unique path."
msgstr ""
-msgid "Undefine"
+msgid "NFS server IP"
msgstr ""
-msgid "Format"
+msgid "NFS server IP or hostname. It should not be empty."
msgstr ""
-msgid "Allocation"
+msgid "NFS Path"
msgstr ""
-msgid "Define a New Storage Pool"
+msgid "The nfs exported path on nfs server"
msgstr ""
-msgid "Storage Pool Name"
+msgid "Device Path"
msgstr ""
-msgid ""
-"The name used to identify the storage pools, and it should not be empty."
+msgid "CPU"
msgstr ""
-msgid "Storage Path"
+msgid "Network I/O"
msgstr ""
-msgid ""
-"The path of the Storage Pool. Each Storage Pool must have a unique path."
+msgid "Disk I/O"
msgstr ""
-msgid "Add Template"
+msgid "Livetile"
msgstr ""
-msgid "Where is the source media for this template? "
+msgid "No guests found."
msgstr ""
-msgid "Local ISO Image"
+msgid "Shut down"
msgstr ""
-msgid "Remote ISO Image"
+msgid "Restart"
msgstr ""
-msgid "The following ISOs are available:"
+msgid "Connect"
msgstr ""
-msgid "All"
+msgid "Basic Information"
msgstr ""
-msgid "OS: "
+msgid "OS Distro"
msgstr ""
-msgid "Version: "
+msgid "OS Code Name"
msgstr ""
-msgid "Size: "
+msgid "Processor"
msgstr ""
-msgid "Create Templates from Selected ISO"
+msgid "System Statistics"
msgstr ""
-msgid "I want to use a specific ISO file"
+msgid "Collecting data after leaving this page"
msgstr ""
-msgid "I want to use a custom URL"
+msgid "Network Name"
msgstr ""
-msgid "Edit Template"
+msgid "State"
msgstr ""
-msgid "Vendor"
+msgid "Network Type"
+msgstr ""
+
+msgid "Interface"
+msgstr ""
+
+msgid "Address Space"
+msgstr ""
+
+msgid "Alphanumeric and '_' characters only."
+msgstr ""
+
+msgid "Isolated: no physical network connection"
+msgstr ""
+
+msgid "NAT: outbound physical network connection only"
+msgstr ""
+
+msgid "Bridged: VMs are connected to physical network directly"
+msgstr ""
+
+msgid "Destination"
+msgstr ""
+
+msgid "No templates found."
msgstr ""
msgid "Version"
msgstr ""
-msgid "Icon"
+msgid "Location"
msgstr ""
-msgid "Default"
+msgid "Type"
msgstr ""
-msgid "Background Color"
+msgid "Capacity"
msgstr ""
-msgid "Overlay Type"
+msgid "Allocated"
msgstr ""
-msgid "Overlay Type Icon"
+msgid "active"
msgstr ""
-msgid "Overlay Type Text"
+msgid "inactive"
msgstr ""
-msgid "Button Finish Style"
+msgid "Deactivate"
msgstr ""
-msgid "Button Finish Style Gloss"
+msgid "Activate"
msgstr ""
-msgid "Button Finish Style Gradient"
+msgid "Undefine"
msgstr ""
-msgid "Save"
+msgid "Format"
msgstr ""
-msgid "No templates found."
+msgid "Allocation"
msgstr ""
-msgid "Edit"
+msgid "Add Template"
msgstr ""
-msgid "Default Settings"
+msgid "Where is the source media for this template? "
msgstr ""
-msgid "CPUs"
+msgid "Local ISO Image"
msgstr ""
-msgid "Network Name"
+msgid "Remote ISO Image"
msgstr ""
-msgid "Network Type"
+msgid "Search ISOs"
msgstr ""
-msgid "Interface"
+msgid "Please, wait..."
msgstr ""
-msgid "Address Space"
+msgid "The following ISOs are available:"
msgstr ""
-msgid "Alphanumeric and '_' characters only."
+msgid "All"
msgstr ""
-msgid "Isolated: no physical network connection"
+msgid "OS: "
msgstr ""
-msgid "NAT: outbound physical network connection only"
+msgid "Version: "
msgstr ""
-msgid "Bridged: VMs are connected to physical network directly"
+msgid "Size: "
msgstr ""
-msgid "Destination"
+msgid "Search more ISOs"
+msgstr ""
+
+msgid "Create Templates from Selected ISO"
+msgstr ""
+
+msgid "I want to use a specific ISO file"
+msgstr ""
+
+msgid "I want to use a custom URL"
+msgstr ""
+
+msgid "Edit Template"
+msgstr ""
+
+msgid "Vendor"
+msgstr ""
+
+msgid "CPU Number"
+msgstr ""
+
+msgid "Disk (GB)"
+msgstr ""
+
+msgid "CDROM"
+msgstr ""
+
+msgid "Storage Pool"
msgstr ""
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 2a34051..6d13f4e 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -20,14 +20,14 @@ msgid ""
msgstr ""
"Project-Id-Version: kimchi 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-11-25 16:33+0800\n"
+"POT-Creation-Date: 2013-12-18 23:43+0800\n"
"PO-Revision-Date: 2013-06-27 10:48+0000\n"
"Last-Translator: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>\n"
"Language-Team: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>\n"
+"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Language: zh_CN\n"
"Generated-By: pygettext.py 1.5\n"
"X-Poedit-Country: CHINA\n"
"X-Poedit-Language: Chinese\n"
@@ -158,6 +158,24 @@ msgstr "内存"
msgid "Create"
msgstr "创建"
+msgid "Edit Guest"
+msgstr "修改客户机"
+
+msgid "Name"
+msgstr "名称"
+
+msgid "CPUs"
+msgstr "中央处理器"
+
+msgid "Icon"
+msgstr "图标"
+
+msgid "Cancel"
+msgstr "取消"
+
+msgid "Save"
+msgstr "保存"
+
msgid "Reset"
msgstr "重置"
@@ -170,20 +188,8 @@ msgstr "停止"
msgid "Actions"
msgstr "操作"
-msgid "Name"
-msgstr "名称"
-
-msgid "CPU"
-msgstr "处理器"
-
-msgid "Network I/O"
-msgstr "网络I/O"
-
-msgid "Disk I/O"
-msgstr "磁盘I/O"
-
-msgid "Livetile"
-msgstr "屏幕"
+msgid "Edit"
+msgstr "编辑"
msgid "Failed to list the template"
msgstr "展示模板列表失败"
@@ -227,6 +233,9 @@ msgstr "客户机列表加载失败"
msgid "Failed to create template"
msgstr "模板创建失败"
+msgid "Create template successfully"
+msgstr "创建模板成功"
+
msgid "No iso found"
msgstr "没有发现ISO文件"
@@ -242,8 +251,66 @@ msgstr "删除确认"
msgid "OK"
msgstr "确定"
-msgid "Cancel"
-msgstr "取消"
+msgid "Max:"
+msgstr "最大:"
+
+msgid "Utilization"
+msgstr "利用率"
+
+msgid "Available"
+msgstr "可利用的"
+
+msgid "Read Rate"
+msgstr "读速率"
+
+msgid "Write Rate"
+msgstr "写速率"
+
+msgid "Received"
+msgstr "接收"
+
+msgid "Sent"
+msgstr "发送"
+
+msgid "Confirm"
+msgstr "确认"
+
+msgid ""
+"Debug report will be removed permanently and can't be recovered. Do you want "
+"to continue?"
+msgstr "诊断报告将被永久删除,并且不能恢复。继续?"
+
+msgid "Debug Reports"
+msgstr "主机诊断报告"
+
+msgid "File Path"
+msgstr "文件路径"
+
+msgid "Generated Time"
+msgstr "生成时间"
+
+msgid "Generate"
+msgstr "生成"
+
+msgid "Generating..."
+msgstr "正在生成..."
+
+msgid "Rename"
+msgstr "重命名"
+
+msgid "Remove"
+msgstr "删除"
+
+msgid "Download"
+msgstr "下载"
+
+msgid "Some VM(s) are running!"
+msgstr "有虚拟机在运行!"
+
+msgid ""
+"Shutting down or restarting host will cause unsaved work lost. Continue to "
+"shut down/restarting?"
+msgstr "关闭或者重启主机会导致没有保存的工作丢失。继续关机/重启?"
msgid ""
"This will delete the VM and its virtual disks. This operation cannot be "
@@ -263,7 +330,7 @@ msgid "This is not a valid url."
msgstr "这不是一个有效的URL"
msgid "This is not a valid ISO file."
-msgstr ""
+msgstr "这不是一个有效的ISO文件"
msgid ""
"This will permanently delete the Storage Pool. Would you like to continue?"
@@ -276,10 +343,10 @@ msgid "The storage pool path can not be blank."
msgstr "存储池的路径不能为空"
msgid "NFS server can not be blank."
-msgstr ""
+msgstr "NFS服务器不能为空"
msgid "NFS server mount path can not be blank."
-msgstr ""
+msgstr "NFS服务器挂载路径不能为空"
msgid ""
"Invalid Storage Pool name. It may only contain letters, numbers, "
@@ -290,10 +357,10 @@ msgid "This is not a real linux path."
msgstr "这不是一个符合要求的LINUX路径"
msgid "This is not a valid NFS server."
-msgstr ""
+msgstr "这不是一个有效的NFS服务器"
msgid "Invalid nfs mount path."
-msgstr ""
+msgstr "无效的nfs挂载路径"
msgid "This storage pool is empty."
msgstr "这个存储池为空"
@@ -305,7 +372,13 @@ msgid "The storage pool is not active now."
msgstr "存储池没有被启用"
msgid "Failed to delete template."
-msgstr ""
+msgstr "删除模版失败"
+
+msgid "unavailable"
+msgstr "无法获取"
+
+msgid "Network"
+msgstr "网络"
msgid "isolated"
msgstr "隔离"
@@ -330,15 +403,15 @@ msgstr "创建一个网络"
msgid "Warning"
msgstr "警告"
+msgid ""
+"It will format your disk and you will loose any data in there, are you sure "
+"to continue? "
+msgstr ""
+"你的磁盘将会格式化,磁盘上的数据会丢失,你确定要继续吗?"
+
msgid "Log out"
msgstr "登出"
-msgid "unavailable"
-msgstr "无法获取"
-
-msgid "Network"
-msgstr "网络"
-
msgid "Log In"
msgstr "登录"
@@ -348,9 +421,133 @@ msgstr "用户名"
msgid "Password"
msgstr "密码"
+msgid "Generate a New Debug Report"
+msgstr "产生一个新的诊断报告"
+
+msgid "Report Name"
+msgstr "诊断报告名"
+
+msgid ""
+"The name used to identify the report. If omitted, a name will be chosen "
+"based on current time. Name can contain: letters, digits, \"-\", \"_\", or "
+"\".\"."
+msgstr ""
+"该名称用来唯一标识报告,如果不指定,将会基于当前时间自动生成一个名称。名称可"
+"以包含: 字母、数字、\"-\"、\"_\" 或者 \".\""
+
+msgid "Define a New Storage Pool"
+msgstr "定义一个新的存储池"
+
+msgid "Storage Pool Name"
+msgstr "存储池名称"
+
+msgid ""
+"The name used to identify the storage pools, and it should not be empty."
+msgstr "该名称用来唯一标识存储池,该名称不能为空。"
+
+msgid "Storage Pool Type"
+msgstr "存储池类型"
+
+msgid "Storage Path"
+msgstr "存储路径"
+
+msgid ""
+"The path of the Storage Pool. Each Storage Pool must have a unique path."
+msgstr "存储池的路径.每个存储池的路径是唯一的。"
+
+msgid "NFS server IP"
+msgstr "NFS服务器IP"
+
+msgid "NFS server IP or hostname. It should not be empty."
+msgstr "NFS服务器IP或者主机名, 不能为空。"
+
+msgid "NFS Path"
+msgstr "NFS 路径"
+
+msgid "The nfs exported path on nfs server"
+msgstr "nfs服务器上导出的路径"
+
+msgid "Device Path"
+msgstr "设备路径"
+
+msgid "CPU"
+msgstr "处理器"
+
+msgid "Network I/O"
+msgstr "网络I/O"
+
+msgid "Disk I/O"
+msgstr "磁盘I/O"
+
+msgid "Livetile"
+msgstr "屏幕"
+
+msgid "No guests found."
+msgstr "没有发现客户机"
+
+msgid "Shut down"
+msgstr "关机"
+
+msgid "Restart"
+msgstr "重启"
+
+msgid "Connect"
+msgstr "连接到"
+
+msgid "Basic Information"
+msgstr "基本信息"
+
+msgid "OS Distro"
+msgstr "操作系统发布版本"
+
+msgid "OS Code Name"
+msgstr "操作系统代码"
+
+msgid "Processor"
+msgstr "处理器"
+
+msgid "System Statistics"
+msgstr "系统统计信息"
+
+msgid "Collecting data after leaving this page"
+msgstr "离开该页面继续收集数据"
+
+msgid "Network Name"
+msgstr "网络名称"
+
msgid "State"
msgstr "状态"
+msgid "Network Type"
+msgstr "网络类型"
+
+msgid "Interface"
+msgstr "网络接口"
+
+msgid "Address Space"
+msgstr "地址空间"
+
+msgid "Alphanumeric and '_' characters only."
+msgstr "字母,数字和下划线。"
+
+msgid "Isolated: no physical network connection"
+msgstr "隔离: 同物理网络不连通"
+
+msgid "NAT: outbound physical network connection only"
+msgstr "NAT: 从虚拟机到物理网络单向连接"
+
+msgid "Bridged: VMs are connected to physical network directly"
+msgstr "桥接: 虚拟机直接接入物理网络"
+
+msgid "Destination"
+msgstr "目标设备"
+
+msgid "No templates found."
+msgstr "没有发现模板"
+
+msgid "Version"
+msgstr "版本"
+
msgid "Location"
msgstr "路径"
@@ -384,23 +581,6 @@ msgstr "格式"
msgid "Allocation"
msgstr "分配"
-msgid "Define a New Storage Pool"
-msgstr "定义一个新的存储池"
-
-msgid "Storage Pool Name"
-msgstr "存储池名称"
-
-msgid ""
-"The name used to identify the storage pools, and it should not be empty."
-msgstr "该名称用来唯一标识存储池,如果不指定,将会基于模板自动生成一个名称。"
-
-msgid "Storage Path"
-msgstr "存储路径"
-
-msgid ""
-"The path of the Storage Pool. Each Storage Pool must have a unique path."
-msgstr "存储池的路径.每个存储池的路径是唯一的。"
-
msgid "Add Template"
msgstr "创建模板"
@@ -413,6 +593,12 @@ msgstr "本地ISO镜像"
msgid "Remote ISO Image"
msgstr "远程ISO镜像"
+msgid "Search ISOs"
+msgstr "搜索ISO"
+
+msgid "Please, wait..."
+msgstr "请等待..."
+
msgid "The following ISOs are available:"
msgstr "可用ISO文件如下"
@@ -428,11 +614,14 @@ msgstr "版本: "
msgid "Size: "
msgstr "大小:"
+msgid "Search more ISOs"
+msgstr "搜索更多ISO"
+
msgid "Create Templates from Selected ISO"
msgstr "从选中的ISO中创建模板"
msgid "I want to use a specific ISO file"
-msgstr ""
+msgstr "指定一个ISO文件"
msgid "I want to use a custom URL"
msgstr "我想用一个自定义的URL"
@@ -443,74 +632,14 @@ msgstr "编辑模板"
msgid "Vendor"
msgstr "厂商"
-msgid "Version"
-msgstr "版本"
-
-msgid "Icon"
-msgstr "图标"
-
-msgid "Default"
-msgstr "默认"
-
-msgid "Background Color"
-msgstr "背景颜色"
-
-msgid "Overlay Type"
-msgstr "叠层类型"
-
-msgid "Overlay Type Icon"
-msgstr "叠层型图标"
-
-msgid "Overlay Type Text"
-msgstr "叠层型文本"
-
-msgid "Button Finish Style"
-msgstr "完成按钮样式"
-
-msgid "Button Finish Style Gloss"
-msgstr "纯色"
-
-msgid "Button Finish Style Gradient"
-msgstr "渐变色"
-
-msgid "Save"
-msgstr "保存"
-
-msgid "No templates found."
-msgstr "没有发现模板"
-
-msgid "Edit"
-msgstr "编辑"
-
-msgid "Default Settings"
-msgstr "默认设置"
-
-msgid "CPUs"
-msgstr "中央处理器"
+msgid "CPU Number"
+msgstr "CPU个数"
-msgid "Network Name"
-msgstr "网络名称"
+msgid "Disk (GB)"
+msgstr "磁盘(GB)"
-msgid "Network Type"
-msgstr "网络类型"
-
-msgid "Interface"
-msgstr "网络接口"
-
-msgid "Address Space"
-msgstr "地址空间"
+msgid "CDROM"
+msgstr "光驱"
-msgid "Alphanumeric and '_' characters only."
-msgstr "字母,数字和下划线。"
-
-msgid "Isolated: no physical network connection"
-msgstr "隔离: 同物理网络不连通"
-
-msgid "NAT: outbound physical network connection only"
-msgstr "NAT: 从虚拟机到物理网络单向连接"
-
-msgid "Bridged: VMs are connected to physical network directly"
-msgstr "桥接: 虚拟机直接接入物理网络"
-
-msgid "Destination"
-msgstr "目标设备"
+msgid "Storage Pool"
+msgstr "存储池"
--
1.7.11.7
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
11 years
[project-kimchi] Use sysfs to list all block device paths
by Zhou Zheng Sheng
Hi all,
I find block device information in sysfs is accurate and complete.
Firstly run
lsblk -bPo NAME,MAJ:MIN
It shows
NAME="vda" MAJ:MIN="253:0"
NAME="vda1" MAJ:MIN="253:1"
When there is multipath, it shows
NAME="35000cca68ac8e2fd" MAJ:MIN="253:0"
NAME="35000cca68ac8e2fdp1" MAJ:MIN="253:1"
Then we parse the major and min, and cat the related sysfs uevent file
cat /sys/dev/block/253\:0/uevent
It shows
MAJOR=253
MINOR=0
DEVNAME=vda
DEVTYPE=disk
When there is multipath, it shows
MAJOR=253
MINOR=0
DEVNAME=dm-0
DEVTYPE=disk
The "DEVNAME=vda" or "DEVNAME=dm-0" is the device node name under the
"/dev/"
So there can be
/dev/vda
or
/dev/dm-0
In fact, on my machine, the multipath device node is a link to dm-0
/dev/mapper/35000cca68ac8e2fd -> ../dm-0
So we can show in front-end like following.
vda1 (/dev/vda1)
35000cca68ac8e2fd (/dev/dm-0)
The use mostly cares the name, the path is just supplement information.
User just asks front-end to use "vda1" or "35000cca68ac8e2fd" to create
pool, then we map the names to path.
In this way we don't need to blkid to determine the path, and can drop
the check on" blkid path being not None". Test on Fedora and Ubuntu.
Generally speaking, I also can accept a temp solution just assuming all
NAME listed by lsblk can be mapped to "/dev/NAME". We just need to check
if "/dev/NAME" does exist or not, if not, skip this device.
I'm afraid I have no time to finish a second version of the patch. Maybe
Aline or Daniel can help me. I feel very sorry to not have time to
finish the patch I started. Thanks very much!
--
Thanks and best regards!
Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou(a)linux.vnet.ibm.com
Telephone: 86-10-82454397
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
11 years
[project-kimchi] [PATCH v1 1/3] PEP 8: cleanup src/kimchi/disks.py
by Zhou Zheng Sheng
Make this file PEP 8 clean
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
Makefile.am | 1 +
src/kimchi/disks.py | 37 ++++++++++++++++++++-----------------
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b79919c..e57d3b6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,6 +40,7 @@ EXTRA_DIST = \
PEP8_WHITELIST = \
src/kimchi/asynctask.py \
src/kimchi/config.py.in \
+ src/kimchi/disks.py \
src/kimchi/server.py \
plugins/__init__.py \
plugins/sample/__init__.py \
diff --git a/src/kimchi/disks.py b/src/kimchi/disks.py
index 93d5dbc..874f669 100644
--- a/src/kimchi/disks.py
+++ b/src/kimchi/disks.py
@@ -18,26 +18,26 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import collections
-import os
import re
import subprocess
-import sys
from kimchi.exception import OperationFailed
+
def get_partitions_paths():
try:
""" Returns all available partitions path of the host """
- blkid = subprocess.Popen(["blkid", "-o", "device" ],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ blkid = subprocess.Popen(
+ ["blkid", "-o", "device"],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
dev_paths = blkid.communicate()[0].rstrip("\n").split("\n")
except:
raise OperationFailed("Unable to retrieve partitions' full path.")
return dev_paths
+
def get_partition_path(name, dev_paths):
""" Returns device path given a partition name """
dev_path = None
@@ -49,11 +49,13 @@ def get_partition_path(name, dev_paths):
if dev_path:
return dev_path
+
def get_partitions_names():
try:
""" Returns all the names of available partitions """
- lsblk = subprocess.Popen(["lsblk", "-Pbo","NAME,TYPE" ],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ lsblk = subprocess.Popen(
+ ["lsblk", "-Pbo", "NAME,TYPE"],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = lsblk.communicate()[0]
lines_output = output.rstrip("\n").split("\n")
# Will be used later to double check the partition
@@ -67,11 +69,12 @@ def get_partitions_names():
expression = r"%s=\".*?\"" % key
match = re.search(expression, line)
field = match.group()
- k, v = field.split('=',1)
+ k, v = field.split('=', 1)
d[k.lower()] = v[1:-1]
- if d['type'] not in ['part','lvm']:
+ if d['type'] not in ['part', 'lvm']:
continue
- # split()[0] to avoid the second part of the name, after the whiteline
+ # split()[0] to avoid the second part of the name,
+ # after the whiteline
name = d['name'].split()[0]
# There are special cases where lsblk reports
# a partition that does not exist in blkid and fdisk (Extended
@@ -84,18 +87,18 @@ def get_partitions_names():
except:
raise OperationFailed("Unable to retrieve partitions' full path.")
+
def get_partition_details(name):
try:
# Find device path
- dev_path = get_partition_path(name,
- get_partitions_paths())
+ dev_path = get_partition_path(name, get_partitions_paths())
# Couldn't find dev_path.
if not dev_path:
return
# Executing lsblk to get partition/disk info
- lsblk = subprocess.Popen(["lsblk", "-Pbo",
- "TYPE,FSTYPE,SIZE,MOUNTPOINT", dev_path ],
- stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ lsblk = subprocess.Popen(
+ ["lsblk", "-Pbo", "TYPE,FSTYPE,SIZE,MOUNTPOINT", dev_path],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# single line output
output = lsblk.communicate()[0].rstrip("\n")
# output is on format key="value", where key = NAME, TYPE, FSTYPE,
@@ -106,7 +109,7 @@ def get_partition_details(name):
expression = r"%s=\".*?\"" % key
match = re.search(expression, output)
field = match.group()
- k, v = field.split('=',1)
+ k, v = field.split('=', 1)
d[k.lower()] = v[1:-1]
if d['mountpoint']:
# Sometimes the mountpoint comes with [SWAP] or other
--
1.7.11.7
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
11 years
[project-kimchi][PATCHv2 0/2] NFS prevalidation
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
v1>v2, move nfs checking to util to avoid misunderstanding.
This patchset solves following problem:
1. libvirt uses local directory when nfs target path is not accessible,
this patch denies this unaccessible path instead.
2. libvirt storage subsystem hang for a long period, with a quick checking,
storage pool operation will not hang if pre-checked.
3. Future access control check will do in prevalidation,
this prevents qemu manipulate storage pool of no read access to make early warning.
Royce Lv (2):
utils: Add nfs prevalication
Integrate nfs path check before create nfs pool
src/kimchi/model.py | 7 ++++++-
src/kimchi/utils.py | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
--
1.8.1.2
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
11 years
Re: [Kimchi-devel] [project-kimchi][PATCH 1/3] utils: Add a helper function to parse cmd result
by Royce Lv
On 2013年12月17日 20:50, Ramon Medeiros wrote:
> On 12/17/2013 10:10 AM, lvroyce0210(a)gmail.com wrote:
>> From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
>>
>> Abstract a helper function to parse cmd result.
>> Usage:
>> (1)get cmd result with subprocess.call or subprocess.Popen
>> (2) call pass_cmd_output to get formated outputs
>> Example:
>> blkid = subprocess.Popen(["cat", "/proc/mounts"],
>> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>> outs = blkid.communicate()[0]
>> output_items= ['path', 'mnt_point', 'type', 'option']
>> utils.pass_cmd_output(outs, output_items)
>> Sample output:
>> [{'path': '/dev/sda8', 'type': 'ext4',
>> 'option': 'rw,relatime,data=ordered', 'mnt_point': '/home'},
>> {'path': 'localhost:/home/royce/isorepo', 'type': 'nfs4',
>> 'option': 'rw...addr=127.0.0.1', 'mnt_point': '/mnt'}]
>>
>> Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
>> ---
>> src/kimchi/utils.py | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
>> index f7eda93..1890a28 100644
>> --- a/src/kimchi/utils.py
>> +++ b/src/kimchi/utils.py
>> @@ -84,3 +84,10 @@ def import_class(class_path):
>>
>> def import_module(module_name):
>> return __import__(module_name, fromlist=[''])
>> +
>> +def parse_cmd_output(output, output_items):
>> + res = []
>> + for line in output.split("\n"):
> can you get the Popen result and use readlines, to get a array with
> the lines, instead of striping it?
Hi Ramon,
Thanks for your review, I think for file read result it is OK, but seems
for popen.communicate just pull out the raw output , and only stdout
provide readlines interface, which official doc does not recommend
because of deadlock problem.
(http://docs.python.org/3.3/library/subprocess.html#subprocess.Popen.commu...).
>> + res.append(dict(zip(output_items, line.split())))
>> +
>> + return res
>
>
--
project-kimchi mailing list <project-kimchi(a)googlegroups.com>
https://groups.google.com/forum/#!forum/project-kimchi
---
You received this message because you are subscribed to the Google Groups "project-kimchi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe(a)googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
11 years