Justin Clift | 1 Oct 2010 05:39
Picon
Favicon
Gravatar

Re: [libvirt] [PATCH] 1/1: implement usb and pci hot attach in AppArmor driver

On 10/01/2010 07:07 AM, Eric Blake wrote:
<snip>
> Maybe it's me, but stylistically, I like ?: for these uses:
> ctl->append = arg == 'F';

They make it a real PITA to follow when debugging (ie in Eclipse)
though.

When the if has the value assignment on separate lines, there's no
doubt at all about which way the decision went.  Using ?, the person
doing the debugging either has to do extra debugging work (adding
further mental distraction), or make an assumption (potential gotcha).

I kind of hate the ? short hand in code I have to debug, due to this.

;>

Justin Clift | 1 Oct 2010 05:40
Picon
Favicon
Gravatar

Re: [libvirt] [PATCH] 1/1: implement usb and pci hot attach in AppArmor driver

On 10/01/2010 07:17 AM, Eric Blake wrote:
> On 09/30/2010 03:07 PM, Eric Blake wrote:
>>> + if (arg == 'F')
>>> + ctl->append = true;
>>> + else
>>> + ctl->append = false;
>>
>> Maybe it's me, but stylistically, I like ?: for these uses:
>> ctl->append = arg == 'F';
>
> Hmm - I mentioned liking ?:, then used something even shorter :)
>
> To clarify: when I see 'if (simple_cond) a=b; else a=c;', I generally
> turn it into 'a=(simple_cond)?b:c', but I also find 'bool_cond ? true :
> false' to be overkill when 'bool_cond' does just as well.

You write perl too don't you? :)

Jaromír Červenka | 1 Oct 2010 05:43
Gravatar

Re: [libvirt] Storage volume

Thank you Justin. How could I forget "pool-refresh"!? I knew, that exists some clean and easy solution :)

Jaromír.

Dne 30. září 2010 16:18 Justin Clift <jclift <at> redhat.com> napsal(a):
On 09/30/2010 11:25 PM, Jaromír Červenka wrote:
Hello,

is there any way, how to create storage volume from existing qcow2 image
file? I have XML description for this new volume and image which was used
without xml. But when I tried "vol-create" it automatically deleted this
file and created new one.

Hi Jaromír,

If it helps, the way I normally do it is to copy the qcow2 image file into a new pool, then refresh the pool.

When the pool is refreshed, it notices the new qcow2 file,
automatically creating the internal XML for it and making it available.

ie.  (this is just my typing from memory, so you may need to tweak it)

 $ sudo cp myimage.qcow2 /var/lib/libvirt/images
 $ sudo virsh pool-refresh default
 $ sudo virsh vol-list default
 <a list of volumes in the pool should be shown, including the new one>

Does that achieve what you're after?

Regards and best wishes,

Justin Clift

<div>
<div>Thank you Justin. How could I forget "pool-refresh"!? I knew, that exists some clean and easy solution :)</div>
<div><br></div>
<div>Jarom&iacute;r.</div>
<div><br></div>Dne 30. z&aacute;&#345;&iacute; 2010 16:18 Justin Clift <span dir="ltr">&lt;<a href="mailto:jclift <at> redhat.com">jclift <at> redhat.com</a>&gt;</span> napsal(a):<br><div class="gmail_quote"><blockquote class="gmail_quote">
<div class="im">On 09/30/2010 11:25 PM, Jarom&iacute;r &#268;ervenka wrote:<br><blockquote class="gmail_quote">
Hello,<br><br>
is there any way, how to create storage volume from existing qcow2 image<br>
file? I have XML description for this new volume and image which was used<br>
without xml. But when I tried "vol-create" it automatically deleted this<br>
file and created new one.<br>
</blockquote>
<br>
</div>
Hi Jarom&iacute;r,<br><br>
If it helps, the way I normally do it is to copy the qcow2 image file into a new pool, then refresh the pool.<br><br>
When the pool is refreshed, it notices the new qcow2 file,<br>
automatically creating the internal XML for it and making it available.<br><br>
ie. &nbsp;(this is just my typing from memory, so you may need to tweak it)<br><br>
 &nbsp;$ sudo cp myimage.qcow2 /var/lib/libvirt/images<br>
 &nbsp;$ sudo virsh pool-refresh default<br>
 &nbsp;$ sudo virsh vol-list default<br>
 &nbsp;&lt;a list of volumes in the pool should be shown, including the new one&gt;<br><br>
Does that achieve what you're after?<br><br>
Regards and best wishes,<br>
<br>
Justin Clift<br>
</blockquote></div>
<br>
</div>
Justin Clift | 1 Oct 2010 05:44
Picon
Favicon
Gravatar

Re: [libvirt] Storage volume

On 10/01/2010 01:43 PM, Jaromír Červenka wrote:
> Thank you Justin. How could I forget "pool-refresh"!? I knew, that exists
> some clean and easy solution :)

No worries at all. :)

> Jaromír.

