Пример #1
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();
 }
Пример #2
0
 protected override void CleanOnError()
 {
     if (VM != null && !PointOfNoReturn && Connection.IsConnected)
     {
         try
         {
             VMDestroyAction.DestroyVM(Session, VM, true);
         }
         catch (Exception e)
         {
             // if the clean up has failed for whatever reason we just log it and give up.
             log.Error(e);
         }
     }
 }