GetXenStoreItem() 공개 메소드

public GetXenStoreItem ( string name ) : XenStoreItem
name string
리턴 XenStoreItem
예제 #1
0
 public Feature(string name, string advertise, string control, bool controlmustexist, IExceptionHandler exceptionhandler)
 {
     this.exceptionhandler = exceptionhandler;
     this.name             = name;
     wmisession            = WmiBase.Singleton.GetXenStoreSession("Citrix Xen Service Feature : " + name);
     wmisession.Log("New Feature");
     controlKey            = wmisession.GetXenStoreItem(control);
     this.controlmustexist = controlmustexist;
     try
     {
         if (controlKey.value != "")
         {
             wmisession.Log("Control key " + control + ":" + controlKey.value);
         }
     }
     catch {}
     enabled  = true;
     listener = controlKey.Watch(new EventArrivedEventHandler(onFeatureWrapper));
     if (!advertise.Equals(""))
     {
         advert = wmisession.GetXenStoreItem(advertise);
         features.Add(this);
     }
     Disposer.Add(this);
 }
예제 #2
0
 public ClipboardAccess(WmiSession wmisession)
 {
     this.wmisession   = wmisession;
     xsSetClipboard    = wmisession.GetXenStoreItem("data/set_clipboard");
     xsReportClipboard = wmisession.GetXenStoreItem("data/report_clipboard");
     serverwatch       = xsSetClipboard.Watch(new EventArrivedEventHandler(OnServerClipboard));
     clientwatch       = xsReportClipboard.Watch(new EventArrivedEventHandler(OnClientClipboard));
 }
예제 #3
0
 private WmiBase()
 {
     debugmsg       = new Queue <string>();
     syncSingleton  = new Object();
     xenbaselock    = new Object();
     wmisession     = new WmiSession("Base", this);
     xsupdated      = wmisession.GetXenStoreItem("data/updated");
     xsupdatedcount = wmisession.GetXenStoreItem("data/update_cnt");
     xserror        = wmisession.GetXenStoreItem("control/error");
 }
예제 #4
0
 private WmiBase()
 {
     debugmsg = new Queue<string>();
     syncSingleton = new Object();
     xenbaselock = new Object();
     wmisession = new WmiSession("Base", this);
     xsupdated = wmisession.GetXenStoreItem("data/updated");
     xsupdatedcount = wmisession.GetXenStoreItem("data/update_cnt");
     xserror = wmisession.GetXenStoreItem("control/error");
 }
예제 #5
0
 public static void removeSnapshot(WmiSession wmisession)
 {
     try
     {
         wmisession.GetXenStoreItem("control/snapshot").Remove();
     }
     catch { };
     try
     {
         wmisession.GetXenStoreItem("control/feature-snapshot").Remove();
     }
     catch { }
 }
예제 #6
0
 public NetInfo(IExceptionHandler exceptionhandler)
 {
     updating = new Object();
     this.exceptionhandler = exceptionhandler;
     wmisession            = WmiBase.Singleton.GetXenStoreSession("Adapters");
     devicevif             = wmisession.GetXenStoreItem("device/vif");
     datavif      = wmisession.GetXenStoreItem("data/vif");
     numvif       = wmisession.GetXenStoreItem("data/num_vif");
     needsRefresh = true;
     onAddrChange(null, null);
     addrChangeHandler = new NetworkAddressChangedEventHandler(onAddrChange);
     NetworkChange.NetworkAddressChanged += addrChangeHandler;
     vifListen = devicevif.Watch(onVifChanged);
 }
예제 #7
0
 public NetInfo(IExceptionHandler exceptionhandler)
 {
     updating = new Object();
     this.exceptionhandler = exceptionhandler;
     wmisession = WmiBase.Singleton.GetXenStoreSession("Adapters");
     devicevif = wmisession.GetXenStoreItem("device/vif");
     datavif = wmisession.GetXenStoreItem("data/vif");
     numvif =  wmisession.GetXenStoreItem("data/num_vif");
     needsRefresh = true;
     onAddrChange(null, null);
     addrChangeHandler = new NetworkAddressChangedEventHandler(onAddrChange);
     NetworkChange.NetworkAddressChanged += addrChangeHandler;
     vifListen = devicevif.Watch(onVifChanged);
 }
예제 #8
0
 void removeDevices()
 {
     try
     {
         foreach (string node in datavif.children)
         {
             try
             {
                 wmisession.GetXenStoreItem(node).Remove();
             }
             catch { }; // Ignore failure, if nodes don't exist
         }
     }
     catch { }; // If there are no nodes, then we can also ignore failure
 }
