public string VolumeCapabilities()
        {
            string traceId = GetTraceId("VolumeCapabilities");

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, "VolumeCapabilities");
            return(volumeCapabilities);
        }
        public string Activate()
        {
            string traceId = GetTraceId("Activate");

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, "Activate");
            return(activationString);
        }
Beispiel #3
0
 public string Activate()
 {
     TraceWriter.WriteInfoWithId(
         TraceType,
         this.serviceContext.TraceId,
         "Activate");
     return(activationString);
 }
        public string VolumeList()
        {
            string traceId  = GetTraceId("VolumeList");
            var    response = this.Serialize(this.volumeMap.ListVolumes());

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"VolumeList: {response}");
            return(response);
        }
Beispiel #5
0
 public string VolumeCapabilities()
 {
     TraceWriter.WriteInfoWithId(
         TraceType,
         this.serviceContext.TraceId,
         "VolumeCapabilities");
     return(volumeCapabilities);
 }
        public string BlockStoreRegister()
        {
            bool   registerSuccessful           = false;
            string traceId                      = GetTraceId("BlockStoreRegister");
            string blockStoreServicePartitionId = "";
            string blockStoreServicePort        = "";

            try
            {
                // Catch the low memory exception
                byte[] buffer = new byte[(int)Request.ContentLength];
                Request.Body.Read(buffer, 0, (int)Request.ContentLength);

                // Format: "<ServicePartitionId> <Port>"
                string   registerRequest = System.Text.Encoding.Default.GetString(buffer);
                string[] arrData         = registerRequest.Split(new string[] { " " }, StringSplitOptions.None);
                if (arrData.Length == 2)
                {
                    blockStoreServicePartitionId = arrData[0];
                    blockStoreServicePort        = arrData[1];

                    int port = 0;
                    if (Int32.TryParse(blockStoreServicePort, out port))
                    {
                        // ServicePartitionID could exist, (for instance, SF restart), then just update the map
                        // Need to make sure different Block Store Service never has same ServicePartitionID
                        registerSuccessful = this.volumeMap.UpdateServiceMappings(blockStoreServicePartitionId, port);
                    }
                    else
                    {
                        TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"Unable to parse registration request: {registerRequest}.");
                        registerSuccessful = false;
                    }
                }
                else
                {
                    TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"Malformed registration request: {registerRequest}.");
                    registerSuccessful = false;
                }
            }
            catch (Exception ex)
            {
                TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"Unexpected exception : {ex.Message}");
                registerSuccessful = false;
            }

            if (registerSuccessful)
            {
                TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"{blockStoreServicePartitionId}:{blockStoreServicePort} registered.");
                return("RegisterSuccessful");
            }
            else
            {
                TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"Service registration failed.");
                return("RegisterFailed");
            }
        }
        public string VolumeMount()
        {
            string traceId = GetTraceId("VolumeMount");
            var    body    = this.Deserialize <VolumeMountRequest>(Request.Body);

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"VolumeMount : {body.Name}, {body.ID}");

            return(this.Serialize(this.volumeMap.MountVolume(body, traceId)));
        }
        public string VolumeRemove()
        {
            string traceId = GetTraceId("VolumeRemove");
            var    body    = this.Deserialize <VolumeName>(Request.Body);

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"VolumeRemove : {body.Name}");

            return(this.Serialize(this.volumeMap.RemoveVolume(body, traceId)));
        }
        public string VolumeGet()
        {
            string traceId  = GetTraceId("VolumeGet");
            var    body     = this.Deserialize <VolumeName>(Request.Body);
            string response = this.Serialize(this.volumeMap.GetVolume(body, traceId));

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"VolumeGet : {body.Name}, {response}");
            return(response);
        }
Beispiel #10
0
        public string VolumeGet()
        {
            var body = this.Deserialize <VolumeName>(Request.Body);

            TraceWriter.WriteInfoWithId(
                TraceType,
                this.serviceContext.TraceId,
                $"VolumeGet : {body.Name}");
            return(this.Serialize(this.volumeMap.GetVolume(body)));
        }
Beispiel #11
0
        public string VolumeCreate()
        {
            var body = this.Deserialize <VolumeCreateRequest>(Request.Body);

            TraceWriter.WriteInfoWithId(
                TraceType,
                this.serviceContext.TraceId,
                $"VolumeCreate : {body.Name}, {body.Opts.Count}");
            return(this.Serialize(this.volumeMap.CreateVolume(body)));
        }
Beispiel #12
0
        public string VolumeList()
        {
            var response = this.volumeMap.ListVolumes();
            var count    = ((VolumeListResponse)response).Volumes.Count;

            TraceWriter.WriteInfoWithId(
                TraceType,
                this.serviceContext.TraceId,
                $"VolumeList: returning {count} volumes");
            return(this.Serialize(response));
        }
        public string VolumeCreate()
        {
            string traceId = GetTraceId("VolumeCreate");

            var body = this.Deserialize <VolumeCreateRequest>(Request.Body);

            TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"VolumeCreate : {body.Name}");

            foreach (var opt in body.Opts)
            {
                TraceWriter.WriteInfoWithId(Constants.TraceSource, traceId, $"VolumeCreate : {body.Name} Option {opt.Key}:{opt.Value}");
            }

            return(this.Serialize(this.volumeMap.CreateVolume(body, traceId)));
        }