diff mbox

Specify the system UUID for VM

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

Commit Message

Yolkfull Chow July 16, 2009, 10:26 a.m. UTC
Signed-off-by: Yolkfull Chow <yzhou@redhat.com>
---
 client/tests/kvm/kvm_vm.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Comments

Yolkfull Chow July 16, 2009, 11:54 a.m. UTC | #1
On Thu, Jul 16, 2009 at 06:26:46PM +0800, Yolkfull Chow wrote:
> 
> Signed-off-by: Yolkfull Chow <yzhou@redhat.com>
> ---
>  client/tests/kvm/kvm_vm.py |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
> index 503f636..895049e 100644
> --- a/client/tests/kvm/kvm_vm.py
> +++ b/client/tests/kvm/kvm_vm.py
> @@ -113,6 +113,13 @@ class VM:
>          self.qemu_path = qemu_path
>          self.image_dir = image_dir
>          self.iso_dir = iso_dir
> +        
> +        if params.get("uuid"):
> +            if params.get("uuid") == "random":
> +                uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline()
> +                self.uuid = uuid.strip()
> +            else:
> +                self.uuid = params.get("uuid")

Sorry, forgot to initialize self.uuid.  Will resend the patch. 

>  
>  
>          # Find available monitor filename
> @@ -374,6 +381,10 @@ class VM:
>              # Make qemu command
>              qemu_command = self.make_qemu_command()
>  
> +            # Specify the system UUID
> +            if self.uuid:
> +                qemu_command += " -uuid %s" % self.uuid
> +
>              # Is this VM supposed to accept incoming migrations?
>              if for_migration:
>                  # Find available migration port
> -- 
> 1.6.2.5
> 
--
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
Avi Kivity July 29, 2009, 12:18 p.m. UTC | #2
On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
> ---
>   client/tests/kvm/kvm_vm.py |   11 +++++++++++
>   1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
> index 503f636..895049e 100644
> --- a/client/tests/kvm/kvm_vm.py
> +++ b/client/tests/kvm/kvm_vm.py
> @@ -113,6 +113,13 @@ class VM:
>           self.qemu_path = qemu_path
>           self.image_dir = image_dir
>           self.iso_dir = iso_dir
> +
> +        if params.get("uuid"):
> +            if params.get("uuid") == "random":
> +                uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline()
> +                self.uuid = uuid.strip()
>    

instead of os.popen("cat ..."), you can open the file directly:

    uuid = file('/proc/.../uuid').readline()
