{ "info": { "author": "Mario Steinhoff", "author_email": "steinhoff.mario@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# vmfusion-python\n\nvmfusion-python is a low-level python interface for the VMware Fusion command\nline tools vmrun and vmware-vdiskmanager. It aims to be human readable (because\nI still have no idea why -k is shrink, -n is rename and -r is convert) and\neasy to use.\n\nThe vmrun command comes with a ton of command line options. At the moment, only\nthe common commands are implemented because I have yet to find an actual use\ncase for the rest. If you have need for a non-implemented command, open an issue\nor send me a pull request.\n\n# Installation\n\n $ pip install vmfusion\n\n# Overview\n\n## vmrun\n\nThe `vmrun` tool can be used to control the runtime state of a VM.\n\nNote: Contrary to the behavior of vmrun, the API will work with both absolute\n_and_ relative VMX paths.\n\n### list\n\nReturn information about all running VMs.\n\nUsage: `vmrun.list()`\n\nExample:\n\n >>> from vmfusion import vmrun\n >>> print vmrun.list()\n {\n 'count': 3,\n 'machines': [\n '/Users/msteinhoff/Documents/Virtual Machines/test1/test1.vmx',\n '/Users/msteinhoff/Documents/Virtual Machines/test1/test2.vmx', \n '/Users/Shared/Virtual Machines/test3/test3.vmx',\n ]\n }\n\n*Note:* This will only return actual running VMs and is not the same als the\nVirtual Machine Library from the VMware Fusion GUI, which also displays halted\nand suspended VMs.\n\n### start\n\nPower on a VM.\n\nUsage:\n\n vmrun.start( vmx )\n\n**Note/Warning:** There is an optional `gui` parameter which can be set to False\nto launch the VM in *nogui mode*.\n\nThe nogui mode is weird. In nogui mode, the VM window will not be visible but\ndisplayed in VMware Fusion.app when its already running. If the Fusion GUI is\nnot running and you launch it or close/launch it, the VM gets converted back to\ngui mode. Oh and if you then close VMware Fusion.app the VM gets suspended. (at\nleast thats whats happening on my system).\n\n### stop\n\nShutdown a VM.\n\nUsage:\n\n vmrun.stop( vmx, soft=True )\n\nWhen `soft` is set to True (default), configured shutdown scripts will be\nexecuted and an shutdown signal will be sent to the guest OS. For this to work,\nvmware tools need to be installed. Otherwise, the VM is killed with no mercy.\n\n### reset\n\nReboot a VM.\n\nUsage:\n\n vmrun.reset( vmx, soft=True )\n\nWhen `soft` is set to True (default), configured shutdown/power-on scripts will\nbe executed and an shutdown signal will be sent to the guest OS. For this to\nwork, vmware tools need to be installed. Otherwise, the VM is killed with no\nmercy.\n\n### suspend\n\nSuspend VM state to disk.\n\nUsage:\n\n vmrun.suspend( vmx, soft=True )\n\nWhen `soft` is set to True (default), configured suspend scripts will be\nexecuted before the system is suspended.\n\n### pause\n\nHalt the CPU execution of a VM.\n\nUsage:\n\n vmrun.pause( vmx )\n\n### unpause\n\nContinue CPU execution of a M.\n\nUsage:\n\n vmrun.unpause( vmx )\n\n## vdiskmanager\n\nWith the `vdiskmanager` tool VMDK disks can be managed. For all methods, the `vmdk` parameter always expects a relative path to the vmdk file.\n\n### create\n\nCreates a new VMDK file with the given parameters.\n\nUsage: \n\n vdiskmanager.create( vmdk, size, disk_type=None, adapter_type=None )\n\nArguments:\n\n- `size`\n \n A size specification readable by the tool, e.g. `100MB`, `20GB`, `1TB`. No\n validation is performed.\n\n- `disk_type`\n\n Optional type of the disk to be created, one of the following:\n\n - `SPARSE_SINGLE`: A single growable VMDK file\n - `SPARSE_SPLIT`: Many growable VMDK files, split into 2 GB slices\n - `PREALLOC_SINGLE`: A single preallocated VMDK file\n - `PREALLOC_SPLIT`: Many preallocated 2 GB VMDK files\n\n Default is `SPARSE_SPLIT`.\n\n- `adapter_type`\n\n Optional type of the disk adapter, one of the following:\n\n - `IDE`\n - `LSILOGIC`\n - `BUSLOGIC`\n\n Default is `LSILOGIC`.\n\n### defragment\n\nDefragments VMDK files on the VMware level (not to be confused with guest\nfilesystem defagmentation).\n\nUsage: \n \n vdiskmanager.defragment( vmdk )\n\n### shrink\n\nThis will perform a shrink of the VMDK on the VMware level (The guest\nfilesystem must be prepared for this to work, e.g. with the zerofill tool on\nLinux.).\n\nUsage:\n\n vdiskmanager.shrink( vmdk )\n\n### rename\n\nThis will rename a VMDK file. Useful for large split disks with over 9000 2GB\nslices.\n\nUsage:\n\n vdiskmanager.rename( source_vmdk, destination_vmdk )\n\n### convert\n\nThis will convert the disk type of the given VMDK file.\n\nUsage:\n\n vdiskmanager.convert( vmdk, disk_type )\n\nThe `disk_type` parameter is the same as in create() and must be one of the\nfollowing:\n\n- `SPARSE_SINGLE`: A single growable VMDK file\n- `SPARSE_SPLIT`: Many growable VMDK files, split into 2 GB slices\n- `PREALLOC_SINGLE`: A single preallocated VMDK file\n- `PREALLOC_SPLIT`: Many preallocated 2 GB VMDK files\n\n### expand\n\nThis will expand the VMDK to the given size.\n\nUsage:\n\n vdiskmanager.convert( vmdk, new_size )\n\nThe `new_size` parameter must be a size specification readable by the tool, e.g.\n`100MB`, `20GB`, `1TB`. No validation is performed.\n\n# vmnet_*\n\nIt is often handy to gather certain information about the local VMware networks.\n\nBy default VMware creates a host-only network and a NAT network. Those are\nrepresented by `vmnet_hostonly` and `vmnet_nat`. \n\nTo retrieve the vnet-name (e.g. useful in VMX config files), use the following:\n\n >>> from vmfusion import vmnet_nat\n >>> print vmnet_nat.name\n vmnet8\n\nThere is a DHCP server running on both networks. To access the lease information,\nuse the following:\n\n >>> from vmfusion import vmnet_nat\n >>> print vmnet_nat.leases\n {\n '00:50:56:00:23:40': '192.168.128.130'\n '00:50:56:00:19:12': '192.168.128.129'\n '00:50:56:00:46:93': '192.168.128.136'\n }\n\nThe dhcp server stores lease information in a file on disk. The data in the\nleases dictionary is read-only and not automatically updated. To reload the\nlatest data from the file, use the `reload()` method:\n\n vmnet_nat.leases.reload()\n\n# Custom tool locations\n\nThe `vmrun` and `vdiskmanager` use the default location at `/Applications/VMware Fusion.app`. This can be changed by instantiating a custom _cli object.\n\nvmrun at a custom location:\n\n >>> from vmfusion import vmrun_cli\n >>> vmrun_custom = vmrun_cli( '/Volumes/External/Applications/VMware Fusion.app' )\n\nSame goes with vdiskmanager:\n\n >>> from vmfusion import vdiskmanager_cli\n >>> vdiskmanager_custom = vdiskmanager_cli( '/Volumes/External/Applications/VMware Fusion.app' )\n \nTo create a custom vmnet, use `vnet_cli`:\n\n >>> from vmfusion import vnet_cli\n >>> vmnet_custom = vnet_cli( 'vmnet6' )\n >>> print vmnet_custom.name\n vmnet6\n\n# Contribution\n\nFork, code, pull request :)\n\n\n# License\n\nSee LICENSE.txt", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/msteinhoff/vmfusion-python", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "vmfusion", "package_url": "https://pypi.org/project/vmfusion/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/vmfusion/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/msteinhoff/vmfusion-python" }, "release_url": "https://pypi.org/project/vmfusion/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "A python API for the VMware Fusion CLI tools.", "version": "0.2.0" }, "last_serial": 1238204, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "82a5420f00f08750992f92986c854391", "sha256": "762f5d34c84a56fd58eb13f87257764c9ecfeb99504ff372b49403b0fd370d69" }, "downloads": -1, "filename": "vmfusion-0.1.0.tar.gz", "has_sig": false, "md5_digest": "82a5420f00f08750992f92986c854391", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7237, "upload_time": "2013-11-17T18:44:50", "url": "https://files.pythonhosted.org/packages/3a/05/3464e78ca825f370b86de8af0058a03ae8077ebaeef78842b8b926f9915c/vmfusion-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "27a155c09155bcf189d7a1dcc7b8a62d", "sha256": "98dda5f695a9f411924716aacafd038e0f2b72122eea88bdd11e78dd76a85c57" }, "downloads": -1, "filename": "vmfusion-0.1.1.tar.gz", "has_sig": false, "md5_digest": "27a155c09155bcf189d7a1dcc7b8a62d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7315, "upload_time": "2013-11-17T20:32:02", "url": "https://files.pythonhosted.org/packages/74/c5/9dc5d2431bf3b2fcf32a44a7288167c83ae1271458270658086b97cf0236/vmfusion-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "5ec3e7e032f03842958c14bc8cae61a8", "sha256": "40460e1b0c8c95c5d50c988470c7e733a1421138c60371268e493fac34786c58" }, "downloads": -1, "filename": "vmfusion-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5ec3e7e032f03842958c14bc8cae61a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7253, "upload_time": "2014-09-25T21:45:47", "url": "https://files.pythonhosted.org/packages/a0/9c/9a0ed15329603910d918cd7460d0c43a397e94f7a13bb06700f42bf7da71/vmfusion-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5ec3e7e032f03842958c14bc8cae61a8", "sha256": "40460e1b0c8c95c5d50c988470c7e733a1421138c60371268e493fac34786c58" }, "downloads": -1, "filename": "vmfusion-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5ec3e7e032f03842958c14bc8cae61a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7253, "upload_time": "2014-09-25T21:45:47", "url": "https://files.pythonhosted.org/packages/a0/9c/9a0ed15329603910d918cd7460d0c43a397e94f7a13bb06700f42bf7da71/vmfusion-0.2.0.tar.gz" } ] }