검색

3.13. 가상 머신 생성

download PDF

가상 머신 생성은 여러 단계로 수행됩니다. 여기에서 다루는 첫 번째 단계는 가상 머신 오브젝트 자체를 생성하는 것입니다.

예 3.11. 가상 머신 생성

이 예제에서는 다음 요구 사항이 있는 가상 머신 vm1 을 생성합니다.

  • 바이트로 표시된 512MB의 메모리입니다.
  • Default 클러스터에 연결되므로 Default 데이터 센터에 연결합니다.
  • 기본 Blank 템플릿 기반.
  • 가상 하드 디스크 드라이브에서 부팅됩니다.

V4

V4에서는 add 메서드를 사용하여 옵션이 유형 로서 추가됩니다.

import ovirtsdk4 as sdk
import ovirtsdk4.types as types

connection = sdk.Connection(
    url='https://engine.example.com/ovirt-engine/api',
    username='admin@internal',
    password='password',
    ca_file='ca.pem',
)

# Get the reference to the "vms" service:
vms_service = connection.system_service().vms_service()

# Use the "add" method to create a new virtual machine:
vms_service.add(
    types.Vm(
        name='vm1',
        memory = 512*1024*1024
        cluster=types.Cluster(
            name='Default',
        ),
        template=types.Template(
            name='Blank',
        ),
        os=types.OperatingSystem(boot=types.Boot(devices=[types.BootDevice.HD)]
    ),
)

print("Virtual machine '%s' added." % vm.name)

# Close the connection to the server:
connection.close()

추가 요청이 성공하면 예제에 텍스트가 출력됩니다.

Virtual machine 'vm1' added.
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.