Context fix
By setting the ssh key in the context section network information were overwritten. We use updateconf now
This commit is contained in:
		
					parent
					
						
							
								4c5cbe5bd9
							
						
					
				
			
			
				commit
				
					
						17a85e3831
					
				
			
		
					 1 changed files with 9 additions and 6 deletions
				
			
		|  | @ -154,10 +154,7 @@ class OpenNebulaManager(): | ||||||
|                                  <MEMORY>{memory}</MEMORY> |                                  <MEMORY>{memory}</MEMORY> | ||||||
|                                  <VCPU>{vcpu}</VCPU> |                                  <VCPU>{vcpu}</VCPU> | ||||||
|                                  <CPU>{cpu}</CPU> |                                  <CPU>{cpu}</CPU> | ||||||
|                                  <CONTEXT> |                              """ | ||||||
|                                   <SSH_PUBLIC_KEY>{ssh}</SSH_PUBLIC_KEY> |  | ||||||
|                                  </CONTEXT> |  | ||||||
|                            """ |  | ||||||
|         try: |         try: | ||||||
|             disk = template.template.disks[0] |             disk = template.template.disks[0] | ||||||
|             image_id = disk.image_id |             image_id = disk.image_id | ||||||
|  | @ -165,7 +162,6 @@ class OpenNebulaManager(): | ||||||
|                                         vcpu=int(specs['cpu']), |                                         vcpu=int(specs['cpu']), | ||||||
|                                         cpu=0.1* int(specs['cpu']), |                                         cpu=0.1* int(specs['cpu']), | ||||||
|                                         memory=1024 * int(specs['memory']), |                                         memory=1024 * int(specs['memory']), | ||||||
|                                         ssh=ssh_key |  | ||||||
|                      |                      | ||||||
|                     ) |                     ) | ||||||
|             vm_specs += """<DISK> |             vm_specs += """<DISK> | ||||||
|  | @ -187,7 +183,6 @@ class OpenNebulaManager(): | ||||||
|                                         vcpu=int(specs['cpu']), |                                         vcpu=int(specs['cpu']), | ||||||
|                                         cpu=0.1* int(specs['cpu']), |                                         cpu=0.1* int(specs['cpu']), | ||||||
|                                         memory=1024 * int(specs['memory']), |                                         memory=1024 * int(specs['memory']), | ||||||
|                                         ssh=ssh_key |  | ||||||
|                      |                      | ||||||
|                     ) |                     ) | ||||||
|             vm_specs += """<DISK> |             vm_specs += """<DISK> | ||||||
|  | @ -205,6 +200,14 @@ class OpenNebulaManager(): | ||||||
|                                     pending=False, |                                     pending=False, | ||||||
|                                     extra_template=vm_specs,                                    ) |                                     extra_template=vm_specs,                                    ) | ||||||
| 
 | 
 | ||||||
|  |         self.oneadmin_client.call( | ||||||
|  |             'vm.updateconf', | ||||||
|  |             vm_id, | ||||||
|  |             """<CONTEXT> | ||||||
|  |                 <SSH_PUBLIC_KEY>{ssh}</SSH_PUBLIC_KEY> | ||||||
|  |                </CONTEXT> | ||||||
|  |             """.format(ssh=ssh_key) | ||||||
|  |         )  | ||||||
|         try: |         try: | ||||||
|             self.oneadmin_client.call( |             self.oneadmin_client.call( | ||||||
|                 oca.VirtualMachine.METHODS['chown'], |                 oca.VirtualMachine.METHODS['chown'], | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue