一旦你的用户获得了所需的组权限,创建一个实例:
$ testcloud instance create
或者,你可以使用 fedora:latest/fedora:XX(XX是你的 Fedora 发行版本)来代替 完整的 URL 地址:
$ testcloud instance create
这将返回你的虚拟机的 IP 地址:
$ testcloud instance create testcloud272593 -u https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 [...]INFO:Successfully booted instance testcloud272593The IP of vm testcloud272593: 192.168.122.202------------------------------------------------------------To connect to the VM, use the following command (password is 'passw0rd'):ssh fedora@192.168.122.202
你可以用默认用户 fedora登录,密码是passw0rd(注意是零)。你可以使用ssh、virt-manager或者支持连接到 libvirt 虚拟机方式来连接到它。
另一种创建 Fedora 云的方式是:
$ testcloud instance create testcloud193 -u fedora:33 WARNING:Not proceeding with backingstore cleanup because there are some testcloud instances running.You can fix this by following command(s):testcloud instance stop testcloud272593DEBUGocal downloads will be stored in /var/lib/testcloud/backingstores. DEBUG:successfully changed SELinux context for image /var/lib/testcloud/backingstores/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 DEBUG:Creating instance directories DEBUG:creating seed image /var/lib/testcloud/instances/testcloud193/testcloud193-seed.img INFO:Seed image generated successfully INFO:Successfully booted instance testcloud193 The IP of vm testcloud193: 192.168.122.225 ------------------------------------------------------------ To connect to the VM, use the following command (password is 'passw0rd'): ssh fedora@192.168.122.225 ------------------------------------------------------------
玩转实例
Testcloud 可以用来管理实例。这包括像列出镜像或者停止和启动一个实例等活动。
要列出实例,使用 list子命令:
$ testcloud instance list Name IP State ------------------------------------------------------------testcloud272593 192.168.122.202 running testcloud193 192.168.122.225 running testcloud252793 192.168.122.146 shutoff testcloud93 192.168.122.152 shutoff
要停止一个运行的实例:
$ testcloud instance stop testcloud193 DEBUG:stop instance: testcloud193DEBUG:stopping instance testcloud193.
要删除一个实例:
$ testcloud instance destroy testcloud193 DEBUG:remove instance: testcloud193DEBUG:removing instance testcloud193 from libvirt.DEBUG:Unregistering instance from libvirt.DEBUG:removing instance /var/lib/testcloud/instances/testcloud193 from disk
要重启一个运行中的实例:
$ testcloud instance reboot testcloud93 DEBUG:stop instance: testcloud93[...]INFO:Successfully booted instance testcloud93The IP of vm testcloud93: 192.168.122.152usage: testcloud [-h] {instance,image} ...
尝试一下 Testcloud ,在评论中让我知道你的想法。