Login | Join Now
  • CUBiT API: QueryAlloc

    Product:
    CUBiT

    Component:
    CUBiT Web Services

    Summary:

    Determine, at either a domain, project, user, or host level, how hosts are allocated and who they are allocated to.



     

    1.1. Description

    The QueryAlloc method is used to determine, at either a domain, project, user, or host level, how hosts are allocated and who they are allocated to. Users are only allowed to get information about hosts which they have access to see. For example, if you are not a member of a project, you cannot query that project's host allocations. If you query the domain, you will only see allocation information for projects to which you belong. This method is used by CUBiT internally, and it is made available for users as well, since they may find this data useful.

    1.2. URL

    /cubit_api/1/query_alloc

    1.3. Authentication

    This method requires authentication using an API key.

    1.4. Parameters

    	full ( zero or once )
    		If full=true then the complete information about the host is printed. 
    		Type: String 
    	name ( zero or once )
    		The name of the host, project, or user to be queried. If type=domain, this argument 
    		is not required. If type={host,project} then this argument is required. If type=user, 
    		this argument is optional, defaulting to the name of the user who you authenticate as. 
    		Only CUBiT Domain Admins are allowed to query user allocations for users other than themselves. 
    		Type: String
    	sig ( Required, once )
    		API authentication hash signature. 
    		Type: String
    	type ( Required, once )
    		The type of service. Valid values are host, project, user and domain. 
    		Type: String
    	userid ( Required, once )
    		The login name of the user initiating the request. 
    		Type: String
    

    1.5. Example Response

    	Here is a sample output where we query type=host and
    	name=cu011.dev.cubitdemo.net:
    	
    	<?xml version='1.0'?>
    	<cubit version='1'>
    	  <project name="zork">
    		<host version="2">
    		  <name>cu011.dev.cubitdemo.net</name>
    		  <alloc_user>yz</alloc_user>
    		  <alloc_project>zork</alloc_project>
    		  <labels>
    			<label name="cubit_user">yz</label>
    			<label name="cubit_project">zork</label>
    		  </labels>
    		</host>
    	  </project>
    	</cubit>
    	
    	Here is a sample output where we query type=host,
    	name=cu011.dev.cubitdemo.net and full=True:
    	
    	<?xml version='1.0'?>
    	<cubit version='1'>
    		  <project name=zork>
    			<host version="2">
    	<name>cu011.dev.cubitdemo.net</name>
    	<alloc_user>yz</alloc_user>
    	<alloc_project>zork</alloc_project>
    	<hardware>
    			<vendor>CollabNet</vendor>
    			<modelname>HP DL380</modelname>
    			<ncpu>2</ncpu>
    			<cpuarch>i386</cpuarch>
    			<cpuname>Xeon</cpuname>
    			<cpumhz>1400</cpumhz>
    			<memsize unit="MB">2048</memsize>
    			<disksize unit="GB">144</disksize>
    	</hardware>
    	<labels>
    	  <label name='cfprofile' rev='322' version='4'>rhel3_base</label>
    		<label name='install_mode'>kickstart-net</label>
    	  <label name='cubit_state'>Allocated</label>
    	  <label name='cubit_alloc_time'>1170799967</label>
    	  <label name='cubit_state_mtime'>1170799967</label>
    	  <label name='cubit_build_time'>1169682748</label>
    	  <label name='cubit_project'>zork</label>
    	  <label name='cubit_user'>yz</label>
    	  <label name='vmware-server'/>
    	  <label name='cubit_lom_addr'>cu3-l.sjc.collab.net</label>
    	</labels>
    	<groups>
    	  <aigroup>DEFAULT</aigroup>
    	</groups>
    	<network>
    	  <routing>
    		<default>
    		  <ipv4_addr>192.168.202.1</ipv4_addr>
    		 </default>
    	  </routing>
    		 <interface>
    			 <name>eth0</name>
    			 <sol_name>e1000g0</sol_name>
    			 <mac_addr>00:16:35:c3:9b:ed</mac_addr>
    			 <bootproto>static</bootproto>
    			 <addr>
    				 <ipv4_addr>192.168.202.21</ipv4_addr>
    				 <ipv4_mask>255.255.255.0</ipv4_mask>
    				 <dnsname>cu011.dev.cubitdemo.net</dnsname>
    			 </addr>
    		 </interface>
    	</network>
    	</host>
    	
    		  </project>
    	</cubit>
    	
    	Here is a sample output where we query type=domain:
    	
    	<?xml version='1.0'?>
    	<cubit version='1'>
    	  <domain>
    	  <project name="zork">
    		  <host>
    			<name>cu011.dev.cubitdemo.net</name>
    			<alloc_user>yz</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">yz</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host>
    			<name>cu012.dev.cubitdemo.net</name>
    			<alloc_user>yz</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">yz</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    	  </project>
    	  </domain>
    	</cubit>
    	
    	Here is a sample output where we query type=domain and full=True:
    	
    	<?xml version='1.0'?>
    	<cubit version='1'>
    	  <domain>
    	  <project name="zork">
    		  <host version="2">
    	<name>cu011.dev.cubitdemo.net</name>
    	<alloc_user>yz</alloc_user>
    	<alloc_project>zork</alloc_project>
    	<hardware>
    			<vendor>CollabNet</vendor>
    			<modelname>HP DL380</modelname>
    			<ncpu>2</ncpu>
    			<cpuarch>i386</cpuarch>
    			<cpuname>Xeon</cpuname>
    			<cpumhz>1400</cpumhz>
    			<memsize unit="MB">2048</memsize>
    			<disksize unit="GB">144</disksize>
    	</hardware>
    	<labels>
    	  <label name='cfprofile' rev='322' version='4'>rhel3_base</label>
    		<label name='install_mode'>kickstart-net</label>
    	  <label name='cubit_state'>Allocated</label>
    	  <label name='cubit_alloc_time'>1170799967</label>
    	  <label name='cubit_state_mtime'>1170799967</label>
    	  <label name='cubit_build_time'>1169682748</label>
    	  <label name='cubit_project'>zork</label>
    	  <label name='cubit_user'>yz</label>
    	  <label name='vmware-server'/>
    	  <label name='cubit_lom_addr'>cu3-l.sjc.collab.net</label>
    	</labels>
    	<groups>
    	  <aigroup>DEFAULT</aigroup>
    	</groups>
    	<network>
    	  <routing>
    		<default>
    		  <ipv4_addr>192.168.202.1</ipv4_addr>
    		 </default>
    	  </routing>
    		 <interface>
    			 <name>eth0</name>
    			 <sol_name>e1000g0</sol_name>
    			 <mac_addr>00:16:35:c3:9b:ed</mac_addr>
    			 <bootproto>static</bootproto>
    			 <addr>
    				 <ipv4_addr>192.168.202.21</ipv4_addr>
    				 <ipv4_mask>255.255.255.0</ipv4_mask>
    				 <dnsname>cu011.dev.cubitdemo.net</dnsname>
    			 </addr>
    		 </interface>
    	</network>
    	</host>
    	
    		  <host version="2">
    	<name>cu012.dev.cubitdemo.net</name>
    	<alloc_user>yz</alloc_user>
    	<alloc_project>zork</alloc_project>
    	<hardware>
    			<vendor>CollabNet</vendor>
    			<modelname>HP DL380</modelname>
    			<ncpu>1</ncpu>
    			<cpuarch>i386</cpuarch>
    			<cpuname>Xeon</cpuname>
    			<cpumhz>1400</cpumhz>
    			<memsize unit="MB">2048</memsize>
    			<disksize unit="GB">144</disksize>
    	</hardware>
    	<labels>
    	  <label name='cfprofile' rev='322' version='4'>rhel3_all</label>
    		<label name='install_mode'>kickstart-net</label>
    	  <label name='cubit_state'>Allocated</label>
    	  <label name='cubit_alloc_time'>1170800012</label>
    	  <label name='cubit_state_mtime'>1170800012</label>
    	  <label name='cubit_build_time'>1169687903</label>
    	  <label name='cubit_project'>zork</label>
    	  <label name='cubit_user'>yz</label>
    	  <label name='vmware-server'/>
    	  <label name='cubit_lom_addr'>cu4-l.sjc.collab.net</label>
    	</labels>
    	<groups>
    	  <aigroup>DEFAULT</aigroup>
    	</groups>
    	<network>
    	  <routing>
    		<default>
    		  <ipv4_addr>192.168.202.1</ipv4_addr>
    		 </default>
    	  </routing>
    		 <interface>
    			 <name>eth0</name>
    			 <sol_name>e1000g0</sol_name>
    			 <mac_addr>00:16:35:5a:fe:39</mac_addr>
    			 <bootproto>static</bootproto>
    			 <addr>
    				 <ipv4_addr>192.168.202.22</ipv4_addr>
    				 <ipv4_mask>255.255.255.0</ipv4_mask>
    				 <dnsname>cu012.dev.cubitdemo.net</dnsname>
    			 </addr>
    		 </interface>
    	</network>
    	</host>
    	</project>
    	</domain>
    	</cubit>
    	
    	Here is a sample output where we query type=project and name=zork:
    	
    	<?xml version='1.0'?>
    	<cubit version='1'>
    	  <project name="zork">
    		  <host version="2">
    			<name>cu011.dev.cubitdemo.net</name>
    			<alloc_user>yz</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">yz</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host version="2">
    			<name>cu012.dev.cubitdemo.net</name>
    			<alloc_user>yz</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">yz</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host version="2">
    			<name>cu013.dev.cubitdemo.net</name>
    			<alloc_user>grue</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">grue</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host version="2">
    			<name>cu014.dev.cubitdemo.net</name>
    			<alloc_user>root</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">root</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host version="2">
    			<name>cu019.dev.cubitdemo.net</name>
    			<alloc_user>root</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">root</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host version="2">
    			<name>cu022.dev.cubitdemo.net</name>
    			<alloc_user>grue</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">grue</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    		  <host version="2">
    			<name>cu091.dev.cubitdemo.net</name>
    			<alloc_user>root</alloc_user>
    			<alloc_project>zork</alloc_project>
    			<labels>
    			  <label name="cubit_user">root</label>
    			  <label name="cubit_project">zork</label>
    			</labels>
    		  </host>
    	  </project>
    	</cubit>
    	
    	Here is a sample output where we query type=project, name=zork and
    	full=True:
    	
    	<?xml version='1.0'?>
    	<cubit version='1'>
    	  <project name="zork">
    		  <host version="2">
    	<name>cu011.dev.cubitdemo.net</name>
    	<alloc_user>yz</alloc_user>
    	<alloc_project>zork</alloc_project>
    	<hardware>
    			<vendor>CollabNet</vendor>
    			<modelname>HP DL380</modelname>
    			<ncpu>2</ncpu>
    			<cpuarch>i386</cpuarch>
    			<cpuname>Xeon</cpuname>
    			<cpumhz>1400</cpumhz>
    			<memsize unit="MB">2048</memsize>
    			<disksize unit="GB">144</disksize>
    	</hardware>
    	<labels>
    	  <label name='cfprofile' rev='322' version='4'>rhel3_base</label>
    		<label name='install_mode'>kickstart-net</label>
    	  <label name='cubit_state'>Allocated</label>
    	  <label name='cubit_alloc_time'>1170799967</label>
    	  <label name='cubit_state_mtime'>1170799967</label>
    	  <label name='cubit_build_time'>1169682748</label>
    	  <label name='cubit_project'>zork</label>
    	  <label name='cubit_user'>yz</label>
    	  <label name='vmware-server'/>
    	  <label name='cubit_lom_addr'>cu3-l.sjc.collab.net</label>
    	</labels>
    	<groups>
    	  <aigroup>DEFAULT</aigroup>
    	</groups>
    	<network>
    	  <routing>
    		<default>
    		  <ipv4_addr>192.168.202.1</ipv4_addr>
    		 </default>
    	  </routing>
    		 <interface>
    			 <name>eth0</name>
    			 <sol_name>e1000g0</sol_name>
    			 <mac_addr>00:16:35:c3:9b:ed</mac_addr>
    			 <bootproto>static</bootproto>
    			 <addr>
    				 <ipv4_addr>192.168.202.21</ipv4_addr>
    				 <ipv4_mask>255.255.255.0</ipv4_mask>
    				 <dnsname>cu011.dev.cubitdemo.net</dnsname>
    			 </addr>
    		 </interface>
    	</network>
    	</host>
    	
    		  <host version="2">
    	<name>cu012.dev.cubitdemo.net</name>
    	<alloc_user>yz</alloc_user>
    	<alloc_project>zork</alloc_project>
    	<hardware>
    			<vendor>CollabNet</vendor>
    			<modelname>HP DL380</modelname>
    			<ncpu>1</ncpu>
    			<cpuarch>i386</cpuarch>
    			<cpuname>Xeon</cpuname>
    			<cpumhz>1400</cpumhz>
    			<memsize unit="MB">2048</memsize>
    			<disksize unit="GB">144</disksize>
    	</hardware>
    	<labels>
    	  <label name='cfprofile' rev='322' version='4'>rhel3_all</label>
    		<label name='install_mode'>kickstart-net</label>
    	  <label name='cubit_state'>Allocated</label>
    	  <label name='cubit_alloc_time'>1170800012</label>
    	  <label name='cubit_state_mtime'>1170800012</label>
    	  <label name='cubit_build_time'>1169687903</label>
    	  <label name='cubit_project'>zork</label>
    	  <label name='cubit_user'>yz</label>
    	  <label name='vmware-server'/>
    	  <label name='cubit_lom_addr'>cu4-l.sjc.collab.net</label>
    	</labels>
    	<groups>
    	  <aigroup>DEFAULT</aigroup>
    	</groups>
    	<network>
    	  <routing>
    		<default>
    		  <ipv4_addr>192.168.202.1</ipv4_addr>
    		 </default>
    	  </routing>
    		 <interface>
    			 <name>eth0</name>
    			 <sol_name>e1000g0</sol_name>
    			 <mac_addr>00:16:35:5a:fe:39</mac_addr>
    			 <bootproto>static</bootproto>
    			 <addr>
    				 <ipv4_addr>192.168.202.22</ipv4_addr>
    				 <ipv4_mask>255.255.255.0</ipv4_mask>
    				 <dnsname>cu012.dev.cubitdemo.net</dnsname>
    			 </addr>
    		 </interface>
    	</network>
    	</host>
    	
    		  <host version="2">
    	<name>cu013.dev.cubitdemo.net</name>
    	<alloc_user>grue</alloc_user>
    	<alloc_project>zork</alloc_project>
    	<hardware>
    			<vendor>CollabNet</vendor>
    			<modelname>HP DL380</modelname>
    			<ncpu>1</ncpu>
    			<cpuarch>i386</cpuarch>
    			<cpuname>Xeon</cpuname>
    			<cpumhz>1400</cpumhz>
    			<memsize unit="MB">1024</memsize>
    			<disksize unit="GB">25</disksize>
    	</hardware>
    	<uuid>51 51 bb a0 00 15 15 51-81 9d fb 47 77 00 51 61</uuid>
    	<labels>
    	  <label name='cfprofile' rev='322' version='6'>rhel4_all</label>
    		<label name='install_mode'>kickstart-net</label>
    	  <label name='cubit_state'>Allocated</label>
    	  <label name='cubit_alloc_time'>1170960674</label>
    	  <label name='cubit_state_mtime'>1170963906</label>
    	  <label name='cubit_build_time'>1170963906</label>
    	  <label name='cubit_project'>zork</label>
    	  <label name='cubit_user'>grue</label>
    	  <label name='vmware-guest'>cu011.dev.cubitdemo.net</label>
    	  <label name='cubit_lom_addr'>cu011.dev.cubitdemo.net</label>
    	</labels>
    	<groups>
    	  <aigroup>DEFAULT</aigroup>
    	</groups>
    	<network>
    	  <routing>
    		<default>
    		  <ipv4_addr>192.168.202.1</ipv4_addr>
    		 </default>
    	  </routing>
    		 <interface>
    			 <name>eth0</name>
    			 <sol_name>e1000g0</sol_name>
    			 <mac_addr>00:50:56:00:00:01</mac_addr>
    			 <bootproto>static</bootproto>
    			 <addr>
    				 <ipv4_addr>192.168.202.23</ipv4_addr>
    				 <ipv4_mask>255.255.255.0</ipv4_mask>
    				 <dnsname>cu013.dev.cubitdemo.net</dnsname>
    			 </addr>
    		 </interface>
    	</network>
    	</host>
    	  </project>
    	</cubit>
    

    1.6. Response Codes

    • 200 - ok
    • 400 - Login failed / Insufficient permissions