Lucas Meneghel Rodrigues July 29, 2009, 12:36 p.m. UTC | #3
On Wed, Jul 29, 2009 at 9:18 AM, Avi Kivity<avi@redhat.com> wrote:
> On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
>>
>> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
>> ---
>>  client/tests/kvm/kvm_vm.py |   11 +++++++++++
>>  1 files changed, 11 insertions(+), 0 deletions(-)
>>
>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>> index 503f636..895049e 100644
>> --- a/client/tests/kvm/kvm_vm.py
>> +++ b/client/tests/kvm/kvm_vm.py
>> @@ -113,6 +113,13 @@ class VM:
>>          self.qemu_path = qemu_path
>>          self.image_dir = image_dir
>>          self.iso_dir = iso_dir
>> +
>> +        if params.get("uuid"):
>> +            if params.get("uuid") == "random":
>> +                uuid = os.popen("cat
>> /proc/sys/kernel/random/uuid").readline()
>> +                self.uuid = uuid.strip()
>>
>
> instead of os.popen("cat ..."), you can open the file directly:
>
>   uuid = file('/proc/.../uuid').readline()

Oooops... I didn't notice this little issue. Will make a quick patch
to change it, thanks Avi!
--
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
Lucas Meneghel Rodrigues July 29, 2009, 12:46 p.m. UTC | #4
On Wed, Jul 29, 2009 at 9:36 AM, Lucas Meneghel Rodrigues<lmr@redhat.com> wrote:
> On Wed, Jul 29, 2009 at 9:18 AM, Avi Kivity<avi@redhat.com> wrote:
>> On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
>>>
>>> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
>>> ---
>>>  client/tests/kvm/kvm_vm.py |   11 +++++++++++
>>>  1 files changed, 11 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>>> index 503f636..895049e 100644
>>> --- a/client/tests/kvm/kvm_vm.py
>>> +++ b/client/tests/kvm/kvm_vm.py
>>> @@ -113,6 +113,13 @@ class VM:
>>>          self.qemu_path = qemu_path
>>>          self.image_dir = image_dir
>>>          self.iso_dir = iso_dir
>>> +
>>> +        if params.get("uuid"):
>>> +            if params.get("uuid") == "random":
>>> +                uuid = os.popen("cat
>>> /proc/sys/kernel/random/uuid").readline()
>>> +                self.uuid = uuid.strip()
>>>
>>
>> instead of os.popen("cat ..."), you can open the file directly:
>>
>>   uuid = file('/proc/.../uuid').readline()
>
> Oooops... I didn't notice this little issue. Will make a quick patch
> to change it, thanks Avi!

Hmm, turns out we've had sorted this out during the review process of
this particular patch. The version that got in reads the file directly
:)
--
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
Michael Goldish July 29, 2009, 12:46 p.m. UTC | #5
----- "Lucas Meneghel Rodrigues" <lmr@redhat.com> wrote:

> On Wed, Jul 29, 2009 at 9:18 AM, Avi Kivity<avi@redhat.com> wrote:
> > On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
> >>
> >> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
> >> ---
> >>  client/tests/kvm/kvm_vm.py |   11 +++++++++++
> >>  1 files changed, 11 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/client/tests/kvm/kvm_vm.py
> b/client/tests/kvm/kvm_vm.py
> >> index 503f636..895049e 100644
> >> --- a/client/tests/kvm/kvm_vm.py
> >> +++ b/client/tests/kvm/kvm_vm.py
> >> @@ -113,6 +113,13 @@ class VM:
> >>          self.qemu_path = qemu_path
> >>          self.image_dir = image_dir
> >>          self.iso_dir = iso_dir
> >> +
> >> +        if params.get("uuid"):
> >> +            if params.get("uuid") == "random":
> >> +                uuid = os.popen("cat
> >> /proc/sys/kernel/random/uuid").readline()
> >> +                self.uuid = uuid.strip()
> >>
> >
> > instead of os.popen("cat ..."), you can open the file directly:
> >
> >   uuid = file('/proc/.../uuid').readline()
> 
> Oooops... I didn't notice this little issue. Will make a quick patch
> to change it, thanks Avi!

I think I already commented on this and Yolkfull posted a new patch,
and that patch is the one that got applied.  That's what I see in my
local tree anyway.

> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
--
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
Lucas Meneghel Rodrigues July 29, 2009, 12:48 p.m. UTC | #6
On Wed, Jul 29, 2009 at 9:46 AM, Michael Goldish<mgoldish@redhat.com> wrote:
>
> ----- "Lucas Meneghel Rodrigues" <lmr@redhat.com> wrote:
>
>> On Wed, Jul 29, 2009 at 9:18 AM, Avi Kivity<avi@redhat.com> wrote:
>> > On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
>> >>
>> >> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
>> >> ---
>> >>  client/tests/kvm/kvm_vm.py |   11 +++++++++++
>> >>  1 files changed, 11 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/client/tests/kvm/kvm_vm.py
>> b/client/tests/kvm/kvm_vm.py
>> >> index 503f636..895049e 100644
>> >> --- a/client/tests/kvm/kvm_vm.py
>> >> +++ b/client/tests/kvm/kvm_vm.py
>> >> @@ -113,6 +113,13 @@ class VM:
>> >>          self.qemu_path = qemu_path
>> >>          self.image_dir = image_dir
>> >>          self.iso_dir = iso_dir
>> >> +
>> >> +        if params.get("uuid"):
>> >> +            if params.get("uuid") == "random":
>> >> +                uuid = os.popen("cat
>> >> /proc/sys/kernel/random/uuid").readline()
>> >> +                self.uuid = uuid.strip()
>> >>
>> >
>> > instead of os.popen("cat ..."), you can open the file directly:
>> >
>> >   uuid = file('/proc/.../uuid').readline()
>>
>> Oooops... I didn't notice this little issue. Will make a quick patch
>> to change it, thanks Avi!
>
> I think I already commented on this and Yolkfull posted a new patch,
> and that patch is the one that got applied.  That's what I see in my
> local tree anyway.

Yep, I over-reacted :)
--
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
Avi Kivity July 29, 2009, 1:03 p.m. UTC | #7
On 07/29/2009 03:46 PM, Michael Goldish wrote:
> I think I already commented on this and Yolkfull posted a new patch,
> and that patch is the one that got applied.  That's what I see in my
> local tree anyway.
>    

Yeah, I have a long backlog (and don't read all autotest patches 
anyway).  Sorry about the noise.
Yolkfull Chow July 29, 2009, 1:06 p.m. UTC | #8
On Wed, Jul 29, 2009 at 03:18:51PM +0300, Avi Kivity wrote:
> On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
>> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
>> ---
>>   client/tests/kvm/kvm_vm.py |   11 +++++++++++
>>   1 files changed, 11 insertions(+), 0 deletions(-)
>>
>> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
>> index 503f636..895049e 100644
>> --- a/client/tests/kvm/kvm_vm.py
>> +++ b/client/tests/kvm/kvm_vm.py
>> @@ -113,6 +113,13 @@ class VM:
>>           self.qemu_path = qemu_path
>>           self.image_dir = image_dir
>>           self.iso_dir = iso_dir
>> +
>> +        if params.get("uuid"):
>> +            if params.get("uuid") == "random":
>> +                uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline()
>> +                self.uuid = uuid.strip()
>>    
>
> instead of os.popen("cat ..."), you can open the file directly:
>
>    uuid = file('/proc/.../uuid').readline()

Yes, Lucas also suggested this method as well. Since the patch has been applied, need I submit a
little patch for this? 
Thanks for suggestion. :-)

>
> -- 
> error compiling committee.c: too many arguments to function
>
> --
> 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
Yolkfull Chow July 29, 2009, 1:25 p.m. UTC | #9
On Wed, Jul 29, 2009 at 09:06:25PM +0800, Yolkfull Chow wrote:
> On Wed, Jul 29, 2009 at 03:18:51PM +0300, Avi Kivity wrote:
> > On 07/16/2009 01:26 PM, Yolkfull Chow wrote:
> >> Signed-off-by: Yolkfull Chow<yzhou@redhat.com>
> >> ---
> >>   client/tests/kvm/kvm_vm.py |   11 +++++++++++
> >>   1 files changed, 11 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
> >> index 503f636..895049e 100644
> >> --- a/client/tests/kvm/kvm_vm.py
> >> +++ b/client/tests/kvm/kvm_vm.py
> >> @@ -113,6 +113,13 @@ class VM:
> >>           self.qemu_path = qemu_path
> >>           self.image_dir = image_dir
> >>           self.iso_dir = iso_dir
> >> +
> >> +        if params.get("uuid"):
> >> +            if params.get("uuid") == "random":
> >> +                uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline()
> >> +                self.uuid = uuid.strip()
> >>    
> >
> > instead of os.popen("cat ..."), you can open the file directly:
> >
> >    uuid = file('/proc/.../uuid').readline()
> 
> Yes, Lucas also suggested this method as well. Since the patch has been applied, need I submit a
> little patch for this? 
> Thanks for suggestion. :-)

Seems the answer emerges. ;-)

> 
> >
> > -- 
> > error compiling committee.c: too many arguments to function
> >
> > --
> > 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
--
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..895049e 100644
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -113,6 +113,13 @@  class VM:
         self.qemu_path = qemu_path
         self.image_dir = image_dir
         self.iso_dir = iso_dir
+        
+        if params.get("uuid"):
+            if params.get("uuid") == "random":
+                uuid = os.popen("cat /proc/sys/kernel/random/uuid").readline()
+                self.uuid = uuid.strip()
+            else:
+                self.uuid = params.get("uuid")
 
 
         # Find available monitor filename
@@ -374,6 +381,10 @@  class VM:
             # Make qemu command
             qemu_command = self.make_qemu_command()
 
+            # Specify the system UUID
+            if self.uuid:
+                qemu_command += " -uuid %s" % self.uuid
+
             # Is this VM supposed to accept incoming migrations?
             if for_migration:
                 # Find available migration port