Skip to contentSkip to conversation

support for remote migration

PATCH In review Michael Goldish 3 participants 4 messages May 25, 2009 – Jun 8, 2009 1 message not in the archive KVM

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1818401549.327921243244441830.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com

#1 lore raw
Quoted 3 lines · ----- "sudhir kumar

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

Currently we don't have a patch for remote migration other than yogi's. We would, however, like to take some time to think about it, because it might be a better idea to implement it as two tests ('migration_source' and 'migration_dest') that are synchronized by the server. This way we won't have to deal with remote VM objects in the framework.

If the server idea turns out to be infeasible then yogi's patch looks like the way to go (assuming it gets some testing to make sure it doesn't break anything).

Quoted 122 lines
Quoted 1 line · Michael Goldish

Thanks for the new patch. I'll comment on it later because I want to

take some more time to review it.

Quoted 2 lines

The login prompt problem is my fault -- please see my comment

below.

Quoted 9 lines
Quoted 6 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

Quoted 26 lines
Quoted 26 lines

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

Quoted 3 lines
Quoted 3 lines

        variants:

The parameter "remote_dst = yes", indicates that the VM "dst"

should

Quoted 3 lines
Quoted 3 lines

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

Quoted 7 lines
Quoted 7 lines

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

Quoted 2 lines
Quoted 2 lines

something went wrong? The username is always provided in the ssh command line, so we shouldn't expect to receive a login prompt --

or

Quoted 5 lines
Quoted 5 lines

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

Quoted 2 lines
Quoted 2 lines

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

Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line

it, remote_login sometimes fails because it gets an unexpected

login

Quoted 3 lines
Quoted 3 lines

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

Quoted 4 lines
Quoted 4 lines

login prompt OK, we pass login attempts that actually should have failed (and the resulting sessions will be useless anyway).

Quoted 1 line

I have removed this from the current patch, so now the

remote_login

Quoted 7 lines
Quoted 5 lines

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

Quoted 1 line

In the list of parameters to read_until_last_line_matches, you'll

find something like "[Ll]ogin:".

Quoted 1 line

I put it there to match the telnet login prompt which indicates

failure, but it also matches the

Quoted 1 line

"Last login: Mon May 4 ... from ..." line, which appears when SSH

login succeeds.

Quoted 1 line

This regex should be made stricter, e.g. r"^[Ll]ogin:\s*$", which

means it must appear at the beginning

Quoted 1 line

of the line, and must be followed by nothing other than whitespace

characters.

Quoted 2 lines

I'll commit a fix, which will also make the other regex's stricter

as well, but it won't appear in the

Quoted 9 lines

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
#2 lore raw

PATCH 1/1 fix a little problem for kvm_config.py

Hi Everyone:

I would submit a little patch for kvm_config.py. Since I found if a string contains a pair of '"' or "'", and one of the pair is at the end of the string, such as: 'systeminfo^ | find "Memory"' ( which is used to catch memory of windows ), the quotation mark at the end of the string will be stripped whereas another will not. That is to say, if we use only this clause : temp[i] = temp[i].strip("\"\'") , the string above will be stripped to be: systeminfo^ | find "Memory . So I would suggest we only strip the quotation marks that existing at both the beginning and the end of the string. Any comments/criticism will be high appreciated.

Thanks & Regards,
Yingfu

----------------------------------------------------------------------------------------------------------------------------------------

client/tests/kvm_runtest_2/kvm_config.py +4 -1
index 4a1e7b4..dd43bd1 100755
@@ -97,7 +97,10 @@ class config:
         temp = str.split(sep)
         for i in range(len(temp)):
             temp[i] = temp[i].strip()
-            temp[i] = temp[i].strip("\"\'")
+            if re.findall("^\".*\"$", temp[i]):
+                temp[i] = temp[i].strip("\"")
+            elif re.findall("^\'.*\'$", temp[i]):
+                temp[i] = temp[i].strip("\'")
         return temp
#3 lore raw

Re: [KVM-AUTOTEST] [PATCH] fix a little problem for kvm_config.py

Looks good to me -- thanks.

----- Original Message -----
From: "Yolkfull Chow" <[email protected]>
To: [email protected]
Cc: "sudhir kumar" <[email protected]>, "yogi" <[email protected]>, "Uri Lublin" <[email protected]>, [email protected]
Sent: Tuesday, May 26, 2009 5:35:35 AM (GMT+0200) Auto-Detected
Subject: [KVM-AUTOTEST] [PATCH] fix a little problem for kvm_config.py

