|
31 | 31 | import java.util.Set; |
32 | 32 | import java.util.UUID; |
33 | 33 |
|
34 | | -import org.apache.log4j.Logger; |
35 | | -import org.apache.xmlrpc.XmlRpcException; |
36 | | - |
37 | | -import com.xensource.xenapi.Connection; |
38 | | -import com.xensource.xenapi.Host; |
39 | | -import com.xensource.xenapi.PBD; |
40 | | -import com.xensource.xenapi.Pool; |
41 | | -import com.xensource.xenapi.SR; |
42 | | -import com.xensource.xenapi.Types; |
43 | | -import com.xensource.xenapi.Types.BadServerResponse; |
44 | | -import com.xensource.xenapi.Types.VmPowerState; |
45 | | -import com.xensource.xenapi.Types.XenAPIException; |
46 | | -import com.xensource.xenapi.VBD; |
47 | | -import com.xensource.xenapi.VDI; |
48 | | -import com.xensource.xenapi.VM; |
49 | | -import com.xensource.xenapi.VMGuestMetrics; |
50 | | - |
51 | 34 | import org.apache.cloudstack.storage.command.AttachAnswer; |
52 | 35 | import org.apache.cloudstack.storage.command.AttachCommand; |
53 | 36 | import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer; |
|
66 | 49 | import org.apache.cloudstack.storage.to.SnapshotObjectTO; |
67 | 50 | import org.apache.cloudstack.storage.to.TemplateObjectTO; |
68 | 51 | import org.apache.cloudstack.storage.to.VolumeObjectTO; |
| 52 | +import org.apache.log4j.Logger; |
| 53 | +import org.apache.xmlrpc.XmlRpcException; |
69 | 54 |
|
70 | 55 | import com.cloud.agent.api.Answer; |
71 | 56 | import com.cloud.agent.api.CreateStoragePoolCommand; |
|
88 | 73 | import com.cloud.utils.storage.encoding.DecodedDataObject; |
89 | 74 | import com.cloud.utils.storage.encoding.DecodedDataStore; |
90 | 75 | import com.cloud.utils.storage.encoding.Decoder; |
| 76 | +import com.xensource.xenapi.Connection; |
| 77 | +import com.xensource.xenapi.Host; |
| 78 | +import com.xensource.xenapi.PBD; |
| 79 | +import com.xensource.xenapi.Pool; |
| 80 | +import com.xensource.xenapi.SR; |
| 81 | +import com.xensource.xenapi.Types; |
| 82 | +import com.xensource.xenapi.Types.BadServerResponse; |
| 83 | +import com.xensource.xenapi.Types.VmPowerState; |
| 84 | +import com.xensource.xenapi.Types.XenAPIException; |
| 85 | +import com.xensource.xenapi.VBD; |
| 86 | +import com.xensource.xenapi.VDI; |
| 87 | +import com.xensource.xenapi.VM; |
| 88 | +import com.xensource.xenapi.VMGuestMetrics; |
91 | 89 |
|
92 | 90 | public class XenServerStorageProcessor implements StorageProcessor { |
93 | 91 | private static final Logger s_logger = Logger.getLogger(XenServerStorageProcessor.class); |
@@ -488,11 +486,15 @@ public Answer createSnapshot(CreateObjectCommand cmd) { |
488 | 486 | Boolean isISCSI = IsISCSI(type); |
489 | 487 | String snapshotParentUUID = getVhdParent(conn, srUUID, snapshotUUID, isISCSI); |
490 | 488 |
|
491 | | - String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID, isISCSI); |
492 | | - if( snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID)) { |
493 | | - // this is empty snapshot, remove it |
494 | | - snapshot.destroy(conn); |
495 | | - snapshotUUID = preSnapshotUUID; |
| 489 | + try { |
| 490 | + String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID, isISCSI); |
| 491 | + if( snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID)) { |
| 492 | + // this is empty snapshot, remove it |
| 493 | + snapshot.destroy(conn); |
| 494 | + snapshotUUID = preSnapshotUUID; |
| 495 | + } |
| 496 | + } catch(Exception e) { |
| 497 | + s_logger.debug("Failed to get parent snapshot", e); |
496 | 498 | } |
497 | 499 | } |
498 | 500 | SnapshotObjectTO newSnapshot = new SnapshotObjectTO(); |
@@ -1328,6 +1330,8 @@ public Answer backupSnapshot(CopyCommand cmd) { |
1328 | 1330 | } |
1329 | 1331 | } |
1330 | 1332 | } catch (Exception e) { |
| 1333 | + s_logger.debug("Failed to get parent snapshots, take full snapshot", e); |
| 1334 | + fullbackup = true; |
1331 | 1335 | } |
1332 | 1336 | } |
1333 | 1337 |
|
|
0 commit comments