Openstack_ Universal Module _oslo_vmware creating a vCenter virtual machine snapshot

Source: Internet
Author: User
Tags documentation quiesce

Create a virtual machine snapshot

VSphere Create Snapshot Documentation

Snapshot is a copy of the virtual machine disk file (VMDK) at some point in time. Contains the state of the data on all virtual disks of the virtual machine and the power state of the virtual machine (on/off/suspended). You can create a Snapshot when the virtual machine is powered up, powered off, suspended.

When you create a Snapshot, the system creates a Delta disk file on the Datastore and writes all changes to the delta disk file.

VSphere's MO object Virtualmachine provides a way to create a snapshot, revert to any snapshot point on the Snapshot_tree, and remove the snapshot.

The virtualmachine.createsnapshot_task method can create a new snapshot of a virtual machine, and with it, the current snapshot becomes the parent snapshot of the new snapshot. This method allows you to set the snapshot name and also to set the memory and Quiesce properties.

      • Memory: If True, the virtual machine RAM status dump is included in the snapshot. A memory snapshot consumes time and resources and takes a long time to create. If False, the snapshot power state is set to off without processing a memory snapshot.

      • Quiesce: If True and the virtual machine is turned on when the snapshot is created, VMware Tools is typically used to silence the file system in the virtual machine, ensuring that the disk snapshot and the Guestos file system state are consistent. If
        If the power state of the virtual machine is off or VMware Tools is unavailable, the QUIESCE is ignored.

1  fromOslo_vmwareImportAPI2  fromOslo_vmwareImportVim_util3 4 #Create the VMware session5Session =API. Vmwareapisession (6             '<vCenter_server_ip>',7             '<vCenter_server_username>',8             '<vCenter_server_password>',91,  Ten0.1) One  A #Get The Instances list with VMware SDK -instances =Session.invoke_api ( - Vim_util, the                             'get_objects',               - Session.vim, -                             'Virtualmachine',                 -100)  +  - #Select A instance if want to create snapshot +Instance = instances.objects[2].obj A  at #Start to create the snapshot - Session.invoke_api (Session.vim, -                    "Createsnapshot_task", - instance, -Name="Jmilkfan", -description='Just Create', inmemory=False, -Quiesce=false)

Note: session.invoke_api() The first parameter of the method is the module that provides the function call, the second argument is the function to invoke from, and the remaining arguments are passed in as arguments into the second parameter (function). How are these incoming arguments determined? We can view VSphere SDK documentation to determine.

EXAMPLE:

You can see CreateSnapshot_Task() that the function needs to pass in 5 parameters such as _this/name/description/memory/quiesce . The meanings are:

    • _this: Virtual machines that need to create snapshots
    • Name: Specify the names of the snapshots
    • Description: Specifies the description of the snapshot
    • Memory/quiesce: Already mentioned in the above
At last
      • Recovering a Snapshot

        • Virtualmachine.reverttosnapshot_task
          The method of recovering a snapshot requires specifying a target host and specifying whether the virtual machine is powered on, and when restoring a VM where the power state of a snapshot is true, you must specify a target host or specify Supresspoweron as true.
      • Delete a snapshot

        • Virtualmachine.removeallsnapshots
          Deletes all snapshots of a virtual machine.
        • Virtualmachinesnapshot.removesnapshot_task
          Deletes a specified snapshot of a virtual machine, where Virtualmachinesnapshot is the object returned by the Create snapshot function Createsnapshot_task.

Turn from:

http://blog.csdn.net/jmilk/article/details/53174277

Openstack_ Universal Module _oslo_vmware creating a vCenter virtual machine snapshot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.