Hi Everyone:

I would submit a little patch for kvm_config.py. Since I found if a string contains a pair of '"' or "'", and one of the pair is at the end of the string, such as: 'systeminfo^ | find "Memory"' ( which is used to catch memory of windows ), the quotation mark at the end of the string will be stripped whereas another will not. That is to say, if we

use only this clause :  temp[i] = temp[i].strip("\"\'")  ,  the string 
above will be stripped to be:  systeminfo^ | find "Memory  .

So I would suggest we only strip the quotation marks that existing at both the beginning and the end of the string. Any comments/criticism will be high appreciated.

Thanks & Regards,
Yingfu

----------------------------------------------------------------------------------------------------------------------------------------

(quoted diff) +0 -0

b/client/tests/kvm_runtest_2/kvm_config.py
index 4a1e7b4..dd43bd1 100755

client/tests/kvm_runtest_2/kvm_config.py +4 -2
@@ -97,7 +97,10 @@ class config:
          temp = str.split(sep)
          for i in range(len(temp)):
              temp[i] = temp[i].strip()
-            temp[i] = temp[i].strip("\"\'")
+            if re.findall("^\".*\"$", temp[i]):
+                temp[i] = temp[i].strip("\"")
+            elif re.findall("^\'.*\'$", temp[i]):
+                temp[i] = temp[i].strip("\'")
          return temp
--

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

#4 lore raw
In reply to Michael Goldish

Thanks for the feedback.
Please provide your thoughts or RFC so that we can start a discussion to implement this feature.
Meanwhile I will request you to give a try to this patch. I tested the patch once and found that setting the qemu path in the config is not as good. We can do it in the same way as we do for a normal VM creation assuming the kvm-autotest is installed on the remote under the same directory tree as in the source. I will test it further and provide my feedback.

Quoted 140 lines · Michael Goldish
Quoted 3 lines · ----- "sudhir kumar

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

Currently we don't have a patch for remote migration other than yogi's. We would, however, like to take some time to think about it, because it might be a better idea to implement it as two tests ('migration_source' and 'migration_dest') that are synchronized by the server. This way we won't have to deal with remote VM objects in the framework.

If the server idea turns out to be infeasible then yogi's patch looks like the way to go (assuming it gets some testing to make sure it doesn't break anything).

Quoted 122 lines
Quoted 1 line · Michael Goldish

Thanks for the new patch. I'll comment on it later because I want to

take some more time to review it.

Quoted 2 lines

The login prompt problem is my fault -- please see my comment

below.

Quoted 9 lines
Quoted 6 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

Quoted 26 lines
Quoted 26 lines

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

Quoted 3 lines
Quoted 3 lines

        variants:

The parameter "remote_dst = yes", indicates that the VM "dst"

should

Quoted 3 lines
Quoted 3 lines

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

Quoted 7 lines
Quoted 7 lines

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

Quoted 2 lines
Quoted 2 lines

something went wrong? The username is always provided in the ssh command line, so we shouldn't expect to receive a login prompt --

or

Quoted 5 lines
Quoted 5 lines

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

Quoted 2 lines
Quoted 2 lines

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

Quoted 4 lines
Quoted 4 lines

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

Quoted 1 line
Quoted 1 line

it, remote_login sometimes fails because it gets an unexpected

login

Quoted 3 lines
Quoted 3 lines

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

Quoted 4 lines
Quoted 4 lines

login prompt OK, we pass login attempts that actually should have failed (and the resulting sessions will be useless anyway).

Quoted 1 line

I have removed this from the current patch, so now the

remote_login

Quoted 7 lines
Quoted 5 lines

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

Quoted 1 line

In the list of parameters to read_until_last_line_matches, you'll

find something like "[Ll]ogin:".

Quoted 1 line

I put it there to match the telnet login prompt which indicates

failure, but it also matches the

Quoted 1 line

"Last login: Mon May 4 ... from ..." line, which appears when SSH

login succeeds.

Quoted 1 line

This regex should be made stricter, e.g. r"^[Ll]ogin:\s*$", which

means it must appear at the beginning

Quoted 1 line

of the line, and must be followed by nothing other than whitespace

characters.

Quoted 2 lines

I'll commit a fix, which will also make the other regex's stricter

as well, but it won't appear in the

Quoted 9 lines

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

--
Sudhir Kumar

Signature · 1 line
Sudhir Kumar