{ "info": { "author": "Aljoscha Vollmerhaus", "author_email": "pydev@aljoscha.vollmerhaus.net", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "virsh-start-stop\n===\n\nI wanted to start and stop individual libvirt virtual machines with a systemd unit.\n\nCalling `virsh start %i` or `virsh stop %i` from the unit doesn't cut it.\nThis is because it doesn't block while shutting down so you don't know if the machine is really down unless you wrap \nit all in a bash script and employ a dirty hack along the lines of `virsh list | grep myVM`.\n\nStarting a machine is also challenging because `virsh start` uses exit status 1 for multiple error conditions,\nincluding \"machine is already running\".\n\nThe purpose of this script is to start / stop a given virtual machine through the libvirt python bindings in a way that\nis easily consumable from systemd. \nThis means I try to handle the \"already running\" case gracefully.\nShutting down happens in a blocking fashion, with the option to yank the virtual power cord from the machine in case\nit ignores our polite requests.\n\nI also took the opportunity to issue shutdown requests every second until the machine is down.\nThis should be unnecessary when the virtual machine has the libvirt guest agent running, but it can sometimes help\nto convince windows to really shut down instead of asking \"really shutdown?\" on the virtual console with nobody around\nto click ok. \n\nExample systemd unit file:\n```\n[Unit]\nDescription=virsh start / stop %i\nRequires=libvirtd.service\nAfter=libvirtd.service\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/opt/vollmerhaus.net/venv/bin/virsh-start-stop --machine %i --state started\nExecStop=/opt/vollmerhaus.net/venv/bin/virsh-start-stop --machine %i --state stopped --timeout 80\n\n[Install]\nWantedBy=default.target\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/avollmerhaus/virsh_start_stop", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "virsh-start-stop", "package_url": "https://pypi.org/project/virsh-start-stop/", "platform": "", "project_url": "https://pypi.org/project/virsh-start-stop/", "project_urls": { "Homepage": "https://github.com/avollmerhaus/virsh_start_stop" }, "release_url": "https://pypi.org/project/virsh-start-stop/0.0.1/", "requires_dist": [ "libvirt-python" ], "requires_python": "", "summary": "Utilize the python libvirt API to start and stop qemu-kvm machines in a blocking fashion", "version": "0.0.1" }, "last_serial": 4873977, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e0abf29255b3b67b28a746fe9976c70e", "sha256": "ece2c1df1dcbf557abe6e2252fd0984a148dbf591d5361678cc5b0d2374fe347" }, "downloads": -1, "filename": "virsh_start_stop-0.0.1-py3.6.egg", "has_sig": false, "md5_digest": "e0abf29255b3b67b28a746fe9976c70e", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 5367, "upload_time": "2019-02-27T12:27:49", "url": "https://files.pythonhosted.org/packages/d0/21/f8877a702d04c3a6c56c1c951a26805bd296d355a4e80e61f3dc65d93510/virsh_start_stop-0.0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "222b82fa222372933238c0b13c762fed", "sha256": "951385cc5ebddb71377a9a58a7ff103b4c437e88dd250e68697447a076ab37cd" }, "downloads": -1, "filename": "virsh_start_stop-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "222b82fa222372933238c0b13c762fed", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4890, "upload_time": "2019-02-27T12:27:47", "url": "https://files.pythonhosted.org/packages/af/87/f40e006a35186df9262f90316cfa568490f016b5620f063f15a09aea7590/virsh_start_stop-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a3f545a7cdf2ff6d2440624a4490d26", "sha256": "8c7fc04cf60d73f293533aeebed09654869c36b5f878718595485a251670ca4d" }, "downloads": -1, "filename": "virsh_start_stop-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4a3f545a7cdf2ff6d2440624a4490d26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5639, "upload_time": "2019-02-27T12:27:50", "url": "https://files.pythonhosted.org/packages/51/e1/356a93442a094fe92b058b3da866be10921a46538060ebf631456ac78f51/virsh_start_stop-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e0abf29255b3b67b28a746fe9976c70e", "sha256": "ece2c1df1dcbf557abe6e2252fd0984a148dbf591d5361678cc5b0d2374fe347" }, "downloads": -1, "filename": "virsh_start_stop-0.0.1-py3.6.egg", "has_sig": false, "md5_digest": "e0abf29255b3b67b28a746fe9976c70e", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 5367, "upload_time": "2019-02-27T12:27:49", "url": "https://files.pythonhosted.org/packages/d0/21/f8877a702d04c3a6c56c1c951a26805bd296d355a4e80e61f3dc65d93510/virsh_start_stop-0.0.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "222b82fa222372933238c0b13c762fed", "sha256": "951385cc5ebddb71377a9a58a7ff103b4c437e88dd250e68697447a076ab37cd" }, "downloads": -1, "filename": "virsh_start_stop-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "222b82fa222372933238c0b13c762fed", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4890, "upload_time": "2019-02-27T12:27:47", "url": "https://files.pythonhosted.org/packages/af/87/f40e006a35186df9262f90316cfa568490f016b5620f063f15a09aea7590/virsh_start_stop-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a3f545a7cdf2ff6d2440624a4490d26", "sha256": "8c7fc04cf60d73f293533aeebed09654869c36b5f878718595485a251670ca4d" }, "downloads": -1, "filename": "virsh_start_stop-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4a3f545a7cdf2ff6d2440624a4490d26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5639, "upload_time": "2019-02-27T12:27:50", "url": "https://files.pythonhosted.org/packages/51/e1/356a93442a094fe92b058b3da866be10921a46538060ebf631456ac78f51/virsh_start_stop-0.0.1.tar.gz" } ] }