Re: [libvirt] [Qemu-devel] [PATCH v3 2/2] net: introduce command to query rx-filter information

2013-05-26 Thread Michael S. Tsirkin
On Fri, May 24, 2013 at 04:00:42PM -0400, Luiz Capitulino wrote:
 On Fri, 24 May 2013 12:05:12 -0600
 Eric Blake ebl...@redhat.com wrote:
 
  On 05/24/2013 10:12 AM, Michael S. Tsirkin wrote:
  
   Event message contains the net client name, management might only want
   to query the single net client.
  
   The client can do the filtering itself.
  
  
   I'm not sure I buy the responsiveness argument.  Sure, the fastest I/O
   is no I/O, but whether you read and parse 100 bytes or 1000 from a Unix
   domain socket once in a great while shouldn't make a difference.
  
  And the time spent malloc'ing the larger message to send from qemu, as
  well as the time spent malloc'ing the libvirt side that parses the qemu
  string into C code for use, and the time spent strcmp'ing every entry to
  find the right one...
  
  It really IS more efficient to filter as low down in the stack as
  possible, once it is determined that filtering is desirable.
  
  Whether filtering makes a difference in performance is a different
  question - you may be right that always returning the entire list and
  making libvirt do its own filtering will still not add any more
  noticeable delay compared to libvirt doing a filtered query, if the
  bottleneck lies elsewhere (such as libvirt telling macvtap its new
  configration).
  
  
   My main concern is to keep the external interface simple.  I'm rather
   reluctant to have query commands grow options.
  
   In a case where we need the give me everything query anyway, the give
   me this particular part option is additional complexity.  Needs
   justification, say arguments involving throughput, latency or client
   complexity.
  
   Perhaps cases exist where we never want to ask for everything.  Then the
   give me everything query is useless, and the option should be
   mandatory.
  
  For this _particular_ interface, I'm not sure whether libvirt will ever
  use an unfiltered query -
 
 If having the argument is useful for libvirt, then it's fine to have it.
 
 But I'd be very reluctant to buy any performance argument w/o real
 numbers to back them up.

Me too. I think it's more convenience than performance.

-- 
MST

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Issues with qemu-nbd over AF_UNIX and virDomainAttachDevice

2013-05-26 Thread Deepak C Shetty

On 05/25/2013 02:04 AM, Paolo Bonzini wrote:

Il 24/05/2013 10:01, Deepak C Shetty ha scritto:

Il 24/05/2013 06:59, Deepak C Shetty ha scritto:
What version of libvirt is this?  It should work starting from 1.0.4.

Ah, thats what I seem to have missed. I was using the distro provided
libvirt.. which seems to be old (0.9)!
I will compile latest libvirt and try.

I still have a Q.. for qemu-nbd exporting over Unix socket.. what should
i put for port attr of host tag ?
I am assuming its ignored for Unix sockets ?

It's not required anymore.  In fact it was a bug that transport='unix'
was accepted in the old libvirt, because it didn't know how to process it.

Paolo


I tried with the latest git version of libvirt (1.0.5). I still get the 
same error for trying to attach nbd device, where as file based device 
works.


./daemon/libvirtd --version
/home/dpkshetty/work/newlibvirt2/libvirt/daemon/.libs/lt-libvirtd 
(libvirt) 1.0.5


My qemu-nbd exports the disk as...
qemu-nbd -t -k /tmp/mysock2 /home/dpkshetty/work/img/iscsi_disk


1) My libvirtd started as
./run ./daemon/libvirtd

and in this console i see...

error : qemuMonitorTextAddDrive:2691 : operation failed: open disk image 
file failed


2) My python example ( I tried with virsh (started as ./run 
./tools/virsh...)  - see same error)


 print filexml
disk type='file' device='disk'
  driver name=qemu type=qcow2/
  source file='/home/dpkshetty/work/img/iscsi_disk'
  /source
  target dev=vdc bus=virtio /
/disk
 dom.attachDevice(filexml)
0
 help(dom)

 dom.detachDevice(filexml)
0
 nbdxml='''disk type='network'\n  driver name=qemu 
type=qcow2/\n  source protocol=nbd\n host name=deepakcs-lx 
port= transport=unix socket=/tmp/mysock2 /\n  /source\n  
target dev=vdc bus=virtio /\n/disk'''

 print nbdxml
disk type='network'
  driver name=qemu type=qcow2/
  source protocol=nbd
