Skip to contentSkip to conversation

support for remote migration

PATCH Michael Goldish 3 participants 4 messages May 4, 2009 – May 27, 2009 1 message not in the archive KVM

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

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.

Quoted 65 lines · ----- "yogi

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 = <localhost ip or name>
remoteip = <remote host ip or name> remuser = root
rempassword = <password>
qemu_path_dst = <qemu binary path on remote host> image_dir_dst = <images dir on remote host>

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.

Quoted 3 lines

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.

Quoted 2 lines

- 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.

Quoted 2 lines

- 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).

Quoted 1 line
Quoted 6 lines

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

#2 lore raw

Michael,
any updates on this patch? Are you going to commit this or you have any other plans/patch ?

Quoted 95 lines · Michael Goldish

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.

Quoted 65 lines · ----- "yogi

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 = <localhost ip or name>
        remoteip = <remote host ip or name> remuser = root
        rempassword = <password>
        qemu_path_dst = <qemu binary path on remote host> image_dir_dst = <images dir on remote host>

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.

Quoted 3 lines

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.

Quoted 2 lines

- 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.

Quoted 2 lines

- 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).

Quoted 1 line
Quoted 6 lines

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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Sudhir Kumar
#3 lore raw
Quoted 4 lines · sudhir kumar

Michael,
any updates on this patch? Are you going to commit this or you have any other plans/patch ?

I'm not sure having the inter-host migration is best implemented on the autotest-client side. Actually this is one of the few tests I think belong to the autotest-server side.

On the other hand it is pretty simple to implement it here. So I think we'd better try first implementing it as a server test, and apply it to the client side only as a second choice.

A few (minor) problems with it running on the client side:
1. We do not know what the other host is running (what version?, kvm-modules loaded? etc.)
2. There may be a conflict between a running local guest running on the remote (if it allowed to run tests while being a migration destination), and the remote guest.
3. There may be a conflict between two remote guests running a migration test on two different hosts.
3. get_free_ports run on the local machine, but expected/assumed to be free on the remote machine too.
4. For a migration to be successful, the image(s) must be shared by both hosts. On the other hand, when installing a guest OS (e.g. Fedora 8) on both hosts (let's assume they both are running fc8_quick) we want different images on different hosts.

These are all can be solved easily by non-trivial pretty simple configuration on the server. One can configure the "remote" migration to run as a separate tests to all other tests.

Regards,
Uri.

#4 lore raw
Quoted 10 lines · Uri Lublin
Quoted 5 lines · sudhir kumar

Michael,
any updates on this patch? Are you going to commit this or you have any other plans/patch ?

I'm not sure having the inter-host migration is best implemented on the autotest-client side. Actually this is one of the few tests I think belong to the autotest-server side.

This one was a minimal and the first point implementation. I am not much expert in the server side. I will look into the code and design of the server.

Quoted 11 lines

On the other hand it is pretty simple to implement it here. So I think we'd better try first implementing it as a server test, and apply it to the client side only as a second choice.

A few (minor) problems with it running on the client side:
1. We do not know what the other host is running (what version?, kvm-modules loaded? etc.)
2. There may be a conflict between a running local guest running on the remote (if it allowed to run tests while being a migration destination), and the remote guest.

Yes, especially in case of parallel job execution. This is imp to be handeled.

Quoted 2 lines

3. There may be a conflict between two remote guests running a migration test on two different hosts.

So you mean the server will enquire about this event if implemented using autotest server?

Quoted 6 lines

3. get_free_ports run on the local machine, but expected/assumed to be free on the remote machine too.
4. For a migration to be successful, the image(s) must be shared by both hosts. On the other hand, when installing a guest OS (e.g. Fedora 8) on both hosts (let's assume they both are running fc8_quick) we want different images on different hosts.

This may be true only when the autoserver is running multiple parallel jobs. Though less likely that one would like to run 2 instances of same installation. However still this is a case.

Quoted 5 lines

These are all can be solved easily by non-trivial pretty simple configuration on the server. One can configure the "remote" migration to run as a separate tests to all other tests.

I feel Virtmanager also will be taking care of such scenarios. Any idea how do they handle it or they just leave it to the user?

Quoted 6 lines

Regards,
   Uri.

Thanks for your comments.

Signature · 1 line
Sudhir Kumar