Timothy Asir has uploaded a new change for review.
Change subject: Provide device details using python-blivet module
......................................................................
Provide device details using python-blivet module
This provides list of disks details of the host.
The details are name, container, mount path, model, type of device,
filesystem, size, uuid of the disk.
Change-Id: I85f520c6f476731cb5982d8256cb701387be87cf
Signed-off-by: Timothy Asir <tjeyasin(a)redhat.com>
---
M client/vdsClientGluster.py
M vdsm.spec.in
M vdsm/gluster/__init__.py
M vdsm/gluster/api.py
A vdsm/gluster/storageconf.py
5 files changed, 85 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/35028/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index 421c853..3cd1156 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -430,6 +430,11 @@
pp.pprint(status)
return status['status']['code'],
status['status']['message']
+ def do_glusterGetDeviceInfo(self, args):
+ status = self.s.glusterGetDeviceInfo()
+ pp.pprint(status)
+ return status['status']['code'],
status['status']['message']
+
def getGlusterCmdDict(serv):
return \
@@ -731,4 +736,9 @@
('volumeName=<volume name>',
'Returns total, free and used space(bytes) of gluster volume'
)),
+ 'glusterGetDeviceInfo': (
+ serv.do_glusterGetDeviceInfo,
+ ('',
+ 'list all disk info'
+ )),
}
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 36a65e3..bd0e060 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -71,6 +71,7 @@
BuildRequires: python-devel
BuildRequires: python-netaddr
BuildRequires: python-nose
+BuildRequires: python-blivet
BuildRequires: rpm-build
# BuildRequires needed by the tests during the build
@@ -85,7 +86,7 @@
BuildRequires: psmisc
BuildRequires: python-cpopen >= 1.3
BuildRequires: python-inotify
-BuildRequires: python-ioprocess >= 0.14
+#BuildRequires: python-ioprocess >= 0.14
BuildRequires: python-pthreading
BuildRequires: qemu-img
BuildRequires: rpm-python
diff --git a/vdsm/gluster/__init__.py b/vdsm/gluster/__init__.py
index b83efbb..f2d3256 100644
--- a/vdsm/gluster/__init__.py
+++ b/vdsm/gluster/__init__.py
@@ -22,7 +22,7 @@
import tempfile
from functools import wraps
-MODULE_LIST = ('cli', 'hooks', 'services', 'tasks',
'gfapi')
+MODULE_LIST = ('cli', 'hooks', 'services', 'tasks',
'gfapi', 'storageconf')
def makePublic(func):
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index b9a08e5..cdc228d 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -322,6 +322,11 @@
data = self.svdsmProxy.glusterVolumeStatvfs(volumeName)
return self._computeVolumeStats(data)
+ @exportAsVerb
+ def getDeviceInfo(self, options=None):
+ status = self.svdsmProxy.glusterGetDeviceInfo()
+ return {'deviceInfo': status}
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/storageconf.py b/vdsm/gluster/storageconf.py
new file mode 100644
index 0000000..97a70fd
--- /dev/null
+++ b/vdsm/gluster/storageconf.py
@@ -0,0 +1,67 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import blivet
+from . import makePublic
+
+_bb = None
+
+
+def getBlivet():
+ global _bb
+ if _bb:
+ return _bb
+
+ _bb = blivet.Blivet()
+ _bb.reset()
+ return _bb
+
+
+def _getContentType(mountPoint):
+ if mountPoint in ["/", "/boot", "/usr",
"/var"]:
+ return 'OS'
+ if mountPoint:
+ return 'DATA'
+ return 'NA'
+
+
+@makePublic
+def getDeviceInfo():
+ b = getBlivet()
+ deviceInfo = []
+ for device in b.devices:
+ info = {}
+ info['name'] = device.name
+ if device.parents:
+ info['container'] = device.parents[0].path
+ info['parent'] = device.parents[0].name
+ if hasattr(device.format, 'mountpoint'):
+ info['contentType'] = _getContentType(device.format.mountpoint)
+ info['mount'] = device.format.mountpoint
+ info['fileSystem'] = device.format.type
+ info['model'] = device.model
+ info['type'] = device.type
+ if device.uuid:
+ info['uuid'] = device.uuid
+ info['formattable'] = device.format.formattable
+ info['resizable'] = device.format.resizable
+ info['size'] = device.size
+ deviceInfo.append(info)
+ return deviceInfo
--
To view, visit
http://gerrit.ovirt.org/35028
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I85f520c6f476731cb5982d8256cb701387be87cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>