host name=deepakcs-lx port= transport=unix 
socket=/tmp/mysock2 /

  /source
  target dev=vdc bus=virtio /
/disk
 dom.attachDevice(nbdxml)
libvirt: QEMU Driver error : operation failed: open disk image file failed
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/dpkshetty/work/newlibvirt2/libvirt/python/libvirt.py, 
line 419, in attachDevice
if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', 
dom=self)

libvirt.libvirtError: operation failed: open disk image file failed

3) In nbdxml, i tried removing port=.. it didn't give any error 
with regards to port beign mandatory.. which si good.. but the attach 
device still gives the same error as above


Is the `nbdxml` I am using for attachign a qemu-nbd exported drive, 
correct ?


thanx,
deepak








--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] two hostdev devices problem

2013-05-26 Thread Dominik Mostowiec
Hi,

 First - I just got confirmation from the libnl maintainer that the bug I
 mentioned causing problems with max_vfs  50 *is* an issue in libnl
 3.2.16 - it is fixed in libnl 3.2.22. Try to upgrade to that version and
 it should solve at least some of your problems.

Upgrade libnl to version 3.2.22 helps.
Thanks.

 1) when you have max_vfs = 10, you can assign the devices and mac
 addresses are set properly, i.e. everything works.
 2) when you have max_vfs = 35, you can assign the devices, but the mac
 addresses are not set properly.
 3) when you have max_vfs = 63, you can't assign the devices because you
 get this error:

 internal error missing IFLA_VF_INFO in netlink response

 Is this correct?

Yes.
Before upgrade libnl :-)
Upgrede helps only for limit max_vfs.

 (BTW, it may get a bit confusing if you leave your networks named as
 vnet0 and vnet1 - although it's a different namespace, libvirt uses
 vnetN (where n is 0 - whatever) as the name for the tap device
 associated with each guest interface).

You're right.
I changed this.

 the output of ip link show dev $PF.
Hmm,
 ip link show dev eth0
Shows only:
2: eth0: BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP mtu 1500 qdisc mq
master bond0 state UP qlen 1000
link/ether b8:ca:3a:5b:a6:3a brd ff:ff:ff:ff:ff:ff

I see VFs like network interfaces eth2-eth127.
When VF is attached to VM it disappear from list on host.

--
Regards
Dominik


2013/5/24 Laine Stump la...@laine.org:
 On 05/24/2013 09:16 AM, Dominik Mostowiec wrote:

 Do you have this problem with mac addresses when max_vfs is set to an
 even lower number?


 First - I just got confirmation from the libnl maintainer that the bug I
 mentioned causing problems with max_vfs  50 *is* an issue in libnl
 3.2.16 - it is fixed in libnl 3.2.22. Try to upgrade to that version and
 it should solve at least some of your problems.



 No,
 When max_fs=10, macs in VM are OK.


 Interesting.

 So now I'm curious about something - can you try adding a vlan tag to
 your networks and see if the vlan tag is set properly when max_vfs is a
 low number (10 or 7):

 network
   namevnet0/name
   uuidec49896a-a0b5-4944-a81f-9f0cdf578871/uuid
   vlan
 tag id='42'/
   /vlan
   forward mode='hostdev' managed='yes'
 pf dev='eth0'/
   /forward
 /network


 (you will have to do virsh net-destroy vnet0; virsh net-start vnet0
 after making the modification to the network). If the vlan tag is
 successfully set, it will show up next to the mac address for the VF in
 the output of ip link show dev $PF.

 (BTW, it may get a bit confusing if you leave your networks named as
 vnet0 and vnet1 - although it's a different namespace, libvirt uses
 vnetN (where n is 0 - whatever) as the name for the tap device
 associated with each guest interface).

 To summarize:

 1) when you have max_vfs = 10, you can assign the devices and mac
 addresses are set properly, i.e. everything works.
 2) when you have max_vfs = 35, you can assign the devices, but the mac
 addresses are not set properly.
 3) when you have max_vfs = 63, you can't assign the devices because you
 get this error:

 internal error missing IFLA_VF_INFO in netlink response

 Is this correct?


 Phisical interfaces:
 ifconfig eth0
 eth0  Link encap:Ethernet  HWaddr b8:ca:3a:5b:a6:38
   UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

 Okay, so that's not the problem.


 ifconfig eth1
 eth1  Link encap:Ethernet  HWaddr b8:ca:3a:5b:a6:38
   UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

 Hmm. ixgbe. I just got a report yesterday that setting of the vlan tag
 for ixgbe vfs was not working properly (although it works fine for igb
 devices)
 Domain config:
 interface type=network
  alias name=hostdev0/
  source network=vnet0/
  mac address=52:54:0a:b1:48:fc/
 /interface
 interface type=network
  alias name=hostdev1/
  source network=vnet1/
  mac address=52:54:0a:b1:48:fc/
  /interface

 Networks defined:
 network
   namevnet0/name
   uuidec49896a-a0b5-4944-a81f-9f0cdf578871/uuid
   forward mode='hostdev' managed='yes'
 pf dev='eth0'/
   /forward
 /network

 network
   namevnet1/name
   uuid6c8319e8-8b53-4382-9f4e-2400819b00a9/uuid
   forward mode='hostdev' managed='yes'
 pf dev='eth1'/
   /forward
 /network

 Regards
 Dominik

 2013/5/24 Laine Stump la...@laine.org:
 On 05/24/2013 04:45 AM, Dominik Mostowiec wrote:
 Hi,
 I have libnl3, kernel 3.8.8, os ubuntu 12.04, net:intel10G.
 Upgrade libnl to 3.2.16 not helps,

 I don't know - this is probably another problem, when I have set
 max_vfs=35,35 VF is attaching to VM but mac in VM is not set
 propertly.
 Do you have this problem with mac addresses when max_vfs is set to an
 even lower number?

 Ah, another thing - did you ifconfig up the PF before you started the
 guest?
 Libvirt probably set this macs because in syslog:
 May 23 14:48:59 on-10-177-32-62 kernel: [12574.171792] ixgbe

 Hmm. ixgbe. I just got a report yesterday that setting 

