public Stream ReadDisk(ConnectionSettings connectionSettings, DiskAccessRequest diskAccessRequest)
        {
            // The demonstration plug-in has a hard-coded sample disk containing some valid image preparation results for
            // MCS. This allows the demonstration plug-in to be used for image preparation.
            logger.TraceMsg("In ReadDisk - will return hard-coded demonstration set of preparation results.");
            LocalTrace("In ReadDisk - will return hard-coded demonstration set of preparation results. {0}", "ok");
            Assembly assembly           = Assembly.GetExecutingAssembly();
            Stream   compressedDiskData = assembly.GetManifestResourceStream("ExampleProvisioningPlugin.ImagePrepResultsDisk.raw.cmp");

            if (compressedDiskData == null)
            {
                //throw new MachineCreationException("Citrix.ExampleService.DiskReadFailure");
                LocalTrace("Citrix.ExampleService.DiskReadFailure. {0}", "ok");
            }

            logger.TraceMsg("Obtained compressed binary resource of size {0} bytes.", compressedDiskData.Length);
            LocalTrace("Obtained compressed binary resource of size {0} bytes.", "ok");

            MemoryStream outputStream = new MemoryStream();

            // The disk data is around 12Mb, and is compressed in the embedded resource, so we need to deflate it here.
            using (DeflateStream decompressionStream = new DeflateStream(compressedDiskData, CompressionMode.Decompress))
            {
                decompressionStream.CopyTo(outputStream);
            }

            // Seek back to the start once finished.
            outputStream.Seek(0L, SeekOrigin.Begin);

            logger.TraceMsg("Image preparation results disk size is {0} bytes.", outputStream.Length);
            LocalTrace("Image preparation results disk size is {0} bytes.", "ok");

            return(outputStream);
        }
 public DiskImageSpecification FinalizeMasterImage(ConnectionSettings connectionSettings, HostingSettings hostingSettings,
                                                   DiskAccessRequest masterDiskAccess, Action <int> progressCallback, DiskImageSpecification requestedDiskProperties)
 {
     // Dummy implementation
     logger.TraceEntryExit("ExampleService.GetFinalizeMasterImage (no-op)");
     progressCallback(100);
     return(requestedDiskProperties);
 }
 //need to abstrace new template from the halted Preparation VM(Qing require stop VM so may call API to stop at the begiining of this function) no need to store the new template in the plugin
 //and do some code to  filter such 'private'templates out of the tree,say when update inventory tree via describeXXX,the new one will be added(to avaoid this by add id in exception list?)
 public DiskImageSpecification FinalizeMasterImage(ConnectionSettings connectionSettings, HostingSettings hostingSettings,
                                                   DiskAccessRequest masterDiskAccess, Action <int> progressCallback, DiskImageSpecification requestedDiskProperties)
 {
     // nothing to do and just return DiskImageSpecification object with info from masterDiskAccess only id and type need to be assigned
     logger.TraceEntryExit("ExampleService.GetFinalizeMasterImage (no-op)");
     LocalTrace("FinalizeMasterImage ({0})", "called");
     //progressCallback(100);
     return(requestedDiskProperties);
 }
Beispiel #4
0
 public Stream ReadDisk(ConnectionSettings connectionSettings, DiskAccessRequest diskAccessRequest)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 public DiskImageSpecification DetachDisk(ConnectionSettings connectionSettings, DiskAccessRequest diskToDetach,
                                          bool deletingMachine)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public void WriteDisk(ConnectionSettings connectionSettings, DiskAccessRequest diskAccessRequest, Stream contents)
 {
     throw new NotImplementedException();
 }