def guestagent(self, vm_address, password=None): """ install guestagent on a vm """ ip = vm_address if password is None: password = '******' try: paramiko_vm = Host(ip, password) except Exception: print "ssh session failed on %s" % (ip) return 1 src_1 = "%s/guest.sh" % (self.path) dst_1 = "/root/guest.sh" install_guest_agent = "sh /root/guest.sh" paramiko_vm.put_file(src_1, dst_1) try: paramiko_vm.run_bash_command(install_guest_agent) except Exception as e: print e return 1 print "guestagent has been deployed" return 0
def ini_host(self, host, os_dest, os_info): password = self.collect_params(host.get_name(), 'hypervisors')['password'] remote_host = Host(host.get_address(), password) if not remote_host.has_file(os_info['kernel']): remote_host.wget_file(os_dest['kernel'], os_info['kernel']) sleep(5) remote_host.wget_file(os_dest['initrd'], os_info['initrd']) sleep(5)