Пример #1
0
        //Test that if the DestroyVM static method used by VMWizard or Delete snapshot it only deletes owner==true actions
        public void VMDeleteActionDeleteOneTest()
        {
            mockProxy.Setup(x => x.vm_destroy(It.IsAny <string>(), "testvm")).Returns(new Response <string>(""));
            mockProxy.Setup(x => x.vdi_destroy(It.IsAny <string>(), "1")).Returns(new Response <string>(""));
            VM vm = GetVM();

            VMDestroyAction.DestroyVM(new Session(mockProxy.Object, vm.Connection), vm, true);
            mockProxy.VerifyAll();
            mockProxy.Verify(x => x.vdi_destroy(It.IsAny <string>(), It.IsAny <string>()), Times.Once());
        }
Пример #2
0
 protected override void Run()
 {
     Description = String.Format(Messages.ACTION_VM_DELETE_SNAPSHOT_TITLE, m_Snapshot.Name());
     if (m_Snapshot.power_state == vm_power_state.Suspended)
     {
         XenAPI.VM.hard_shutdown(Session, m_Snapshot.opaque_ref);
     }
     VMDestroyAction.DestroyVM(Session, m_Snapshot, true);
     Description = String.Format(Messages.SNAPSHOT_DELETED, m_Snapshot.Name());
 }
Пример #3
0
        //Test that if I pass a vm and delete no disks or snapshots the action deletes the vm
        public void VMDeleteActionTest()
        {
            mockProxy.Setup(x => x.vm_destroy(It.IsAny <string>(), "testvm")).Returns(new Response <string>(""));
            VM  vm     = GetVM();
            var action = new VMDestroyAction(vm, new List <VBD>(), new List <VM>());

            action.RunExternal(new Session(mockProxy.Object, vm.Connection));
            Assert.True(action.Succeeded);
            mockProxy.VerifyAll();
        }