Exemplo n.º 1
0
Arquivo: vm.go Projeto: vmware/vic
// RemoveSnapshot delete one snapshot
func (vm *VirtualMachine) RemoveSnapshot(ctx context.Context, id types.ManagedObjectReference, removeChildren bool, consolidate bool) (*object.Task, error) {
	req := types.RemoveSnapshot_Task{
		This:           id,
		RemoveChildren: removeChildren,
		Consolidate:    &consolidate,
	}
	res, err := methods.RemoveSnapshot_Task(ctx, vm.Client.RoundTripper, &req)
	if err != nil {
		return nil, err
	}

	return object.NewTask(vm.Vim25(), res.Returnval), nil
}
Exemplo n.º 2
0
// RemoveSnapshot removes a named snapshot
func (v VirtualMachine) RemoveSnapshot(ctx context.Context, name string, removeChildren bool, consolidate *bool) (*Task, error) {
	snapshot, err := v.findSnapshot(ctx, name)
	if err != nil {
		return nil, err
	}

	req := types.RemoveSnapshot_Task{
		This:           snapshot.Reference(),
		RemoveChildren: removeChildren,
		Consolidate:    consolidate,
	}

	res, err := methods.RemoveSnapshot_Task(ctx, v.c, &req)
	if err != nil {
		return nil, err
	}

	return NewTask(v.c, res.Returnval), nil
}