|
51 | 51 | import javax.xml.parsers.DocumentBuilderFactory; |
52 | 52 | import javax.xml.parsers.ParserConfigurationException; |
53 | 53 |
|
| 54 | +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; |
| 55 | +import org.apache.cloudstack.storage.to.TemplateObjectTO; |
| 56 | +import org.apache.cloudstack.storage.to.VolumeObjectTO; |
54 | 57 | import org.apache.commons.codec.binary.Base64; |
55 | 58 | import org.apache.log4j.Logger; |
56 | 59 | import org.apache.xmlrpc.XmlRpcException; |
|
60 | 63 | import org.xml.sax.InputSource; |
61 | 64 | import org.xml.sax.SAXException; |
62 | 65 |
|
63 | | -import com.google.gson.Gson; |
64 | | -import com.trilead.ssh2.SCPClient; |
65 | | -import com.xensource.xenapi.Bond; |
66 | | -import com.xensource.xenapi.Connection; |
67 | | -import com.xensource.xenapi.Console; |
68 | | -import com.xensource.xenapi.Host; |
69 | | -import com.xensource.xenapi.HostCpu; |
70 | | -import com.xensource.xenapi.HostMetrics; |
71 | | -import com.xensource.xenapi.Network; |
72 | | -import com.xensource.xenapi.PBD; |
73 | | -import com.xensource.xenapi.PIF; |
74 | | -import com.xensource.xenapi.PIF.Record; |
75 | | -import com.xensource.xenapi.Pool; |
76 | | -import com.xensource.xenapi.SR; |
77 | | -import com.xensource.xenapi.Session; |
78 | | -import com.xensource.xenapi.Task; |
79 | | -import com.xensource.xenapi.Types; |
80 | | -import com.xensource.xenapi.Types.BadAsyncResult; |
81 | | -import com.xensource.xenapi.Types.BadServerResponse; |
82 | | -import com.xensource.xenapi.Types.ConsoleProtocol; |
83 | | -import com.xensource.xenapi.Types.IpConfigurationMode; |
84 | | -import com.xensource.xenapi.Types.OperationNotAllowed; |
85 | | -import com.xensource.xenapi.Types.SrFull; |
86 | | -import com.xensource.xenapi.Types.VbdType; |
87 | | -import com.xensource.xenapi.Types.VmBadPowerState; |
88 | | -import com.xensource.xenapi.Types.VmPowerState; |
89 | | -import com.xensource.xenapi.Types.XenAPIException; |
90 | | -import com.xensource.xenapi.VBD; |
91 | | -import com.xensource.xenapi.VBDMetrics; |
92 | | -import com.xensource.xenapi.VDI; |
93 | | -import com.xensource.xenapi.VIF; |
94 | | -import com.xensource.xenapi.VLAN; |
95 | | -import com.xensource.xenapi.VM; |
96 | | -import com.xensource.xenapi.VMGuestMetrics; |
97 | | -import com.xensource.xenapi.XenAPIObject; |
98 | | - |
99 | | -import org.apache.cloudstack.storage.command.StorageSubSystemCommand; |
100 | | -import org.apache.cloudstack.storage.to.TemplateObjectTO; |
101 | | -import org.apache.cloudstack.storage.to.VolumeObjectTO; |
102 | | - |
103 | 66 | import com.cloud.agent.IAgentControl; |
104 | 67 | import com.cloud.agent.api.Answer; |
105 | 68 | import com.cloud.agent.api.AttachIsoCommand; |
|
300 | 263 | import com.cloud.vm.DiskProfile; |
301 | 264 | import com.cloud.vm.VirtualMachine; |
302 | 265 | import com.cloud.vm.snapshot.VMSnapshot; |
| 266 | +import com.google.gson.Gson; |
| 267 | +import com.trilead.ssh2.SCPClient; |
| 268 | +import com.xensource.xenapi.Bond; |
| 269 | +import com.xensource.xenapi.Connection; |
| 270 | +import com.xensource.xenapi.Console; |
| 271 | +import com.xensource.xenapi.Host; |
| 272 | +import com.xensource.xenapi.HostCpu; |
| 273 | +import com.xensource.xenapi.HostMetrics; |
| 274 | +import com.xensource.xenapi.Network; |
| 275 | +import com.xensource.xenapi.PBD; |
| 276 | +import com.xensource.xenapi.PIF; |
| 277 | +import com.xensource.xenapi.PIF.Record; |
| 278 | +import com.xensource.xenapi.Pool; |
| 279 | +import com.xensource.xenapi.SR; |
| 280 | +import com.xensource.xenapi.Session; |
| 281 | +import com.xensource.xenapi.Task; |
| 282 | +import com.xensource.xenapi.Types; |
| 283 | +import com.xensource.xenapi.Types.BadAsyncResult; |
| 284 | +import com.xensource.xenapi.Types.BadServerResponse; |
| 285 | +import com.xensource.xenapi.Types.ConsoleProtocol; |
| 286 | +import com.xensource.xenapi.Types.IpConfigurationMode; |
| 287 | +import com.xensource.xenapi.Types.OperationNotAllowed; |
| 288 | +import com.xensource.xenapi.Types.SrFull; |
| 289 | +import com.xensource.xenapi.Types.VbdType; |
| 290 | +import com.xensource.xenapi.Types.VmBadPowerState; |
| 291 | +import com.xensource.xenapi.Types.VmPowerState; |
| 292 | +import com.xensource.xenapi.Types.XenAPIException; |
| 293 | +import com.xensource.xenapi.VBD; |
| 294 | +import com.xensource.xenapi.VBDMetrics; |
| 295 | +import com.xensource.xenapi.VDI; |
| 296 | +import com.xensource.xenapi.VIF; |
| 297 | +import com.xensource.xenapi.VLAN; |
| 298 | +import com.xensource.xenapi.VM; |
| 299 | +import com.xensource.xenapi.VMGuestMetrics; |
| 300 | +import com.xensource.xenapi.XenAPIObject; |
303 | 301 |
|
304 | 302 | /** |
305 | 303 | * CitrixResourceBase encapsulates the calls to the XenServer Xapi process |
@@ -3798,7 +3796,7 @@ protected VDI cloudVDIcopy(Connection conn, VDI vdi, SR sr, int wait) throws Xen |
3798 | 3796 | wait = 2 * 60 * 60; |
3799 | 3797 | } |
3800 | 3798 | try { |
3801 | | - //task = vdi.copyAsync(conn, sr); |
| 3799 | + task = vdi.copyAsync(conn, sr, null, null); |
3802 | 3800 | // poll every 1 seconds , timeout after 2 hours |
3803 | 3801 | waitForTask(conn, task, 1000, wait * 1000); |
3804 | 3802 | checkForSuccess(conn, task); |
@@ -3880,15 +3878,14 @@ public String swiftBackupSnapshot(Connection conn, SwiftTO swift, String srUuid, |
3880 | 3878 |
|
3881 | 3879 | protected SR createFileSR(Connection conn, String path, String location) { |
3882 | 3880 | try { |
3883 | | - Map<String, String> deviceConfig = new HashMap<String, String>(); |
3884 | | - deviceConfig.put("path", path); |
| 3881 | + Map<String, String> smConfig = new HashMap<String, String>(); |
| 3882 | + smConfig.put("location", path); |
3885 | 3883 | Host host = Host.getByUuid(conn, _host.uuid); |
3886 | | - SR sr = SR.create(conn, host, deviceConfig, new Long(0), path, "file", "file", "file", false, |
3887 | | - new HashMap<String, String>()); |
3888 | | - sr.setNameLabel(conn, path + "-File"); |
3889 | | - sr.setNameDescription(conn, location); |
| 3884 | + String uuid = UUID.randomUUID().toString(); |
3890 | 3885 |
|
3891 | | - sr.scan(conn); |
| 3886 | + SR sr = SR.introduce(conn,uuid, uuid, uuid, "file", "file", false, smConfig); |
| 3887 | + |
| 3888 | + //sr.scan(conn); |
3892 | 3889 | return sr; |
3893 | 3890 | } catch (Exception e) { |
3894 | 3891 | String msg = "createFileSR failed! due to " + e.toString(); |
|
0 commit comments