Archive

Posts Tagged ‘Administration’

Synergy

May 3rd, 2010 jmguilla No comments

Use one mouse/keyboard to control several computers

Many people in IT need their workstation to work but also have a laptop lent by their company. If you are in that situation, you have experimented how tedious it is to switch mouse and keyboard when you need to use your laptop when you are working on your workstation. The solution has been brought to you by Synergy, a little software with a server and a client components, which can be used to share mouse and keyboards between several computers. Really easy to use, just install and launch synergys on your workstation, and as many synergyc as you need ( one per client computer of course ). Here is the configuration file I use? It is straight forward to adapt it to your own needs:

section: screens
        slave1:
	tartopum:
end
section: aliases
	slave1:
		192.168.1.20
		slave1.activeeon.com
	tartopum:
		192.168.1.23
		tartopum.activeeon.com
end
section: links
        slave1:
                right = tartopum
	tartopum:
		left = slave1
end

Enjoy!

Categories: Administration Tags:

WinRM & XML CIM Instances as method parameter

April 29th, 2010 jmguilla No comments

Here is a something I couldn’t find anywhere on MSDN network documentation an forums. If you want to have a quick look at all the story, you can visit the msdn network’s dedicated thread.

The problem was I didn’t know how to be able to pass XML CIM Instances as parameter during a WinRM method call. WinRM is really powerful, but with some namespaces, you can’t create objects using the CREATE action. Instead, you must use appropriate managers’ methods, for instance, in the virtualization’s namespace, if you want to add a new Key/Value pair to a Msvm_ComputerSystem ( ie. a virtual machine for those of you who are not familiar with Microsoft’s CIM ). Here come the troubles… There isn’t any single place in the entire MSDN and DMTF documentation which describes the way CIM XML Instances have to be written. The WSMAN specification says that method input is XML. The normal behavior would be to think that the CIM Instances are just unchanged. If you think like me, you have certainly written:

<p:AddKvpItems_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/Msvm_VirtualSystemManagementService">
    <p:TargetSystem xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" >
        <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
        <a:ReferenceParameters>
            <w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/Msvm_ComputerSystem</w:ResourceURI>
            <w:SelectorSet>
                <w:Selector Name="CreationClassName">Msvm_ComputerSystem</w:Selector>
                <w:Selector Name="Name">3AA32387-6924-448C-835D-06E63A624C3E</w:Selector>
            </w:SelectorSet>
        </a:ReferenceParameters>
    </p:TargetSystem>
    <p:DataItems>
        <INSTANCE xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/Msvm_KvpExchangeDataItem" CLASSNAME="Msvm_KvpExchangeDataItem">
            <QUALIFIER NAME="dynamic" PROPAGATED="true" TYPE="boolean" TOSUBCLASS="false" TOINSTANCE="true">TRUE</QUALIFIER>
            <PROPERTY NAME="__PATH" CLASSORIGIN="___SYSTEM" TYPE="string"></PROPERTY>
            <PROPERTY NAME="__NAMESPACE" CLASSORIGIN="___SYSTEM" TYPE="string"></PROPERTY>
            <PROPERTY NAME="__SERVER" CLASSORIGIN="___SYSTEM" TYPE="string"></PROPERTY>
            <PROPERTY.ARRAY NAME="__DERIVATION" CLASSORIGIN="___SYSTEM"    TYPE="string">
                <VALUE.ARRAY>CIM_ManagedElement</VALUE.ARRAY>
            </PROPERTY.ARRAY>
            <PROPERTY NAME="__PROPERTY_COUNT" CLASSORIGIN="___SYSTEM" TYPE="sint32">6</PROPERTY>
            <PROPERTY NAME="__RELPATH" CLASSORIGIN="___SYSTEM" TYPE="string"></PROPERTY>
            <PROPERTY NAME="__DYNASTY" CLASSORIGIN="___SYSTEM" TYPE="string">CIM_ManagedElement</PROPERTY>
            <PROPERTY NAME="__SUPERCLASS" CLASSORIGIN="___SYSTEM" TYPE="string">CIM_ManagedElement</PROPERTY>
            <PROPERTY NAME="__CLASS" CLASSORIGIN="___SYSTEM" TYPE="string">Msvm_KvpExchangeDataItem</PROPERTY>
            <PROPERTY NAME="__GENUS" CLASSORIGIN="___SYSTEM" TYPE="sint32">2</PROPERTY>
            <PROPERTY NAME="Caption" CLASSORIGIN="CIM_ManagedElement" PROPAGATED="true" TYPE="string">
                <QUALIFIER NAME="CIMTYPE" PROPAGATED="true" TYPE="string" TOINSTANCE="true">string</QUALIFIER>
            </PROPERTY>
            <PROPERTY NAME="Data" CLASSORIGIN="Msvm_KvpExchangeDataItem" PROPAGATED="true" TYPE="string">
                <QUALIFIER NAME="CIMTYPE" PROPAGATED="true" TYPE="string" TOINSTANCE="true">myNewValue</QUALIFIER>
            </PROPERTY>
            <PROPERTY NAME="Description" CLASSORIGIN="CIM_ManagedElement" PROPAGATED="true" TYPE="string">
                <QUALIFIER NAME="CIMTYPE" PROPAGATED="true" TYPE="string" TOINSTANCE="true">string</QUALIFIER>
            </PROPERTY>
            <PROPERTY NAME="ElementName" CLASSORIGIN="CIM_ManagedElement" PROPAGATED="true" TYPE="string">
                <QUALIFIER NAME="CIMTYPE" PROPAGATED="true" TYPE="string" TOINSTANCE="true">string</QUALIFIER>
            </PROPERTY>
            <PROPERTY NAME="Name" CLASSORIGIN="Msvm_KvpExchangeDataItem" PROPAGATED="true" TYPE="string">
                <QUALIFIER NAME="CIMTYPE" PROPAGATED="true" TYPE="string" TOINSTANCE="true">myNewKey</QUALIFIER>
            </PROPERTY>
            <PROPERTY NAME="Source" CLASSORIGIN="Msvm_KvpExchangeDataItem" PROPAGATED="true" TYPE="uint16">
                <QUALIFIER NAME="CIMTYPE" PROPAGATED="true" TYPE="string" TOINSTANCE="true">0</QUALIFIER>
            </PROPERTY>
        </INSTANCE>
    </p:DataItems>
