diff mbox

Assign an UUID for each VM in kvm command line

Message ID 1247649149-28353-1-git-send-email-yzhou@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yolkfull Chow July 15, 2009, 9:12 a.m. UTC
Would submit this patch which is from our internal kvm-autotest patches submitted by Jason.
So that we could go on test case about parameters verification(UUID, DMI data etc).

Signed-off-by: Yolkfull Chow <yzhou@redhat.com>
---
 client/tests/kvm/kvm_vm.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Dor Laor July 15, 2009, 1:36 p.m. UTC | #1
On 07/15/2009 12:12 PM, Yolkfull Chow wrote:
> Would submit this patch which is from our internal kvm-autotest patches submitted by Jason.
> So that we could go on test case about parameters verification(UUID, DMI data etc).
>
> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
> ---
>   client/tests/kvm/kvm_vm.py |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
> index 503f636..68cc235 100644
> --- a/client/tests/kvm/kvm_vm.py
> +++ b/client/tests/kvm/kvm_vm.py
> @@ -287,6 +287,10 @@ class VM:
>           elif params.get("display") == "nographic":
>               qemu_cmd += " -nographic"
>
> +        uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline().strip()
> +        if uuid:
> +            qemu_cmd += " -uuid %s" % uuid

If you'll change the uuid on every run, the guest will notice that. Some 
guest (M$) might not love it.
Why not use a static uuid or even just test uuid in a specific test 
without having it in all tests?

btw: why you're at it, please add uuid to the block devices too.
+ the -smbios option.

Thanks,
dor

> +
>           return qemu_cmd
>
>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yolkfull Chow July 16, 2009, 2:42 a.m. UTC | #2
On 07/15/2009 09:36 PM, Dor Laor wrote:
> On 07/15/2009 12:12 PM, Yolkfull Chow wrote:
>> Would submit this patch which is from our internal kvm-autotest 
>> patches submitted by Jason.
>> So that we could go on test case about parameters verification(UUID, 
>> DMI data etc).
>>
>> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
>> ---
>>   client/tests/kvm/kvm_vm.py |    4 ++++
>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>> index 503f636..68cc235 100644
>> --- a/client/tests/kvm/kvm_vm.py
>> +++ b/client/tests/kvm/kvm_vm.py
>> @@ -287,6 +287,10 @@ class VM:
>>           elif params.get("display") == "nographic":
>>               qemu_cmd += " -nographic"
>>
>> +        uuid = os.popen("cat 
>> /proc/sys/kernel/random/uuid").readline().strip()
>> +        if uuid:
>> +            qemu_cmd += " -uuid %s" % uuid
>
> If you'll change the uuid on every run, the guest will notice that. 
> Some guest (M$) might not love it.
> Why not use a static uuid or even just test uuid in a specific test 
> without having it in all tests?
Hi Dor, since we cannot use a static uuid for running stress_boot test, 
but just assign UUID in a specific test is a good idea. We could use an 
option like assign_uuid = yes for that specific test?
>
> btw: why you're at it, please add uuid to the block devices too.
> + the -smbios option.
Do you mean assign serial number for block devices?

Thanks for suggestions. :)
>
> Thanks,
> dor
>
>> +
>>           return qemu_cmd
>>
>>
>
sudhir kumar July 16, 2009, 4:11 a.m. UTC | #3
On Thu, Jul 16, 2009 at 8:12 AM, Yolkfull Chow<yzhou@redhat.com> wrote:
> On 07/15/2009 09:36 PM, Dor Laor wrote:
>> On 07/15/2009 12:12 PM, Yolkfull Chow wrote:
>>> Would submit this patch which is from our internal kvm-autotest
>>> patches submitted by Jason.
>>> So that we could go on test case about parameters verification(UUID,
>>> DMI data etc).
>>>
>>> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
>>> ---
>>>   client/tests/kvm/kvm_vm.py |    4 ++++
>>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>>> index 503f636..68cc235 100644
>>> --- a/client/tests/kvm/kvm_vm.py
>>> +++ b/client/tests/kvm/kvm_vm.py
>>> @@ -287,6 +287,10 @@ class VM:
>>>           elif params.get("display") == "nographic":
>>>               qemu_cmd += " -nographic"
>>>
>>> +        uuid = os.popen("cat
>>> /proc/sys/kernel/random/uuid").readline().strip()
>>> +        if uuid:
>>> +            qemu_cmd += " -uuid %s" % uuid
>>
>> If you'll change the uuid on every run, the guest will notice that.
>> Some guest (M$) might not love it.
>> Why not use a static uuid or even just test uuid in a specific test
>> without having it in all tests?
> Hi Dor, since we cannot use a static uuid for running stress_boot test,
> but just assign UUID in a specific test is a good idea. We could use an
> option like assign_uuid = yes for that specific test?

This will be far better and more flexible.
>>
>> btw: why you're at it, please add uuid to the block devices too.
>> + the -smbios option.
> Do you mean assign serial number for block devices?
>
> Thanks for suggestions. :)
>>
>> Thanks,
>> dor
>>
>>> +
>>>           return qemu_cmd
>>>
>>>
>>
>
>
> --
> Yolkfull
> Regards,
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
Michael Goldish July 16, 2009, 8:27 a.m. UTC | #4
----- "sudhir kumar" <smalikphy@gmail.com> wrote:

