4.9. 가상 머신 생성
다음 예제에서는 가상화 환경의 Blank
템플릿을 기본으로 사용하여 Default
클러스터에 myvm
이라는 가상 시스템을 생성합니다. 요청은 가상 시스템의 메모리도 512MiB로 정의하고 부팅 장치를 가상 하드 디스크로 설정합니다.
요청에는 생성할 가상 머신을 설명하는 Vm 유형의 오브젝트가 포함되어야 합니다.
POST /ovirt-engine/api/vms HTTP/1.1 Accept: application/xml Content-type: application/xml
요청 본문은 다음과 같아야 합니다.
<vm> <name>myvm</name> <description>My VM</description> <cluster> <name>Default</name> </cluster> <template> <name>Blank</name> </template> <memory>536870912</memory> <os> <boot> <devices> <device>hd</device> </devices> </boot> </os> </vm>
curl
명령을 사용하는 것과 동일한 요청:
# curl \ --cacert '/etc/pki/ovirt-engine/ca.pem' \ --user 'admin@internal:mypassword' \ --request POST \ --header 'Version: 4' \ --header 'Content-Type: application/xml' \ --header 'Accept: application/xml' \ --data ' <vm> <name>myvm</name> <description>My VM</description> <cluster> <name>Default</name> </cluster> <template> <name>Blank</name> </template> <memory>536870912</memory> <os> <boot> <devices> <device>hd</device> </devices> </boot> </os> </vm> ' \ https://myengine.example.com/ovirt-engine/api/vms
응답 본문은 Vm 유형의 객체가 될 것입니다:
<vm href="/ovirt-engine/api/vms/007" id="007"> <name>myvm</name> <link href="/ovirt-engine/api/vms/007/diskattachments" rel="diskattachments"/> <link href="/ovirt-engine/api/vms/007/nics" rel="nics"/> ... <cpu> <architecture>x86_64</architecture> <topology> <cores>1</cores> <sockets>1</sockets> <threads>1</threads> </topology> </cpu> <memory>1073741824</memory> <os> <boot> <devices> <device>hd</device> </devices> </boot> <type>other</type> </os> <type>desktop</type> <cluster href="/ovirt-engine/api/clusters/002" id="002"/> <status>down</status> <original_template href="/ovirt-engine/api/templates/000" id="00"/> <template href="/ovirt-engine/api/templates/000" id="000"/> </vm>