diff mbox

[KVM-AUTOTEST,16/17] KVM test: initialize some VM attributes in __init__() to prevent trouble

Message ID cf24e72b5a5181ec9464906105957f5d44323336.1248102188.git.mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish July 20, 2009, 3:07 p.m. UTC
'redirs' and 'vnc_port' might be used before they're defined, if
make_qemu_command() is called before create().  To make sure this doesn't
happen, define them in the VM constructor.

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/kvm_vm.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Lucas Meneghel Rodrigues July 27, 2009, 1:34 p.m. UTC | #1
On Mon, Jul 20, 2009 at 12:07 PM, Michael Goldish<mgoldish@redhat.com> wrote:
> 'redirs' and 'vnc_port' might be used before they're defined, if
> make_qemu_command() is called before create().  To make sure this doesn't
> happen, define them in the VM constructor.

Applied.

> Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> ---
>  client/tests/kvm/kvm_vm.py |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
> index 8bc2403..d96b359 100644
> --- a/client/tests/kvm/kvm_vm.py
> +++ b/client/tests/kvm/kvm_vm.py
> @@ -112,6 +112,8 @@ class VM:
>         @param iso_dir: The directory where ISOs reside
>         """
>         self.process = None
> +        self.redirs = {}
> +        self.vnc_port = 5900
>         self.uuid = None
>
>         self.name = name
> --
> 1.5.4.1
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 8bc2403..d96b359 100644
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -112,6 +112,8 @@  class VM:
         @param iso_dir: The directory where ISOs reside
         """
         self.process = None
+        self.redirs = {}
+        self.vnc_port = 5900
         self.uuid = None
 
         self.name = name