[Kimchi-devel] [PATCH 2/3] Remove kvmusertests.py

Daniel H Barboza danielhb at linux.vnet.ibm.com
Mon Feb 3 17:19:18 UTC 2014


Reviewed-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>

On 02/03/2014 01:01 PM, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
>
> As libvirt changes the user:group of disk files we don't need to probe
> the username of qemu process
> We just need to add read permission for those files as they already will
> be owned by libvirt.
>
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
>   src/kimchi/kvmusertests.py |   66 --------------------------------------------
>   1 file changed, 66 deletions(-)
>   delete mode 100644 src/kimchi/kvmusertests.py
>
> diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
> deleted file mode 100644
> index 3d69eb4..0000000
> --- a/src/kimchi/kvmusertests.py
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -#
> -# Project Kimchi
> -#
> -# Copyright IBM, Corp. 2013
> -#
> -# Authors:
> -#  ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> -#
> -# This library is free software; you can redistribute it and/or
> -# modify it under the terms of the GNU Lesser General Public
> -# License as published by the Free Software Foundation; either
> -# version 2.1 of the License, or (at your option) any later version.
> -#
> -# This library 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
> -# Lesser General Public License for more details.
> -#
> -# 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
> -
> -import libvirt
> -import psutil
> -import uuid
> -
> -
> -from kimchi.rollbackcontext import RollbackContext
> -
> -
> -class UserTests(object):
> -    SIMPLE_VM_XML = """
> -    <domain type='kvm'>
> -      <name>%s</name>
> -      <uuid>%s</uuid>
> -      <memory unit='KiB'>10240</memory>
> -      <os>
> -        <type arch='x86_64' machine='pc'>hvm</type>
> -        <boot dev='hd'/>
> -      </os>
> -    </domain>"""
> -
> -    def __init__(self):
> -        self.vm_uuid = uuid.uuid3(uuid.NAMESPACE_DNS, 'vm-test.kimchi.org')
> -        self.vm_name = "kimchi_test_%s" % self.vm_uuid
> -
> -    def probe_user(self):
> -        xml = self.SIMPLE_VM_XML % (self.vm_name, self.vm_uuid)
> -        user = None
> -        with RollbackContext() as rollback:
> -            conn = libvirt.open('qemu:///system')
> -            rollback.prependDefer(conn.close)
> -            dom = conn.defineXML(xml)
> -            rollback.prependDefer(dom.undefine)
> -            dom.create()
> -            rollback.prependDefer(dom.destroy)
> -            with open('/var/run/libvirt/qemu/%s.pid' % self.vm_name) as f:
> -                pidStr = f.read()
> -            p = psutil.Process(int(pidStr))
> -            user = p.username
> -        return user
> -
> -
> -if __name__ == '__main__':
> -    ut = UserTests()
> -    print ut.probe_user()




More information about the Kimchi-devel mailing list