Change in vdsm[master]: virt: adding virt basic api module to supervdsm

fromani at redhat.com fromani at redhat.com
Wed Feb 24 16:10:28 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: virt: adding virt basic api module to supervdsm
......................................................................

virt: adding virt basic api module to supervdsm

Change-Id: I9acf5a2f8fd14ac172bb6ea70b8888bc2aff8caf
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/supervdsmServer
A vdsm/supervdsm_api/virt.py
2 files changed, 48 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/54004/1

diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index a829b98..d4760c2 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -177,12 +177,6 @@
         return _getPathsStatus()
 
     @logDecorator
-    def getVmPid(self, vmName):
-        pidFile = "/var/run/libvirt/qemu/%s.pid" % vmName
-        with open(pidFile) as pid:
-            return pid.read()
-
-    @logDecorator
     def getVcpuNumaMemoryMapping(self, vmName):
         vmPid = self.getVmPid(vmName)
         vCpuPids = numaUtils.getVcpuPid(vmName)
@@ -197,20 +191,6 @@
             except IOError:
                 continue
         return vCpuIdxToNode
-
-    @logDecorator
-    def prepareVmChannel(self, socketFile, group=None):
-        if (socketFile.startswith(P_LIBVIRT_VMCHANNELS) or
-           socketFile.startswith(P_OVIRT_VMCONSOLES)):
-            fsinfo = os.stat(socketFile)
-            mode = fsinfo.st_mode | stat.S_IWGRP
-            os.chmod(socketFile, mode)
-            if group is not None:
-                os.chown(socketFile,
-                         fsinfo.st_uid,
-                         resolveGid(group))
-        else:
-            raise Exception("Incorporate socketFile")
 
     def _runAs(self, user, groups, func, args=(), kwargs={}):
         def child(pipe):
diff --git a/vdsm/supervdsm_api/virt.py b/vdsm/supervdsm_api/virt.py
new file mode 100644
index 0000000..325b8ce
--- /dev/null
+++ b/vdsm/supervdsm_api/virt.py
@@ -0,0 +1,48 @@
+# Copyright 2016 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
+#
+from __future__ import absolute_import
+
+import os
+import stat
+
+from storage.fileUtils import resolveGid
+from vdsm.constants import P_LIBVIRT_VMCHANNELS, P_OVIRT_VMCONSOLES
+
+from . import expose
+
+ at expose
+def prepareVmChannel(socketFile, group=None):
+    if (socketFile.startswith(P_LIBVIRT_VMCHANNELS) or
+       socketFile.startswith(P_OVIRT_VMCONSOLES)):
+        fsinfo = os.stat(socketFile)
+        mode = fsinfo.st_mode | stat.S_IWGRP
+        os.chmod(socketFile, mode)
+        if group is not None:
+            os.chown(socketFile,
+                     fsinfo.st_uid,
+                     resolveGid(group))
+    else:
+        raise Exception("Incorporate socketFile")
+
+
+ at expose
+def getVmPid(vmName):
+    pidFile = "/var/run/libvirt/qemu/%s.pid" % vmName
+    with open(pidFile) as pid:
+        return pid.read()


-- 
To view, visit https://gerrit.ovirt.org/54004
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9acf5a2f8fd14ac172bb6ea70b8888bc2aff8caf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list