Re: [libvirt] [PATCH 1/2] tool/virsh-domain.c: Add a vshNodeGetCPUMap function to get cpumap of host.

2013-05-26 Thread Yang Dongsheng

On 05/24/2013 08:18 PM, Peter Krempa wrote:

On 05/24/13 11:21, yangdongsheng wrote:

Get CPU map of host node CPUs by trying virNodeGetCPUMap
and falling back to virNodeGetCPUStats.

Signed-off-by: yangdongsheng yangds.f...@cn.fujitsu.com
---
  tools/virsh-domain.c |   55 
++

  1 file changed, 55 insertions(+)



NACK. This functionality is already implemented as nodecpumap 
command defined in cmdNodeCpuMap in virsh-host.c


If you wish to add the fallback code to that function, the patch is 
welcome.


Peter


Aha, I see it.
But now, I think the fallback is not nessary. We can use 
virNodeGetCPUMap directly.


Thanx for your reply. :)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 0/2] Fix the display of *virsh vcpuinfo* command.

2013-05-26 Thread Yang Dongsheng

On 05/24/2013 10:03 PM, Eric Blake wrote:

On 05/24/2013 03:21 AM, yangdongsheng wrote:

Hi,

[uggh; yet another victim of git's stupidity in using In-reply-to:y
if you answer the 'git send-email' question incorrectly - just hit enter
rather than filling in a response to that question]

Would you mind resending this as a top-level thread, so that it gets
properly threaded?  My mail client split 0/2 and 2/2 into an old series,
and 1/2 somewhere else.

:( Sorry to trouble you !
Of course I will do some fix for this patch and resend it.

 I found some confusion in display of commad *virsh vcpuinfo domname* .
There is no diffrence between a cpu offline and a cpu online but not be set
for the affinity of vcpu, both are '-'. But users will find the difference of 
them
in using them for a same action (such as vcpupin) and be confused.

I'm a bit worried about backward compatibility; if there are existing
scripts that parse the output, will they be confused if we introduce a
third symbol?  Then again, offline host cpus are indeed a different
beast than cpus that the guest has been assigned to, so I think we can
make this change.

Thanx for your approvement.

So, I think we should show the cpu in different state with different symbol.

In this patchset, I introduce a symbol 'x' (maybe there is a better one :)) to 
display
the cpu is offline on host.

Just like:
[root@yds-pc ~]# virsh vcpuinfo virt-tests-vm1
VCPU:   0
CPU:0
State:  running
CPU time:   14.8s
CPU Affinity:   y-xy


yangdongsheng (2):
   tool/virsh-domain.c: Add a vshNodeGetCPUMap function to get cpumap of
 host.
   tool/virsh-domain.c: Fix the display of Affinity in function
 cmdVcpuinfo.

  tools/virsh-domain.c |   78 --
  1 file changed, 75 insertions(+), 3 deletions(-)



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] snapshot-create-as Permission denied

