From: Michael Goldish Subject: Re: [KVM-AUTOTEST] [PATCH] support for remote migration Date: Mon, 4 May 2009 15:42:46 -0400 (EDT) Message-ID: <1473872622.90691241466166259.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> References: <796594249.90621241466107981.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Uri Lublin , kvm@vger.kernel.org To: yogi Return-path: Received: from mx1.redhat.com ([66.187.233.31]:43368 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752359AbZEDTms (ORCPT ); Mon, 4 May 2009 15:42:48 -0400 In-Reply-To: <796594249.90621241466107981.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Thanks for the new patch. I'll comment on it later because I want to take some more time to review it. The login prompt problem is my fault -- please see my comment below. ----- "yogi" wrote: > Hello everyone, > > I like to resubmit patch to add support for "remote migration" in > kvm-autotest, based on Michael Goldish's suggestions. > > To use this patch the following seven parameters should be added to > the > existing migration test > > remote_dst = yes > hostip = > remoteip = > remuser = root > rempassword = > qemu_path_dst = > image_dir_dst = > > > For example: > - migrate: install setup > type = migration > vms += " dst" > migration_test_command = help > kill_vm_on_error = yes > hostip = 192.168.1.2 > remoteip = 192.168.1.3 > remuser = root > rempassword = 123456 > remote_dst = yes > qemu_path_dst = /tmp/kvm_autotest_root/qemu > image_dir_dst = /tmp/kvm_autotest_root/images > > variants: > > The parameter "remote_dst = yes", indicates that the VM "dst" should > be > started on the remote host.If the parameter qemu_path_dst and > image_dir_dst, it is assumed tht the qemu binary images path is same > on > both local and remote host. > > > Regarding remote_login: > > > > - Why should remote_login return a session when it gets an > unexpected login prompt? If you get a login prompt doesn't that mean > something went wrong? The username is always provided in the ssh > command line, so we shouldn't expect to receive a login prompt -- or > am I missing something? I am pretty confident this is true in the > general case, but maybe it's different when ssh keys have been > exchanged between the hosts. > > > > - I think it makes little sense to return a session object when you > see a login prompt because that session will be useless. You can't > send any commands to it because you don't have a shell prompt yet. Any > command you send will be interpreted as a username, and will most > likely be the wrong username. > > > > - When a guest is in the process of booting and we try to log into > it, remote_login sometimes fails because it gets an unexpected login > prompt. This is good, as far as I understand, because it means the > guest isn't ready yet (still booting). The next time remote_login > attempts to log in, it usually succeeds. If we consider an unexpected > login prompt OK, we pass login attempts that actually should have > failed (and the resulting sessions will be useless anyway). > > > I have removed this from the current patch, so now the remote_login > function is unchanged.I will recheck my machine configuration and > submit > it as new patch if necessary. I had exchanged ssh keys between the > hosts(both local and remote hosts), but the login sessions seem to > terminates with "Got unexpected login prompt". It seems the problem is caused by a "loose" regular expression in kvm_utils.remote_login(). In the list of parameters to read_until_last_line_matches, you'll find something like "[Ll]ogin:". I put it there to match the telnet login prompt which indicates failure, but it also matches the "Last login: Mon May 4 ... from ..." line, which appears when SSH login succeeds. This regex should be made stricter, e.g. r"^[Ll]ogin:\s*$", which means it must appear at the beginning of the line, and must be followed by nothing other than whitespace characters. I'll commit a fix, which will also make the other regex's stricter as well, but it won't appear in the public repository until Uri comes back from vacation. Thanks, Michael