{ "info": { "author": "Fran\u00e7ois M\u00e9nab\u00e9", "author_email": "francois.menabe@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: System :: Systems Administration" ], "description": "python-kvm\n==========\n\nThis module aims to manage KVM hypervisors. For this it use the\n`unix module `_ which allow to manage\nUnix-like systems, both locally and remotely, in the same by overloading class\ninstances. This module is just a wrapper to the ``virsh`` command. It parse\noutputs of the ``virsh`` command (both XML and text). Commands are grouped in\nchilds objects accessible via properties.\n\nInstallation\n------------\nThis module is compatible with python2.7 and python 3.*. The module is\non **PyPi** so you can use the ``pip`` command for installing it.\n\nFor example, to use ``kvm`` in a virtualenv:\n\n.. code:: bash\n\n $ virtualenv env/ --prompt \"(myprog)\"\n $ . ./env/bin/activate\n (myprog) $ pip install kvm\n\nOtherwise sources are on github: https://github.com/fmenabe/python-kvm\n\nUsage\n-----\nYou need to import the necessary classes from ``unix`` module. An hypervisor is\nrepresented by the **Hypervisor** object and must wrap an object of type\n``unix.Local`` or ``unix.Remote``. It theorically support any Unix system, but\ndisks manipulations need *nbd* module to be loaded so it is better to use an\n``unix.linux.Linux`` host.\n\n.. code-block:: python\n\n >>> from unix import Local, Remote, UnixError\n >>> from unix.linux import Linux\n >>> import kvm\n >>> import json\n >>> localhost = kvm.Hypervisor(Linux(Local()))\n >>> localhost.hypervisor.nodeinfo()\n {'nb_cpu': 1,\n 'nb_threads_per_core': 2,\n 'memory': 16331936,\n 'numa_cells': 1,\n 'cpu_model': 'x86_64',\n 'nb_cores_per_cpu': 4,\n 'nb_cores': 8,\n 'cpu_freq': 1340}\n >>> localhost.list_domains(all=True)\n {'guest1': {'id': -1, 'state': 'shut off'}}\n {'guest2': {'id': 1, 'state': 'running'}}\n >>> localhost.domain.start('guest1')\n # Wait a few seconds for the domain to start.\n >>> localhost.domain.state('guest1')\n 'running'\n >>> localhost.domain.id('guest1')\n 2\n >>> print(json.dumps(localhost.domain.conf('guest1'), indent=2))\n # json is use for pretty printing the dictionnary containing the\n # configuration.\n {\n \"@type\": \"kvm\",\n \"name\": \"guest1\",\n \"uuid\": \"ed68d942-5d4b-7bba-4d74-7d44d73779d3\",\n \"memory\": {\n \"@unit\": \"KiB\",\n \"#text\": \"2097152\"\n },\n ...\n }\n >>> localhost.list_networks()\n {'default': {'autostart': True, 'persistent': True, 'state': 'active'}}\n\n >>> host = Remote()\n >>> host.connect('hypervisor1')\n >>> host = kvm.Hypervisor(Linux(host))\n >>> host.hypervisor.nodeinfo()\n {'cores_per_socket': 12,\n 'cpu_frequency': '2200 MHz',\n 'cpu_model': 'x86_64',\n 'cpu_sockets': 2,\n 'cpus': 24,\n 'memory_size': '98974432 kB',\n 'numa_cells': 1,\n 'threads_per_core': 1}\n >>> host.list_domains(all=True)\n {'guest1': {'id': 1, 'state': 'running'}}\n {'guest2': {'id': 2, 'state': 'running'}}\n >>> host.domain.shutdown('guest2')\n # Wait for the domain to stop.\n >>> host.domain.state('guest1')\n 'shut off'\n\n # Using the context manager for the connecion.\n >>> from unix.linux as linux, kvm\n >>> with linux.connect('hypervisor1') as host:\n ... host = kvm.Hypervisor(host)\n ... host.hypervisor.node_info()", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "python,kvm,unix,virsh", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "kvm", "package_url": "https://pypi.org/project/kvm/", "platform": "", "project_url": "https://pypi.org/project/kvm/", "project_urls": null, "release_url": "https://pypi.org/project/kvm/1.1.1/", "requires_dist": null, "requires_python": "", "summary": "An API for managing KVM host.", "version": "1.1.1" }, "last_serial": 4156908, "releases": { "1.0.4": [ { "comment_text": "", "digests": { "md5": "75326ba020f5a346af3faf0b3cc12808", "sha256": "64f96a4e1dde4f77f6e03af576a8f957b10f01fdb66ff159f7392275e22b13d3" }, "downloads": -1, "filename": "kvm-1.0.4.tar.gz", "has_sig": false, "md5_digest": "75326ba020f5a346af3faf0b3cc12808", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8351, "upload_time": "2015-07-02T13:20:12", "url": "https://files.pythonhosted.org/packages/dc/91/95eaa438be7ad2717fedbeefb55cad8316e1c396b8eb956f8cd12443f962/kvm-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "c664cea48d3d6067716c7f96cd4ac2c8", "sha256": "5c4b03bba583e49bd1a97586059475cafe36f7a00c8a84d7e3da8e72db8d301d" }, "downloads": -1, "filename": "kvm-1.0.5.tar.gz", "has_sig": false, "md5_digest": "c664cea48d3d6067716c7f96cd4ac2c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8450, "upload_time": "2015-12-03T13:21:54", "url": "https://files.pythonhosted.org/packages/f9/12/98d450653e1c7292c9d99c4deb8ac8b59b2792a8e601c1f93727796b2ea2/kvm-1.0.5.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "211b12fbe5770181ae12308a9a962f93", "sha256": "c4aec2dff7ceca60dc76b574fe7327d9761f6a631626f5174bcc7c3a6d49be9f" }, "downloads": -1, "filename": "kvm-1.1.0.tar.gz", "has_sig": false, "md5_digest": "211b12fbe5770181ae12308a9a962f93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9615, "upload_time": "2018-01-07T17:51:08", "url": "https://files.pythonhosted.org/packages/fe/d7/b5d15250429867ac0cff2ab715596054ca16362a6aa3fbfd4bcecc0acc26/kvm-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "79da7580578abb517b2c10e2a45496cb", "sha256": "e2016ee28fcc0b6386de0cc89094e543e0e1ac92c342c1c21dda7397a993c271" }, "downloads": -1, "filename": "kvm-1.1.1.tar.gz", "has_sig": false, "md5_digest": "79da7580578abb517b2c10e2a45496cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11121, "upload_time": "2018-08-10T13:10:03", "url": "https://files.pythonhosted.org/packages/3f/04/58b6d24e510b4460d3e3254e5b198b944dfb3120ff6966c5e6132198ab3b/kvm-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "79da7580578abb517b2c10e2a45496cb", "sha256": "e2016ee28fcc0b6386de0cc89094e543e0e1ac92c342c1c21dda7397a993c271" }, "downloads": -1, "filename": "kvm-1.1.1.tar.gz", "has_sig": false, "md5_digest": "79da7580578abb517b2c10e2a45496cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11121, "upload_time": "2018-08-10T13:10:03", "url": "https://files.pythonhosted.org/packages/3f/04/58b6d24e510b4460d3e3254e5b198b944dfb3120ff6966c5e6132198ab3b/kvm-1.1.1.tar.gz" } ] }