--
libvir-list mailing list
libvir-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Jaromír Červenka | 1 Oct 2010 06:10
Gravatar

[libvirt] dumpxml doesn't export 'boot' options

Hi again,


I added another boot options to my running domain, like this:

# virsh edit leon.i-tux.cz

<os>
  ...     
  <boot dev='cdrom'/>
  <bootmenu enable='yes'/>
</os>

(Note: "dev='hd" was already present)

Right after :wq (vim commands) -> # Domain leon.i-tux.cz XML configuration edited.

Now when I did "virsh dumpxml leon.i-tux.cz" these new boot options are missing in output. But "cat /etc/libvirt/qemu/leon.i-tux.cz.xml" shows me these new options and "virsh edit" also. Is it some bug or normal behavior? 

I also noticed that these options disappear after restarting libvirt daemon - but only from "virsh edit", not from /etc/... xml file.

I would like to do some kind of backups of my domains thru dumpxml :) Maybe the best way will be to backup all in /etc/libvirt.

Thank you, 
Jaromír.
<div>
<p>Hi again,
</p>
<div><br></div>
<div>I added another boot options to my running domain, like this:</div>
<div><br></div>
<div># virsh edit <a href="http://leon.i-tux.cz">leon.i-tux.cz</a>
</div>
<div><br></div>
<div>
<div>&lt;os&gt;</div>
<div>
&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>&nbsp;&nbsp;&lt;boot dev='cdrom'/&gt;</div>
<div>&nbsp;&nbsp;&lt;bootmenu enable='yes'/&gt;</div>
</div>
<div>&lt;/os&gt;</div>
<div><br></div>
<div>(Note: "dev='hd" was already present)</div>
<div>
<br>
</div>
<div>Right after :wq (vim commands) -&gt;&nbsp;# Domain <a href="http://leon.i-tux.cz">leon.i-tux.cz</a> XML configuration edited.</div>
<div><br></div>
<div>Now when I did "virsh dumpxml <a href="http://leon.i-tux.cz">leon.i-tux.cz</a>" these new boot options are missing in output. But "cat /etc/libvirt/qemu/leon.i-tux.cz.xml" shows me these new options and "virsh edit" also. Is it some bug or normal behavior?&nbsp;</div>
<div><br></div>
<div>I also noticed that these options disappear after restarting libvirt daemon - but only from "virsh edit", not from /etc/... xml file.</div>
<div><br></div>
<div>I would like to do some kind of backups of my domains thru dumpxml :) Maybe the best way will be to backup all in /etc/libvirt.</div>
<div><br></div>
<div>Thank you,&nbsp;</div>
<div>Jarom&iacute;r.</div>
</div>
Jaromír Červenka | 1 Oct 2010 09:17
Gravatar

[libvirt] Ejecting ISO from cdrom

Hello,


