Skip to content

Commit

Permalink
Virtualization completed
Browse files Browse the repository at this point in the history
  • Loading branch information
subhayuroy committed Sep 16, 2020
1 parent 1c4d80d commit d3b6a72
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Virtualization/virtual.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from ovirtsdk.api import API
from ovirtsdk.xml import params

try:
api = API(url="https://HOST",
username="Subhayu",
password="a@123",
ca_file="ca.crt")

vm_name = "dummy1"
vm_memory = 512 * 1024 * 1024
vm_cluster = api.clusters.get(name="Default")
vm_template = api.templates.get(name="Blank")

# assigning the parameters to operating system
vm_os = params.OperatingSystem(boot=[params.Boot(dev="hd")])

vm_params = params.VM(name=vm_name,
memory=vm_memory,
cluster=vm_cluster,
template=vm_template,
os = vm_os)

try:
api.vms.add(vm=vm_params)
print("Virtual machine '%s' added." % vm_name)
except Exception as ex:
print("Adding virtual machine '%s' failed: %s" % (vm_name, ex))
api.disconnect()

except Exception as ex:
print("Unexpected error: %s" % ex)
Binary file added Virtualization/virtualization_types.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d3b6a72

Please sign in to comment.