the-basement / libvirt
该软件包实现了libvirt虚拟机管理程序的域服务协议。
v0.1.0
2024-05-13 01:14 UTC
Requires
- php: >=8.2
- the-basement/common: ^0.1.1
Requires (Dev)
- laravel/pint: ^1.15
- phpunit/phpunit: ^11.1
README
本软件包是基于the-basement/common接口的基本QEMU管理接口。
安装
通过Composer
$ composer require the-basement/libvirt
基本用法
在QEMU/KVM中创建虚拟机
// This assumes you have an ubuntu server image available from your KVM host // This also assumes the default image location of the disks created by KVM. // Both of these can be changed; disks that exist will not be overwritten // disks that don't exist will be created. $service = new TheBasement\Libvirt\LibvirtService(); $service->createServer([ 'name' => 'my-virtual-machine', 'memory' => (string) (1024 * 1024), // 1G in KiB 'cores' => 1, 'threads' => 1, 'iso_path' => '/var/lib/libvirt/iso/ubuntu-22.04.4-live-server-amd64.iso', 'storage_pool' => 'default', 'network_mac' => '', 'video_ram' => '65536', // bytes of video ram 'disk_path' => '/var/lib/libvirt/images/ubuntu22.04-2.qcow2', 'disk_name' => 'ubuntu22.04-2.qcow2', 'disk_capacity' => 10 * 1024 * 1024 * 1024, // 10 GB in bytes ]); // Gets all servers defined for the KVM $servers = $service->findAllServers();
变更日志
有关最近变更的详细信息,请参阅变更日志。
测试
$ composer test
贡献
安全性
如果您发现任何安全相关的问题,请通过电子邮件security@austinkregel.com联系我们,而不是使用问题跟踪器。
鸣谢
许可
MIT许可(MIT)。有关更多信息,请参阅许可文件。