> On Thu, Jul 16, 2009 at 8:12 AM, Yolkfull Chow<yzhou@redhat.com>
> wrote:
> > On 07/15/2009 09:36 PM, Dor Laor wrote:
> >> On 07/15/2009 12:12 PM, Yolkfull Chow wrote:
> >>> Would submit this patch which is from our internal kvm-autotest
> >>> patches submitted by Jason.
> >>> So that we could go on test case about parameters
> verification(UUID,
> >>> DMI data etc).
> >>>
> >>> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
> >>> ---
> >>>   client/tests/kvm/kvm_vm.py |    4 ++++
> >>>   1 files changed, 4 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/client/tests/kvm/kvm_vm.py
> b/client/tests/kvm/kvm_vm.py
> >>> index 503f636..68cc235 100644
> >>> --- a/client/tests/kvm/kvm_vm.py
> >>> +++ b/client/tests/kvm/kvm_vm.py
> >>> @@ -287,6 +287,10 @@ class VM:
> >>>           elif params.get("display") == "nographic":
> >>>               qemu_cmd += " -nographic"
> >>>
> >>> +        uuid = os.popen("cat
> >>> /proc/sys/kernel/random/uuid").readline().strip()
> >>> +        if uuid:
> >>> +            qemu_cmd += " -uuid %s" % uuid
> >>
> >> If you'll change the uuid on every run, the guest will notice
> that.
> >> Some guest (M$) might not love it.
> >> Why not use a static uuid or even just test uuid in a specific
> test
> >> without having it in all tests?
> > Hi Dor, since we cannot use a static uuid for running stress_boot
> test,
> > but just assign UUID in a specific test is a good idea. We could use
> an
> > option like assign_uuid = yes for that specific test?
> 
> This will be far better and more flexible.

Why not allow both static:

uuid = 7032808e-7d90-4921-b95d-fa0e11c9659c

and random:

uuid = random

If uuid == random, VM.create() will generate a random one. Otherwise
it will use the one given.

BTW, the code that generates a random uuid should be in VM.create(),
not in VM.make_qemu_command(). VM.make_qemu_command() should be
deterministic. VM.create() should store the uuid in an attribute
(e.g. self.uuid = ...) and then VM.make_qemu_command() should use this
attribute. This is important because we use VM.make_qemu_command() to
see if the VM needs to be restarted, and if the uuid changes every time
VM.make_qemu_command() is called, the VM will always be restarted,
even if no parameters change.
(When running a test, we normally use the existing VM without killing
and restarting it; we restart only if the qemu command of the new test
is different, or if the user explicitly requested a restart via the
config file.)

> >> btw: why you're at it, please add uuid to the block devices too.
> >> + the -smbios option.
> > Do you mean assign serial number for block devices?
> >
> > Thanks for suggestions. :)
> >>
> >> Thanks,
> >> dor
> >>
> >>> +
> >>>           return qemu_cmd
> >>>
> >>>
> >>
> >
> >
> > --
> > Yolkfull
> > Regards,
> >
> > _______________________________________________
> > Autotest mailing list
> > Autotest@test.kernel.org
> > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
> >
> 
> 
> 
> -- 
> Sudhir Kumar
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 503f636..68cc235 100644
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -287,6 +287,10 @@  class VM:
         elif params.get("display") == "nographic":
             qemu_cmd += " -nographic"
 
+        uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline().strip()
+        if uuid:
+            qemu_cmd += " -uuid %s" % uuid
+
         return qemu_cmd