2013-05-26 Thread yue
hi.
my environment: centos 6.3, qemu 1.5(source code build), libvirt 
libvirt-0.10.2-18.el6_4.2.x86_64.selinux enforce .
 i have 2 questions
1.snapshot. permisson deny.
dumpxml:
 seclabel type='dynamic' model='selinux' relabel='yes'
labelsystem_u:system_r:svirt_t:s0:c33,c172/label
imagelabelsystem_u:object_r:svirt_image_t:s0:c33,c172/imagelabel
  /seclabel
command line:
[root@ovirtdev images]# ls -lZ
-rw-r--r--. qemu qemu system_u:object_r:virt_image_t:s0 test.qcow2
image does not have the same MLS?
it does not seem like a selinux problem, because selinix does not record this 
deny.
2.vnet problem
May 27 09:48:49 ovirtdev NetworkManager[2365]: warn 
/sys/devices/virtual/net/vnet0: couldn't determine device driver; ignoring...

[root@ovirtdev images]# brctl show
bridge name bridge id   STP enabled interfaces
ovirtmgmt   8000.000c290a2351   no  eth0

   vnet0
what is the reason? does it matter with libvirt?
 
thanks



At 2013-05-25 23:41:18,Kashyap Chamarthy kcham...@redhat.com wrote:
On 05/25/2013 06:40 PM, yue wrote:
 May 25 20:50:59 ovirtdev NetworkManager[2370]: warn 
 /sys/devices/virtual/net/vnet0:
 couldn't determine device driver; ignoring...
 root@ovirtdev mailto:root@ovirtdev images]# virsh snapshot-create-as linux 
 snapshot1
 snapshot1 --disk-only --atomic
 error: internal error unable to execute QEMU command 'transaction':
 /var/lib/libvirt/images/test.snapshot1: error while creating qcow2: 
 Permission denied

A few questions:

1/ What distribution ?

2/ Versions of libvirt, qemu  (some versions?

Please note that, libvirt uses QEMU's 'transaction' command under the hood 
when the guest
is 'live'. So, if you're using an older version of QEMU, it might not have 
transaction
command in it.

3/ Are you using virsh independently or are you mangling libvirt commands 
with oVirt
environment ? (from your initial post, it appears it's an oVirt node).



-- 
/kashyap
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] tool/virsh-domain.c: Fix the display of Affinity in function cmdVcpuinfo.

2013-05-26 Thread yangdongsheng
(1).Introduce a symbol 'x' to mean the physical cpu on host is offline.
(2).And the symbol '-' means the physical cpu on host is online but the
affinity of domain for this cpu is not set.

There was no diffrence in display between the two kinds of cpu state
before this patch, both are '-'.

Signed-off-by: yangdongsheng yangds.f...@cn.fujitsu.com
---
I have removed the vshNodeGetCPUMap patch from this patchset.
So this patch will only fix the display of virsh vcpuinfo, please
give me your comment. Thanx~

 tools/virsh-domain.c |   24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0402aef..6e13076 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5271,6 +5271,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
 virDomainPtr dom;
 virVcpuInfoPtr cpuinfo;
 unsigned char *cpumaps;
+unsigned char *hostcpumap;
 int ncpus, maxcpu;
 size_t cpumaplen;
 bool ret = true;
@@ -5284,6 +5285,11 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
 return false;
 }
 
