{"id":21396436,"url":"https://github.com/baslr/qemulib","last_synced_at":"2025-03-16T14:42:28.857Z","repository":{"id":7474836,"uuid":"8822920","full_name":"baslr/qemulib","owner":"baslr","description":"Library to control qemu using groovy or nodejs","archived":false,"fork":false,"pushed_at":"2013-03-16T17:55:47.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T02:11:31.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baslr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-16T17:50:01.000Z","updated_at":"2015-07-07T10:20:49.000Z","dependencies_parsed_at":"2022-08-30T16:43:22.877Z","dependency_job_id":null,"html_url":"https://github.com/baslr/qemulib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fqemulib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fqemulib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fqemulib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baslr%2Fqemulib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baslr","download_url":"https://codeload.github.com/baslr/qemulib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243885887,"owners_count":20363644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T14:27:07.748Z","updated_at":"2025-03-16T14:42:28.838Z","avatar_url":"https://github.com/baslr.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"Library to control qemu for groovy and nodejs\n===\n\n### Overview\n\nThe main goal was to have a consistent, simple api to launch virtual machines and control qemu. Here is the result:\n\n```groovy\n  def qemu  = new Qemu()\n  def vm    = qemu.vm()\n\n  vm.hda(\"data/disk.img\").kernel(\"data/vmlinuz\").initrd(\"data/initrd\")\n\n  vm.start()\n\n  vm.quit()\n```\nand using node.js\n```javascript\n  var qemu  = require('qemu')\n\n  var vm    = qemu.vm()\n  vm.hda(\"data/disk.img\")\n  vm.kernel(\"data/vmlinuz\").initrd(\"data/initrd\")\n\n  vm.start(function()\n  {\n    // post start stuff\n\n    vm.quit()\n  })\n\n\n```\n\n\n\nMost functions return the created machine object so they can be chained as shown above. The language bindings are independent of one another - you dont need the groovy source when using nodejs and vice versa.\n\nUse the mocha.sh script to run the node tests - you will need coffee-script and mocha installed. Mocha should be in your PATH. To run the tests in groovy:\n\n```shell \ngroovy -cp src/groovy/:tests/groovy test.groovy\n```\n\n### Details\n\nQemu has two ways to communicate and pass events - tcp or a unix domain socket. They are passed on startup and cannot be changed once the vm is running. TCP is the default and the library will try and handle that smoothly. Each qemu instance has a `qProps` map that allows tweaking:\n\n```groovy\n  qProps = [\n    qemu: \"qemu-system-x86_64\",   // override the qemu executable here \n                                  // (default is \"qemu\")\n    tcp: true,      // use tcp internally (recommended)\n                    // alternative is to use domain sockets.\n    port: 2000                    // starting port\n  ]\n```\n\nThe `port` variable will be incremented until an open port is found. Setting TCP to false is to switch to creating fifos instead of tcp (not implemented). To use domain sockets in java the excellent JUDS library will be required. \n\n### Todo\n\nProbably the order in which they will be completed:\n\n- Python port\n- Unix domain socket support\n- Event handling - listening of other vm events\n- Full implementation of qemu's startup commands. \n  Use the qAppend(\"-serial fff etc\") function in each library to add the more obscure switches as you may need them. \n- Wrapper for other tools such as qemu-img\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaslr%2Fqemulib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaslr%2Fqemulib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaslr%2Fqemulib/lists"}