예제 #1
0
        /// <summary>
        /// Processes the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns></returns>
        public object Process(dynamic args)
        {
            Logger.Info("Processing unmount disk :" + args.ToString());
            string cid = args[0].Value.ToString();

            int diskId = int.Parse(Config.Platform.LookupDiskByCid(cid), CultureInfo.InvariantCulture);
            string mountEntry = DiskUtil.MountEntry(diskId);
            if (mountEntry != null)
            {
                DiskUtil.UnmountGuard(mountEntry);
                UnmountMessage unmountMessage = new UnmountMessage();
                unmountMessage.Message = string.Format(CultureInfo.InvariantCulture, "done unmount {0} on {1}", mountEntry, diskId);
                return unmountMessage;
            }
            else
            {
                UnmountMessage unmountMessage = new UnmountMessage();
                unmountMessage.Message = string.Format(CultureInfo.InvariantCulture, "Unknown mount for partition {0}", diskId.ToString(CultureInfo.InvariantCulture));
                return unmountMessage;
            }
        }
예제 #2
0
        /// <summary>
        /// Processes the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns></returns>
        public object Process(dynamic args)
        {
            Logger.Info("Processing unmount disk :" + args.ToString());
            string cid = args[0].Value.ToString();

            int    diskId     = int.Parse(Config.Platform.LookupDiskByCid(cid), CultureInfo.InvariantCulture);
            string mountEntry = DiskUtil.MountEntry(diskId);

            if (mountEntry != null)
            {
                DiskUtil.UnmountGuard(mountEntry);
                UnmountMessage unmountMessage = new UnmountMessage();
                unmountMessage.Message = string.Format(CultureInfo.InvariantCulture, "done unmount {0} on {1}", mountEntry, diskId);
                return(unmountMessage);
            }
            else
            {
                UnmountMessage unmountMessage = new UnmountMessage();
                unmountMessage.Message = string.Format(CultureInfo.InvariantCulture, "Unknown mount for partition {0}", diskId.ToString(CultureInfo.InvariantCulture));
                return(unmountMessage);
            }
        }