def snapshot_create(self, memory=None, quiesce=None, name=None): """Create a snapshot of the vm. :param bool memory: True, if the snapshot should include the virtual machine's memory. :param bool quiesce: True, if the file system of the virtual machine should be quiesced before the snapshot is created. Requires VMware tools to be installed on the vm. :param str name: name of the snapshot. :return: an object containing EntityType.TASK XML data which represents the asynchronous task that is creating the snapshot. :rtype: lxml.objectify.ObjectifiedElement """ self.get_resource() snapshot_vm_params = E.CreateSnapshotParams() if memory is not None: snapshot_vm_params.set('memory', str(memory).lower()) if quiesce is not None: snapshot_vm_params.set('quiesce', str(quiesce).lower()) if name is not None: snapshot_vm_params.set('name', str(name).lower()) return self.client.post_linked_resource( self.resource, RelationType.SNAPSHOT_CREATE, EntityType.SNAPSHOT_CREATE.value, snapshot_vm_params)
def snapshot_create(self, memory=None, quiesce=None, name=None): """Snapshot the VM. :param memory: (bool): True if the snapshot should include the virtual machine's memory. :param quiesce: (bool): True if the file system of the virtual machine should be quiesced before the snapshot is created. (Requires VMware tools installed) :param name: (bool): Typically used to name or identify the subject of the request. For example, the name of the object being created or modified. :return: A :class:`lxml.objectify.StringElement` object describing the asynchronous task that operates on the VM. """ if self.resource is None: self.resource = self.client.get_resource(self.href) snapshot_vm_params = E.CreateSnapshotParams() if memory is not None: snapshot_vm_params.set('memory', str(memory).lower()) if quiesce is not None: snapshot_vm_params.set('quiesce', str(quiesce).lower()) if name is not None: snapshot_vm_params.set('name', str(name).lower()) return self.client.post_linked_resource( self.resource, RelationType.SNAPSHOT_CREATE, EntityType.SNAPSHOT_CREATE.value, snapshot_vm_params)