+if ((virNodeGetCPUMap(ctl-conn, hostcpumap, NULL, 0))  0) {
+virDomainFree(dom);
+return false;
+}
+
 if (virDomainGetInfo(dom, info) != 0) {
 virDomainFree(dom);
 return false;
@@ -5310,7 +5316,13 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
 }
 vshPrint(ctl, %-15s , _(CPU Affinity:));
 for (m = 0; m  maxcpu; m++) {
-vshPrint(ctl, %c, VIR_CPU_USABLE(cpumaps, cpumaplen, n, m) ? 
'y' : '-');
+if VIR_CPU_USED(hostcpumap, m) {
+vshPrint(ctl, %c, VIR_CPU_USABLE(cpumaps,
+cpumaplen, n, m) ? 'y' : '-');
+}
+else {
+vshPrint(ctl, %c, 'x');
+}
 }
 vshPrint(ctl, \n);
 if (n  (ncpus - 1)) {
@@ -5332,8 +5344,13 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
 vshPrint(ctl, %-15s %s\n, _(CPU time), _(N/A));
 vshPrint(ctl, %-15s , _(CPU Affinity:));
 for (m = 0; m  maxcpu; m++) {
-vshPrint(ctl, %c,
- VIR_CPU_USABLE(cpumaps, cpumaplen, n, m) ? 'y' : 
'-');
+if VIR_CPU_USED(hostcpumap, m) {
+vshPrint(ctl, %c, VIR_CPU_USABLE(cpumaps,
+cpumaplen, n, m) ? 'y' : '-');
+}
+else {
+vshPrint(ctl, %c, 'x');
+}
 }
 vshPrint(ctl, \n);
 if (n  (ncpus - 1)) {
@@ -5346,6 +5363,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
 }
 
 VIR_FREE(cpumaps);
+VIR_FREE(hostcpumap);
 VIR_FREE(cpuinfo);
 virDomainFree(dom);
 return ret;
-- 
1.7.10.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] snapshot-create-as Permission denied

2013-05-26 Thread Kashyap Chamarthy
On 05/27/2013 08:26 AM, yue wrote:
 hi.
 my environment: centos 6.3, qemu 1.5(source code build), 

I don't know how you've built or what else have you included/excluded in it.

 libvirt libvirt-0.10.2-18.el6_4.2.x86_64.selinux enforce .
  i have 2 questions
 1.snapshot. permisson deny.
 dumpxml:
  seclabel type='dynamic' model='selinux' relabel='yes'
 labelsystem_u:system_r:svirt_t:s0:c33,c172/label
 imagelabelsystem_u:object_r:svirt_image_t:s0:c33,c172/imagelabel
   /seclabel
 command line:
 [root@ovirtdev images]# ls -lZ
 -rw-r--r--. qemu qemu system_u:object_r:virt_image_t:s0 test.qcow2
 image does not have the same MLS?
 it does not seem like a selinux problem, because selinix does not record this 
 deny.

Also can you check what's the context of your SELinux process ?

$ ps -eZ | grep qemu-kvm


Working here just fine (but this is Fedora 19):
-
$ ls -lZ /home/test/vmimages/regular-guest.qcow2
-rw-r--r--. qemu qemu system_u:object_r:svirt_image_t:s0:c390,c525
/home/test/vmimages/regular-guest.qcow2

$ ps -eZ | grep -i qemu
system_u:system_r:svirt_t:s0:c390,c525 1969 ?  04:21:20 qemu-system-x86

$ virsh dumpxml regular-guest | grep seclabel -A4
  seclabel type='dynamic' model='selinux' relabel='yes'
labelsystem_u:system_r:svirt_t:s0:c390,c525/label
imagelabelsystem_u:object_r:svirt_image_t:s0:c390,c525/imagelabel
  /seclabel
-

 2.vnet problem
 May 27 09:48:49 ovirtdev NetworkManager[2365]: warn 
 /sys/devices/virtual/net/vnet0: couldn't determine device driver; ignoring...
 
 [root@ovirtdev images]# brctl show
 bridge name bridge id   STP enabled interfaces
 ovirtmgmt   8000.000c290a2351   no  eth0
   
  vnet0
 what is the reason? does it matter with libvirt?
  
 thanks
 
 
 
 At 2013-05-25 23:41:18,Kashyap Chamarthy kcham...@redhat.com wrote:
 On 05/25/2013 06:40 PM, yue wrote:
 May 25 20:50:59 ovirtdev NetworkManager[2370]: warn 
 /sys/devices/virtual/net/vnet0:
 couldn't determine device driver; ignoring...
 root@ovirtdev mailto:root@ovirtdev images]# virsh snapshot-create-as 
 linux snapshot1
 snapshot1 --disk-only --atomic
 error: internal error unable to execute QEMU command 'transaction':
 /var/lib/libvirt/images/test.snapshot1: error while creating qcow2: 
 Permission denied

 A few questions:

 1/ What distribution ?

 2/ Versions of libvirt, qemu  (some versions?

 Please note that, libvirt uses QEMU's 'transaction' command under the hood 
 when the guest
 is 'live'. So, if you're using an older version of QEMU, it might not have 
 transaction
 command in it.

 3/ Are you using virsh independently or are you mangling libvirt commands 
 with oVirt
 environment ? (from your initial post, it appears it's an oVirt node).



 -- 
 /kashyap
 


-- 
/kashyap

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list