how can I remove ISO image from cdrom in running domain, please? I tried procedure which is described on your wiki (http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#eject_DEV) but it doesn't work for me:

divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly leon.i-tux.cz "" hdc
error: command 'attach-disk' requires <target> option

divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly leon.i-tux.cz "" --target hdc
error: command 'attach-disk' requires <source> option

divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly leon.i-tux.cz --source "" --target hdc
error: expected syntax: --source <string>

Thank you,
Jaromír Červenka
<div>
<p>Hello,
</p>
<div><br></div>
<div>how can I remove ISO image from cdrom in running domain, please? I tried procedure which is described on your wiki (<a href="http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#eject_DEV">http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#eject_DEV</a>) but it doesn't work for me:</div>
<div><br></div>
<div>
<div>divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly <a href="http://leon.i-tux.cz">leon.i-tux.cz</a> "" hdc</div>
<div>error: command 'attach-disk' requires &lt;target&gt; option</div>
<div><br></div>
<div>divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly <a href="http://leon.i-tux.cz">leon.i-tux.cz</a> "" --target hdc</div>
<div>error: command 'attach-disk' requires &lt;source&gt; option</div>
<div><br></div>
<div>divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly <a href="http://leon.i-tux.cz">leon.i-tux.cz</a> --source "" --target hdc</div>
<div>error: expected syntax: --source &lt;string&gt;</div>
</div>
<div><br></div>
<div>Thank you,</div>
<div>Jarom&iacute;r &#268;ervenka</div>
</div>
Zdenek Styblik | 1 Oct 2010 09:37
Favicon

Re: [libvirt] Ejecting ISO from cdrom

On 10/01/2010 09:17 AM, Jaromír Červenka wrote:
> Hello,
> 
> how can I remove ISO image from cdrom in running domain, please? I tried
> procedure which is described on your wiki (
> http://wiki.libvirt.org/page/QEMUSwitchToLibvirt#eject_DEV) but it doesn't
> work for me:
> 
> divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly
> leon.i-tux.cz "" hdc
> error: command 'attach-disk' requires <target> option
> 
> divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly
> leon.i-tux.cz "" --target hdc
> error: command 'attach-disk' requires <source> option
> 
> divinus:/kvm/iso # virsh attach-disk --type cdrom --mode readonly
> leon.i-tux.cz --source "" --target hdc
> error: expected syntax: --source <string>
> 
> Thank you,
> Jaromír Červenka
> 
> 
> 
> 
> --
> libvir-list mailing list
> libvir-list <at> redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Jaromir,

virsh # attach-disk --type cdrom --source
/home/ftp/linux/slackware64-13.1/slackware64-13.1-install-dvd.iso --mode
readonly nagios --target hdc
Disk attached successfully

Please note, that you've provided three (3) commands and each is missing
something; each of them is missing this and that (or I got it wrong and
you were trying it). Please, re-check commands you've posted. I also
think source can't be empty; at least it makes no sense to me. :)

I haven't even checked what I'm typing; just copied what you've posted,
yet committed full command to virsh, not parts.

I hope it helps,
Zdenek

--

-- 
Zdenek Styblik
Net/Linux admin
OS TurnovFree.net
email: stybla <at> turnovfree.net
jabber: stybla <at> jabber.turnovfree.net

--
libvir-list mailing list
libvir-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Daniel Veillard | 1 Oct 2010 10:30
Picon
Favicon
Gravatar

Re: [libvirt] [PATCHv3] PHYP: Checking for NULL values when building new guest

On Thu, Sep 30, 2010 at 09:23:50PM +0200, Matthias Bolte wrote:
> 2010/9/29 Daniel Veillard <veillard <at> redhat.com>:
> > On Wed, Aug 25, 2010 at 01:27:44PM -0300, Eduardo Otubo wrote:
> >> When creating a new gust, the function phypBuildLpar() was not
> >> checking for NULL values, making the driver to have a segmentation
> >> fault.
> >> ---
> >>  src/phyp/phyp_driver.c |   23 +++++++++++++++++++++++
> >>  1 files changed, 23 insertions(+), 0 deletions(-)
> >
> >  Seems we had forgotten that old patch, applied it,
> >
> >   thanks !
> >
> > Daniel
> >
> 
> Ah, yes, but the patch you applied didn't fix the segfault a few lines
> below where def->disks[0]->src is used without checking for
> def->ndisks > 0 before, as I pointed out in an earlier review.
> 
> I've send an additional patch to fix this:
> 
>   https://www.redhat.com/archives/libvir-list/2010-September/msg00571.html

  Ahhh , please push :-)

Daniel

--

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel <at> veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

Matthias Bolte | 1 Oct 2010 10:44

Re: [libvirt] [PATCH] phyp: Verify that domain XML contains at least one disk element

2010/9/30 Eric Blake <eblake <at> redhat.com>:
> On 09/30/2010 01:18 PM, Matthias Bolte wrote:
>>
>> phypBuildLpar expects that at least one disk element is provided.
>> ---
>>  src/phyp/phyp_driver.c |   18 +++++++++++-------
>>  1 files changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
>> index ab12392..0a7d6f9 100644
>> --- a/src/phyp/phyp_driver.c
>> +++ b/src/phyp/phyp_driver.c
>>  <at>  <at>  -3715,13 +3715,17  <at>  <at>  phypBuildLpar(virConnectPtr conn, virDomainDefPtr
>> def)
>>          goto err;
>>      }
>>
>> -    if (def->ndisks>  0) {
>> -        if (!def->disks[0]->src) {
>> -            PHYP_ERROR(VIR_ERR_XML_ERROR,"%s",
>> -                    _("Field \"<src>\" under \"<disk>\" on the domain XML
>> file is "
>> -                        "missing."));
>> -            goto err;
>> -        }
>> +    if (def->ndisks<  1) {
>> +        PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
>> +                   _("Domain XML must contain at least one \"<disk>\"
>> element."));
>> +        goto err;
>> +    }
>
> ACK.
>

Thanks, pushed.

Matthias

--
libvir-list mailing list
libvir-list <at> redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Richard W.M. Jones | 1 Oct 2010 14:15
Picon
Favicon
Gravatar

Re: [libvirt] cpulimit and kvm process

On Fri, Oct 01, 2010 at 10:03:28AM +0300, Mihamina Rakotomandimby wrote:
> Manao ahoana, Hello, Bonjour,
> 
> I would like to launch several KVM guests on a multicore CPU.
> The number of the KVM process is over the number of physical cores.
> 
> I would like to limit each KVM process to say... 10% of CPU
> 
> I first use "cpulimit "
> 
> Would you know some better way to limit them? it's in order to avoid 4
> VM to hog all the 4 hardware cores.

KVM processes are just like Linux processes, so you can pin them and
renice them.

There is support for pinning virtual CPUs to physical CPUs in libvirt,
eg:

  virsh vcpupin GuestName 0 0

but you can also use Linux tools.  "tuna" is one such program which I
think is in Fedora, or upstream here:

  http://git.kernel.org/?p=linux/kernel/git/acme/tuna.git;a=summary

Another tool is "renice".

Rich.

--

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


Gmane