mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5395: mark snapshot_store_ref as destroyed in case of backup snapshot failed
Conflicts: plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
This commit is contained in:
parent
a72222dd46
commit
e656201fee
@ -302,6 +302,10 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||||||
if (result.isFailed()) {
|
if (result.isFailed()) {
|
||||||
try {
|
try {
|
||||||
destSnapshot.processEvent(Event.OperationFailed);
|
destSnapshot.processEvent(Event.OperationFailed);
|
||||||
|
//if backup snapshot failed, mark srcSnapshot in snapshot_store_ref as failed also
|
||||||
|
srcSnapshot.processEvent(Event.DestroyRequested);
|
||||||
|
srcSnapshot.processEvent(Event.OperationSuccessed);
|
||||||
|
|
||||||
srcSnapshot.processEvent(Snapshot.Event.OperationFailed);
|
srcSnapshot.processEvent(Snapshot.Event.OperationFailed);
|
||||||
} catch (NoTransitionException e) {
|
} catch (NoTransitionException e) {
|
||||||
s_logger.debug("Failed to update state: " + e.toString());
|
s_logger.debug("Failed to update state: " + e.toString());
|
||||||
|
|||||||
@ -30,19 +30,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.xensource.xenapi.Connection;
|
import javax.ws.rs.HEAD;
|
||||||
import com.xensource.xenapi.Host;
|
|
||||||
import com.xensource.xenapi.PBD;
|
|
||||||
import com.xensource.xenapi.Pool;
|
|
||||||
import com.xensource.xenapi.SR;
|
|
||||||
import com.xensource.xenapi.Types;
|
|
||||||
import com.xensource.xenapi.Types.BadServerResponse;
|
|
||||||
import com.xensource.xenapi.Types.VmPowerState;
|
|
||||||
import com.xensource.xenapi.Types.XenAPIException;
|
|
||||||
import com.xensource.xenapi.VBD;
|
|
||||||
import com.xensource.xenapi.VDI;
|
|
||||||
import com.xensource.xenapi.VM;
|
|
||||||
import com.xensource.xenapi.VMGuestMetrics;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.storage.command.AttachAnswer;
|
import org.apache.cloudstack.storage.command.AttachAnswer;
|
||||||
import org.apache.cloudstack.storage.command.AttachCommand;
|
import org.apache.cloudstack.storage.command.AttachCommand;
|
||||||
@ -87,6 +75,19 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
|||||||
import com.cloud.utils.storage.encoding.DecodedDataObject;
|
import com.cloud.utils.storage.encoding.DecodedDataObject;
|
||||||
import com.cloud.utils.storage.encoding.DecodedDataStore;
|
import com.cloud.utils.storage.encoding.DecodedDataStore;
|
||||||
import com.cloud.utils.storage.encoding.Decoder;
|
import com.cloud.utils.storage.encoding.Decoder;
|
||||||
|
import com.xensource.xenapi.Connection;
|
||||||
|
import com.xensource.xenapi.Host;
|
||||||
|
import com.xensource.xenapi.PBD;
|
||||||
|
import com.xensource.xenapi.Pool;
|
||||||
|
import com.xensource.xenapi.SR;
|
||||||
|
import com.xensource.xenapi.Types;
|
||||||
|
import com.xensource.xenapi.Types.BadServerResponse;
|
||||||
|
import com.xensource.xenapi.Types.VmPowerState;
|
||||||
|
import com.xensource.xenapi.Types.XenAPIException;
|
||||||
|
import com.xensource.xenapi.VBD;
|
||||||
|
import com.xensource.xenapi.VDI;
|
||||||
|
import com.xensource.xenapi.VM;
|
||||||
|
import com.xensource.xenapi.VMGuestMetrics;
|
||||||
|
|
||||||
public class XenServerStorageProcessor implements StorageProcessor {
|
public class XenServerStorageProcessor implements StorageProcessor {
|
||||||
private static final Logger s_logger = Logger.getLogger(XenServerStorageProcessor.class);
|
private static final Logger s_logger = Logger.getLogger(XenServerStorageProcessor.class);
|
||||||
@ -475,12 +476,16 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
|||||||
Boolean isISCSI = IsISCSI(type);
|
Boolean isISCSI = IsISCSI(type);
|
||||||
String snapshotParentUUID = getVhdParent(conn, srUUID, snapshotUUID, isISCSI);
|
String snapshotParentUUID = getVhdParent(conn, srUUID, snapshotUUID, isISCSI);
|
||||||
|
|
||||||
|
try {
|
||||||
String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID, isISCSI);
|
String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID, isISCSI);
|
||||||
if( snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID)) {
|
if( snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID)) {
|
||||||
// this is empty snapshot, remove it
|
// this is empty snapshot, remove it
|
||||||
snapshot.destroy(conn);
|
snapshot.destroy(conn);
|
||||||
snapshotUUID = preSnapshotUUID;
|
snapshotUUID = preSnapshotUUID;
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
s_logger.debug("Failed to get parent snapshot", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
|
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
|
||||||
newSnapshot.setPath(snapshotUUID);
|
newSnapshot.setPath(snapshotUUID);
|
||||||
@ -1368,6 +1373,8 @@ public class XenServerStorageProcessor implements StorageProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
s_logger.debug("Failed to get parent snapshots, take full snapshot", e);
|
||||||
|
fullbackup = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user