</p:AddKvpItems_INPUT>

and you get an answer like:

WSManFault
    Message
        ProviderFault
            WSManFault
                Message = The WS-Management service cannot process the request because a date-time element or simple property contains child elements.
            ExtendedError
                __ExtendedStatus
                    Description = null
                    Operation = GetObject
                    ParameterInfo = Msvm_ComputerSystem.CreationClassName="Msvm_ComputerSystem",Name="3AA32387-6924-448C-835D-06E63A624C3E"
                    ProviderName = VmmsWmiInstanceAndMethodProvider
                    StatusCode = null
 
Numéro d'erreur :  -2144108479 0x80338041
Le code XML SOAP du message ne correspond pas à la définition du schéma XML. Modifiez le code XML et réessayez.

Not really meaningful… It comes that, after many, many, many tries, I found that, to make that work, you must escape < and > and be careful with withe spaces… Here is the great input file:

    <AddKvpItems_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/Msvm_VirtualSystemManagementService">
      <p:TargetSystem
        xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
        <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
        <a:ReferenceParameters>
          <w:ResourceURI>http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/Msvm_ComputerSystem</w:ResourceURI>
          <w:SelectorSet>
            <w:Selector Name="CreationClassName">Msvm_ComputerSystem</w:Selector>
            <w:Selector Name="Name">0F6888A3-1054-48EF-B643-D364CB283830</w:Selector>
          </w:SelectorSet>
        </a:ReferenceParameters>
      </p:TargetSystem>
      <p:DataItems>&lt;INSTANCE CLASSNAME="Msvm_KvpExchangeDataItem"&gt;&lt;PROPERTY CLASSORIGIN="CIM_ManagedElement" NAME="Caption" PROPAGATED="true" TYPE="string"/&gt;&lt;PROPERTY CLASSORIGIN="Msvm_KvpExchangeDataItem" NAME="Data" PROPAGATED="true" TYPE="string"&gt;&lt;VALUE&gt;myNewValue&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY CLASSORIGIN="CIM_ManagedElement" NAME="Description" PROPAGATED="true" TYPE="string"/&gt;&lt;PROPERTY CLASSORIGIN="CIM_ManagedElement" NAME="ElementName" PROPAGATED="true" TYPE="string"/&gt;&lt;PROPERTY CLASSORIGIN="Msvm_KvpExchangeDataItem" NAME="Name" TYPE="string"&gt;&lt;VALUE&gt;myNewKey&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY CLASSORIGIN="Msvm_KvpExchangeDataItem" NAME="Source" TYPE="uint16"&gt;&lt;VALUE&gt;0&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;/INSTANCE&gt;</p:DataItems>
    </AddKvpItems_INPUT>

You now get a Msvm_ConcreteJob to monitor the method execution.

DMTF’s CIM and interoperability

April 6th, 2010 jmguilla No comments
Computer administration and Caveats ( how DMTF’s CIM can help )

I had a great exchange with one of co-workers today about interoperability and how Linux OSes are good and far better than Windows OSes. His point of view is that thanks to SSH and the Linux’s shell ( and POSIX ) it is really easy to manage a set of Linux computer. That’s why the Linux community does “many” things for the interoperability sake… Even if I am a Linux fan boy, I can’t join that point of view…

Have you already heard about DMTF? DMTF stands for “Distributed Management Task Force”, presided by Winston Bumpus, who is a core individual @ VMware’s. As you can guess, that group is implied in several initiatives to bring interoperability to administrators. One of the main initiatives is CIM, built to dynamically discover and manage resources. A useful interface… And guess what??? Who is the only OS provider implementing it??? Our dear Microsoft for its Windows products ( shipped by default with Seven, server 2008… ).

Thus, who is doing the most for interoperability?…

Xen Server 5.0.0 SDK relative

March 29th, 2010 jmguilla No comments

A little post just because I ruined my day trying to get virtual machine’s mac addresses, ip addresses and heartbeat and because the right way to do it is not really enlightened in the SDK’s documentation:

Get the com.xensource.xenapi.VM you want to get information from. For ip addresses, getVMGuestMetrics method and getNetworks, it will give you all network related information, ip address included. For mac address, you have a public getter on com.xensource.xenapi.VIF object, that you can have from your virtual machine thanks to the method getVIFs ( ok, this one is the easier ). For the heartbeat, once you have the com.xensource.xenapi.VMGuestMetrics of the appropriate virtual machine, a getLive method will give you the virtual machine status ( true, the vm is running normally, false, it is experiencing troubles, probably with cpu charge )…