protected override void Run() { Description = Messages.ACTION_VIF_DELETING; if (VM.power_state == vm_power_state.Running && VIF.get_allowed_operations(Session, _vif.opaque_ref).Contains(vif_operations.unplug)) { try { VIF.unplug(Session, _vif.opaque_ref); } catch (Failure exn) { // Ignore the failure if it's already detached -- throw everything else. if (exn.ErrorDescription[0] != Failure.DEVICE_ALREADY_DETACHED) { throw; } } } VIF.destroy(Session, _vif.opaque_ref); Description = Messages.ACTION_VIF_DELETED; }
protected override void Run() { Description = Messages.ACTION_VIF_CREATING; RelatedTask = VIF.async_create(Session, _vifDescriptor); PollToCompletion(); if (VM.power_state == vm_power_state.Running) { string newVifRef = Result; //the result from async_create if (VIF.get_allowed_operations(Session, newVifRef).Contains(vif_operations.plug)) { VIF.plug(Session, newVifRef); // try hot-plugging } else { RebootRequired = true; } } Description = Messages.ACTION_VIF_CREATED; }