예제 #9
0
            bool backupHandler(IntPtr bstrMem)
            {
                try
                {
                    string backup = Marshal.PtrToStringBSTR(bstrMem);
                    string vm     = wmisession.GetXenStoreItemCached("vm").value.Substring(4);
                    if (type == VssSnapshot.Type.VM)
                    {
                        string snapstr = wmisession.GetXenStoreItem("/vss/" + vm + "/snapuuid").value;
                        wmisession.GetXenStoreItem("control/snapshot/snapuuid").value = snapstr;
                        wmisession.GetXenStoreItem("control/snapshot/type").value     = "vm";
                    }
                    else if (type == VssSnapshot.Type.VOLUME)
                    {
                        string       rootkeyname = "/vss/" + vm + "/vdisnap";
                        XenStoreItem vdisnap     = wmisession.GetXenStoreItem(rootkeyname);
                        foreach (string entryKey in vdisnap.children)
                        {
                            XenStoreItem src  = wmisession.GetXenStoreItem(entryKey);
                            XenStoreItem dest = wmisession.GetXenStoreItem("control/snapshot/vdi/" + entryKey.Substring(rootkeyname.Length + 1));
                            src.value = dest.value;
                        }
                        string snaptype = wmisession.GetXenStoreItem("/vss/" + vm + "/snaptype").value;
                        wmisession.GetXenStoreItem("control/snapshot/type").value = snaptype;
                    }

                    wmisession.GetXenStoreItem("control/snapshot/snapid").Remove();

                    int    size      = backup.Length;
                    int    poscount  = 0;
                    int    pagecount = 0;
                    string substr    = "";
                    while (size > 0)
                    {
                        substr += string.Format("{0:x2}{1:x2}", ((int)backup[poscount]) & 0xff, (((int)backup[poscount]) >> 8) & 0xff);
                        size--;
                        poscount++;
                        if (((poscount % 255) == 0) || (size == 0))
                        {
                            wmisession.GetXenStoreItem("control/snapshot/snapid/" + pagecount.ToString()).value = substr;
                            substr = "";
                            pagecount++;
                        }
                    }
                }
                catch (Exception e)
                {
                    try {
                        wmisession.GetXenStoreItem("control/snapshot/snapid").Remove();
                        WmiBase.Singleton.DebugMsg("Backup failed: " + e.ToString());
                    }
                    catch {}
                    return(false);
                }
                return(true);
            }
예제 #10
0
 protected void addAdvert(string advertname)
 {
     advert = wmisession.GetXenStoreItem(advertname);
     features.Add(this);
 }
예제 #11
0
        public Feature(string name, string advertise, string control, bool controlmustexist, IExceptionHandler exceptionhandler)
        {
            this.exceptionhandler = exceptionhandler;
            this.name = name;
            wmisession = WmiBase.Singleton.GetXenStoreSession("Citrix Xen Service Feature : " + name);
            wmisession.Log("New Feature");
            controlKey = wmisession.GetXenStoreItem(control);
            this.controlmustexist = controlmustexist;
            try
            {
                if (controlKey.value != "")
                {
                    wmisession.Log("Control key "+control+":"+controlKey.value);
                }
            }
            catch {}
            enabled = true;
            listener = controlKey.Watch(new EventArrivedEventHandler(onFeatureWrapper));
            if (!advertise.Equals(""))
            {
                advert = wmisession.GetXenStoreItem(advertise);
                features.Add(this);

            }
            Disposer.Add(this);
        }
예제 #12
0
 public ClipboardAccess(WmiSession wmisession)
 {
     this.wmisession = wmisession;
     xsSetClipboard = wmisession.GetXenStoreItem("data/set_clipboard");
     xsReportClipboard = wmisession.GetXenStoreItem("data/report_clipboard");
     serverwatch = xsSetClipboard.Watch(new EventArrivedEventHandler(OnServerClipboard));
     clientwatch = xsReportClipboard.Watch(new EventArrivedEventHandler(OnClientClipboard));
 }
예제 #13
0
 public void Remove()
 {
     wmisession.GetXenStoreItem(path).Remove();
 }
예제 #14
0
 public static void removeSnapshot(WmiSession wmisession)
 {
     try
     {
         wmisession.GetXenStoreItem("control/snapshot").Remove();
     }
     catch { };
     try
     {
         wmisession.GetXenStoreItem("control/feature-snapshot").Remove();
     }
     catch { }
 }