Using PVA Agent API against Management Node (MN)

Discussion in 'General Questions' started by Ed_Greenberg, Jan 13, 2016.

  1. Ed_Greenberg

    Ed_Greenberg Kilo Poster

    Messages:
    22
    I've been able to do some inquiries against the management node, but there is no mention of it in the PVA Agent XML API Reference, and I'm stumped a bit.

    I asked the agent for a list of containers on a particular node.

    First I determined the EID of the node by telnetting to it on port 4433
    <packet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="0" priority="0" version="4.5.0">
    <origin>vzclient155-1a7a1d36-7d80-2b4a-a9a2-e66ac6867cdf</origin>
    <target>agent</target>
    <data>
    <ok/>
    <eid>1a7a1d36-7d80-2b4a-a9a2-e66ac6867cdf</eid>
    </data>
    </packet>

    I got a list of eids back:
    <ns1:eek:rigin>1a7a1d36-7d80-2b4a-a9a2-e66ac6867cdf</ns1:eek:rigin>
    <ns1:dst>
    <ns1:director>gend</ns1:director>
    <ns1:target>vzclient41-b749813b-f889-0d48-ae87-788b12ee5121</ns1:target>
    </ns1:dst>
    <ns1:data>
    <ns2:vzaenvm>
    <ns2:eid>6fe51e4d-b506-3443-973f-ce74849cd289</ns2:eid>
    <ns2:eid>10eb9cf5-f534-4948-adaa-6abc0a0c917b</ns2:eid>
    <ns2:eid>c6982440-8bee-5240-af45-03d58a91f0a8</ns2:eid>
    <ns2:eid>ac74a471-5071-6842-8002-40e96784e188</ns2:eid>
    <ns2:eid>54663c08-e34c-a24e-a63b-a15dbcf5af1b</ns2:eid>
    <ns2:eid>48a46a64-f35d-ae45-971b-4f2b5cb1157c</ns2:eid>
    <ns2:eid>f931ebab-e7f6-b14d-addc-556ba36ca17f</ns2:eid>
    <ns2:eid>942c661e-6007-de41-b964-b681966b104d</ns2:eid>
    <ns2:eid>310f6029-c52b-eb47-8541-6c2ef541fea8</ns2:eid>
    <ns2:eid>7ef20344-7b49-f74b-b9b8-99c7f11415ef</ns2:eid>
    </ns2:vzaenvm>
    </ns1:data>
    <src>
    <director>gend</director>
    <target>vzaenvm</target>
    </src>
    <target>vzclient41-b749813b-f889-0d48-ae87-788b12ee5121</target>
    </packet>


    So now I want to get info back on each of the EIDs.

    If I was querying the node, I'd be able to do this:
    <packet version="4.0.0" id="4">
    <target>vzaenvm</target>
    <data>
    <vzaenvm>
    <get_info>
    <eid>6fe51e4d-b506-3443-973f-ce74849cd289</eid>
    </get_info>
    </vzaenvm>
    </data>
    </packet>

    Since I am querying the management node, I added this to the above within the <data> tags:
    <dst>
    <host>1a7a1d36-7d80-2b4a-a9a2-e66ac6867cdf</host>
    </dst>

    Unfortunately, PVA returns:
    <packet xmlns:ns1="http://www.swsoft.com/webservices/vzl/4.0.0/protocol" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="4" priority="0" version="4.5.0">
    <ns1:eek:rigin>gend</ns1:eek:rigin>
    <ns1:target>vzclient43-b749813b-f889-0d48-ae87-788b12ee5121</ns1:target>
    <ns1:dst>
    <director>gend</director>
    </ns1:dst>
    <ns1:data>
    <ns1:error>
    <ns1:code>2</ns1:code>
    <ns1:message>Target vzaenvm is not found. </ns1:message>
    </ns1:error>
    </ns1:data>
    </packet>

    Which may make sense, but one should be able to do this. Technote https://kb.odin.com/en/118308 implies that I can send a create request (which invokes vzaenvm) via the management node, so why not a more simple inquiry?

    Does anybody know what I'm doing wrong?
     
  2. Pavel

    Pavel A.I. Auto-Responder Staff Member

    Messages:
    475
    Hello Ed,

    Unfortunately this isn't always right, some API only works via MN, and some only works directly, entirely depending on exact use-case.
    If you want to list containers and get more information about each one of them I'd recommend accessing node directly.
    I'd recommend "direct connection to the node" approach when you're working with instances within a single host, not when it concerns the group of nodes registered within same management group.
     
  3. Pavel

    Pavel A.I. Auto-Responder Staff Member

    Messages:
    475
  4. Ed_Greenberg

    Ed_Greenberg Kilo Poster

    Messages:
    22
    Thanks for the above suggestions, Pavel. I sent this to the node:

    <packet version="4.0.0" id="4">
    <!-- send me to nn2238 with eid starting 6fe5 -->
    <target>vzaenvm</target>
    <data>
    <vzaenvm>
    <get_info>
    <eid>6fe51e4d-b506-3443-973f-ce74849cd289</eid>
    </get_info>
    </vzaenvm>
    </data>
    </packet>

    Where the EID is a valid one for that node.

    What I got back was

    <packet xmlns:ns1="http://www.swsoft.com/webservices/vzl/4.0.0/protocol" xmlns:ns3="http://www.swsoft.com/webservices/vza/4.0.0/vzatypes" xmlns:ns4="http://www.swsoft.com/webservices/vzl/4.0.0/types" xmlns:ns2="http://www.swsoft.com/webservices/vzl/4.0.0/envm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.0.0" priority="0" id="4" type="0" time="2016-01-19T01:37:42+0000">
    <ns1:eek:rigin>vzaenvm</ns1:eek:rigin>
    <ns1:target>vzclient261-1a7a1d36-7d80-2b4a-a9a2-e66ac6867cdf</ns1:target>
    <ns1:dst>
    <ns1:director>gend</ns1:director>
    </ns1:dst>
    <ns1:data>
    <ns2:vzaenvm>
    <ns2:env xsi:type="ns3:envType">
    <ns4:parent_eid>00000000-0000-0000-0000-000000000000</ns4:parent_eid>
    <ns4:eid>6fe51e4d-b506-3443-973f-ce74849cd289</ns4:eid>
    <ns4:status xsi:type="ns4:env_statusType">
    <ns4:state>6</ns4:state>
    </ns4:status>
    <ns4:alert>0</ns4:alert>
    <ns4:config xsi:type="ns4:env_configType"/>
    <ns4:virtual_config xsi:type="ns3:venv_configType">
    <ns4:type>virtuozzo</ns4:type>
    </ns4:virtual_config>
    </ns2:env>
    </ns2:vzaenvm>
    </ns1:data>
    <src>
    <director>gend</director>
    </src>
    </packet>

    I expected something along the lines of what's shown on http://download.swsoft.com/pva/61/docs/en/html/PVA_Agent_XML_API_Reference/16358.htm

    There's no useful info in the xml that I got back. I wonder what I'm doing wrong. (You know, I could just download and parse all the ve.conf files and eliminate the XML entirely, but I'm trying to learn to do this right :)

    Ed G
     
  5. Pavel

    Pavel A.I. Auto-Responder Staff Member

    Messages:
    475
    Hello Ed,

    Example contains following part:
    Code:
     <get_info>
     <config/>
     </get_info>
    
    While your packet is missing "<config/>" part. If you add it you should get the config.
     
  6. Ed_Greenberg

    Ed_Greenberg Kilo Poster

    Messages:
    22
    Thank you for catching my mistake.

    Ed
     

Share This Page