Re: [libvirt] [RFC] get guest OS infos

2015-06-11 Thread Dennis Jenkins
On Thu, Jun 11, 2015 at 3:51 AM, Daniel P. Berrange berra...@redhat.com
wrote:

 On Thu, Jun 11, 2015 at 09:17:30AM +0100, Daniel P. Berrange wrote:
  On Thu, Jun 11, 2015 at 01:51:33PM +0800, zhang bo wrote:
   Different OSes have different capabilities and behaviors sometimes. We
 have to distinguish them then.
  
   For example, our clients want to send NMI interrupts to certain
 guests(eg.Linux distributions), but not others(eg.Windows guests).
   They want to acquire the list below:
 guest1: RHEL 7
 guest2: RHEL 7
 guest3: Ubuntu 12
 guest4: Ubuntu 13
 guest5: Windows 7
 ..
  
   AFAIK, neither libvirt nor openstack, nor qemu, have such capbility of
 showing these guest OS infos.
   Libvirt now supports to show host capabilities and driver capability,
 but not an individual guest OS's capibility. We may refer to
   http://libvirt.org/formatdomaincaps.html for more information.
  


Hello.  I wrote a utility a few years ago to detect which OS is running in
each qemu VM under libvirt via memory probing.  I have not touched the code
in a few years.  YMMV.

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

Re: [libvirt] Doc: How to use NPIV in libvirt

2013-09-13 Thread Dennis Jenkins
On Thu, Sep 12, 2013 at 7:57 AM, Osier Yang jy...@redhat.com wrote:

 Before posting it to WIKI or somewhere, I want to see if there is any
 suggestions on it, or if I missed something.



I suggest putting a small paragraph at the top of the article explaining
what NPIV is, and why someone would want to use it.  Until I googled it, I
had no idea myself.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/4] Misc cleanups fixes to LXC driver

2013-05-15 Thread Dennis Jenkins
On Wed, May 15, 2013 at 4:53 AM, Daniel P. Berrange berra...@redhat.comwrote:

 From: Daniel P. Berrange berra...@redhat.com

 This series starts with a few cleanup patches removing code
 that is no longer required. The final patch fixes an important
 bug preventing LXC startup on certain distros which unwisely
 chose to make /var/run an absolute symlink instead of a relative
 symlink


(Slightly off-topic).  Can you cite a reference in the LSB or other
documentation / discussion that describes why linking /var/run to /run
is bad, and ../run is preferred?

I've spent 30 minutes digging through Gentoo discussion archives and found
lots of notes about making it a link to /run.  If this is ill-advised,
and I can cite a reference, I'll forward it the Gentoo init-script
maintainer.

There are many notes on the internet to use /var/run - /run.  Other than
your help yesterday, I've not found one reference to use ../run.  This
suggests that the existing findable documentation is incorrect.

http://askubuntu.com/questions/57297/why-has-var-run-been-migrated-to-run
http://www.gossamer-threads.com/lists/gentoo/dev/267752
http://blog.flameeyes.eu/2013/01/the-unsolved-problem-of-the-init-scripts

Unfortunately, so far I am unable to find any canonical (offical) (not the
Ubuntu Canonical!) Gentoo documentation on _why_ they symlink /var/run to
/run instead of ../run.  However, they are migrating their init scripts
to use /run instead of /var/run.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv2 0/4] support vlan element for interfaces and networks

2012-08-14 Thread Dennis Jenkins
On Tue, Aug 14, 2012 at 2:15 AM, Laine Stump la...@laine.org wrote:
 danpb raised a (valid) objection about the XML format in the first
 version of these patches, so I've redone it to be like this:

vlan trunk='yes'
   tag id='42'/
   tag id='30'/
/vlan

 The downside is that for a single vlan tag, it's more verbose:

vlan
  tag id='42'/
/vlan

 On the other hand, it's more consistent.

 The rest of the patches in the series were unchanged (and even the
 data definition is unchanged).

Laine,

Thank you for your work on the vlan interface code.

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


Re: [libvirt] [PATCH 1/1] Add vlantag parameter for openvswitch ports

2012-08-10 Thread Dennis Jenkins
On Fri, Aug 10, 2012 at 10:21 AM, Kyle Mestery (kmestery)
kmest...@cisco.com wrote:
 Those cases both look good. I think the formatting works just fine for
 virtualport type=openvswitch as well, something like this:

 Single VLAN (no trunk):
 interface type='bridge'
  mac address='52:54:00:30:23:a6'/
  source bridge='data-br'/
  vlan tag='70'/
  virtualport type='openvswitch'
parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2'
  /virtualport
  model type='virtio'/
  address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/
 /interface

 Single VLAN (trunk):
 interface type='bridge'
  mac address='52:54:00:30:23:a6'/
  source bridge='data-br'/
  vlan tag='70'/ trunk=yes
  virtualport type='openvswitch'
parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2'
  /virtualport
  model type='virtio'/
  address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/
 /interface

 Multiple VLANs (trunk):
 interface type='bridge'
  mac address='52:54:00:30:23:a6'/
  source bridge='data-br'/
  vlan trunk='yes'
   tag id='70'
   tag id='71'
  /vlan
  virtualport type='openvswitch'
parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2'
  /virtualport
  model type='virtio'/
  address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/
 /interface



I think that making tag id= an XML attribute in one case and an
element in another is problematic.  May I suggest just using:

vlan [trunk='yes|no'] !-- if unspecified, trunk defaults to 'no' --
  tag id='nn'/
  [tag id='nn'/ ...]
/vlan

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


Re: [libvirt] [PATCH 0/1] Add VLAN capability to openvswitch virtualport types

2012-08-08 Thread dennis jenkins
How would one specify VLAN trunk mode with only one vlan tag present?

On Wed, Aug 8, 2012 at 2:47 PM, Kyle Mestery kmest...@cisco.com wrote:
 With this change, it is now possible to support VLANs (both access and trunks)
 for openvswitch ports in libvirt. This also takes into account the profileid
 parameter, as the vlantag parameter is also optional.

 Examples of this configuration are below.

 Setup the port as an access port:

 interface type='bridge'
   mac address='52:54:00:30:23:a6'/
   source bridge='data-br'/
   virtualport type='openvswitch'
 parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2' 
 vlantag='70'/
   /virtualport
   model type='virtio'/
   address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/
 /interface

 Setup the port as an trunk port:

 interface type='bridge'
   mac address='52:54:00:30:23:a6'/
   source bridge='data-br'/
   virtualport type='openvswitch'
 parameters interfaceid='cdbbbc31-b7fe-16ca-a715-cc7cc76e18b2' 
 vlantag='70,71,72'/
   /virtualport
   model type='virtio'/
   address type='pci' domain='0x' bus='0x00' slot='0x03' function='0x0'/
 /interface

  src/conf/netdev_vport_profile_conf.c | 34 ++
  src/util/virnetdevopenvswitch.c  | 23 +--
  src/util/virnetdevvportprofile.h |  2 ++
  3 files changed, 53 insertions(+), 6 deletions(-)

 --
 1.7.11.2

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

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


Re: [libvirt] RFE: virConnectListAllDomains()

2012-05-19 Thread dennis jenkins
On Fri, May 18, 2012 at 6:52 PM, Eric Blake ebl...@redhat.com wrote:

 Use of virConnectListDomains() and virConnectListDefinedDomains() is:

 1. inherently racy.  A domain can change between active and inactive
 between two back-to-back calls, and thus be entirely skipped or
 enumerated twice when concatenating lists.

 2. painful to use.  ListDomains gives ids, ListDefinedDomains gives
 names, and the user must then call virDomainLookupByID() and
 virDomainLookupByName() to convert into UUIDs.

 3. requires pre-allocation.  The user must call virConnectNumOfDomains()
 then over-allocate before calling virConnectListDomains(), in order to
 guarantee that the list size didn't change between the two calls.

 This is a proposal for a new API that addresses all three points - by
 returning virDomainPtr rather than id or strings, the UUID of each
 domain can be grabbed in one shot.  By consolidating things into a
 single API call, there is no race in trying to piece together the
 complete list.  By having libvirt allocate the resulting array, rather
 than making the caller pre-allocate, the user doesn't have to worry
 about a race between getting a count and using that count.  It also
 provides the convenience of returning smaller lists based on various
 filtering groups.

 Thoughts before I expand this API and add the actual implementation?



Very nice idea.  Will the perl wrapper, Sys-Virt, be updated to expose this
new C api?




 --
 Eric Blake   ebl...@redhat.com+1-919-301-3266
 Libvirt virtualization library http://libvirt.org


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

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

Re: [libvirt] [RH-BZ #595428] 'virsh list' should output more information 'xm list'

2012-04-19 Thread dennis jenkins
On Thu, Apr 19, 2012 at 10:25 AM, Maxim Sditanov feni...@rambler.ru wrote:

 2012/4/2 Maxim Sditanov feni...@rambler.ru:
  Is this new feature request still
  https://bugs.gentoo.org/show_bug.cgi?id=366561 actual?
 
  Because virsh still show not enough information:
 
  $./virsh -c qemu:///system list --all
 
   IdName   State
  
   1 running
   - winxp  shut off
 
  And it will be good idea to show more detailed information or add
  additional flag, something like --detail.
  ./virsh -c qemu:///system list --all --detailed
 
 
  Id Name   StateMemory   VCPU UptimeCPU   IOPS
  --
  -
   1  running768M  2 3hours 5%12.1
   -  winxp  shut off512M  1
 

 I implemented first part of this task - VCPU and CPU load.
 I ported from virt-manager CPU load algorithm
 (thanks Cole Robinson for help
 https://www.redhat.com/archives/virt-tools-list/2012-April/msg00051.html)

 virt manager update graphic in such way:
 It create thread, than it take host CPU ticks (how much cpu time take host)
 then every 1 sec it update value and calculate percentage.
 But this algorithm is bad in virsh, because virsh give information about
 domains imidiatly, without delays and thats why i can't caclulate cpu
 (also io and
 network usage).

 I think it will be good idea if libvirtd will hold information about
 resource usage and implement interface for this data via libvirt
 And virsh and virt-manager will use
 the same functions to get cpu, disk and network usage, host uptime

 How do you think?


(disclaimer: I'm not a libvirt contributor, just a consumer.  Do I get to
vote? :) )

If statistics collection is implemented directly in libvirtd, how often
would libvirtd capture these statistics?  Once per second? 10s, 1m, etc...?

Would the interval be user-configurable (per-VM)?  If so, could this
setting be changed on the fly (eg, to a live VM and effective immediately)?

Would the statistics survive a restart of libvirtd?  If so, how would they
be persisted (flat text, xml, sqlite database)?

How far back would the stats be kept for?  Would this value be configurable
per-VM?

+1.  I would like to get these kind of stats from virsh list, and very
much like to get CPU and IO usage history from libvirtd.  I'm developing a
simple web interface for managing QEMU and LXC via libvirt (apache,
mod_perl, Sys-Virt, sqlite3, noVnc) for personal use.  I know that libvirt
can give CPU and IO usage info, but not historic info suitable for
assembling a quick graph.  If libvirtd cannot provide historic info, then I
will need to implement a separate daemon to record it, probably by polling
libvirtd at synchronous intervals.

side-note: I should put up a web page with screen-shots of my work in
progress, and provide access to my source code (personal SVN server).  Does
anyone here have an interest in using or examining my little project?

ps- I didn't mean to hijack your thread.  I just wanted to state my desire,
as a user of libvirt, to have this functionality (however tenuously
defined) in place.

Thank you guys and gals for making libvirt excellent.  I've notice the
quality of the feedback given to submitted patches and am impressed.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH V10 0/7] Add DHCP snooping support to nwfilter

2012-04-18 Thread dennis jenkins
On Tue, Apr 17, 2012 at 6:57 PM, Stefan Berger
stef...@linux.vnet.ibm.comwrote:


 Let me know when you tested it. I have pretty high confidence in the
 correctness of the code now :-)

 Regards,
  Stefan



Short version:

I got an error internal error IP parameter must be provided since
snooping the IP address does not work possibly due to missing tools.  Off
the top of my head, I don't know what I'm missing, but I'm probably at
fault for it.

Gorey details:

First, I had a devil of a time getting libvirt to install on my Gentoo
system from the git repository.  I don't know if my method is causing the
error message that I will outline below.

I install libvirt (0.9.11?) from your git sources (check out less than one
hour ago) directly on top of my existing Gentoo libivrt install
(0.9.10-r4).  I wanted to keep the Gentoo init scripts.  Some of the older
0.9.10 .so files are lying around, but they are not in use and can
(hopefully) be ignored.

This was my procedure:
1) emerge =libvirt-0.9.10-r4
2) cd /usr/src
3) git clone git://libvirt.org/libvirt.git libvirt
4) cd ./libvirt
5) ./autogen.sh
6) ./configure --prefix=/usr
7) make -j4
8)  ## Error about libnl not using a symbol (-Werror tripped me up).
9) ## (TL;DR - I forced Gentoo to update libnl to-1.1-r3)
10) make -j4
11) ## make backup of /etc/libvirt, as make install will clobber my
config files.
12) make install
13) ## restore my /etc/libvirt on top of whatever make install dropped
there.
14) /etc/init.d/libvirt restart
15) virsh --version
   0.9.11
16) virsh edit dwj-xp-msdev98
   Added XML to enable DHCP snooping.  Result:

interface type='bridge'
  mac address='82:00:00:00:00:09'/
  source bridge='br0'/
  filterref filter='clean-traffic'
parameter name='ip_learning' value='dhcp'/
  /filterref
  address type='pci' domain='0x' bus='0x00' slot='0x03'
function='0x0'/
/interface

17) virsh start dwj-xp-msdev98

ostara libvirt # virsh start dwj-xp-msdev98
error: Failed to start domain dwj-xp-msdev98
error: internal error IP parameter must be provided since snooping the IP
address does not work possibly due to missing tools

ostara libvirt # virsh start dwj-xp-vs10
Domain dwj-xp-vs10 started

So libvirt is still working for VMs that I've not reconfigured for DHCP
snooping yet.

Please advise on what I'm missing.

ps- I've reached out to the maintainer for the Gentoo libvirt ebuilds
with a bug report on the building a proper libvirt from git
(=app-emulation/libvirt- in Gentoo speak).

Additional info:

My system has 2 physical NICs and one bridge.

   1. eth0 = internal LAN, default gateway for LAN.
   2. eth1 = my public IP (off of residential DSL)
   3. br0 = totally internal to my server.  Not connected to either eth0 or
   eth1.  Use by QEMU to create vnetNNN interfaces off of.

I run a custom iptables ruleset to (very high level):

   1. NAT traffic from eth0, br0 out eth1
   2. block br0 from initiating a connection into eth0
   3. permit traffic from eth0 to go into systems on br0

I have a DHCP server running on the host, answering on eth0 and br0.

I'm _not_ using QEMU's built-in nat method for assigning a NIC to a VM
(virbr0 or whatever).

Is my setup compatible with DHCP snooping by libvirt?
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH V10 0/7] Add DHCP snooping support to nwfilter

2012-04-17 Thread dennis jenkins
On Mon, Apr 16, 2012 at 2:33 PM, dennis jenkins dennis.jenkins...@gmail.com
 wrote:

 On Mon, Apr 16, 2012 at 2:22 PM, Stefan Berger stef...@linux.vnet.ibm.com
  wrote:

 **
 On 04/16/2012 03:12 PM, dennis jenkins wrote:

 On Mon, Apr 16, 2012 at 10:08 AM, Stefan Berger 
 stef...@linux.vnet.ibm.com wrote:

 This series of patches adds DHCP snooping support to libvirt's
 nwfilter subsystem.


 Stefan, David,

Thank you very much for this functionality.  As a side-effect, it
 solves a problem that I needed addressed: namely, to know via Sys-Virt, the
 IP address associated with a virtual machine (without having to grovel
 through the DHCP lease file, out of band).


 Dennis,

   that's great to hear. Did you test them?

   Stefan


 Not yet.  I run Gentoo Linux, and I try to keep my system really clean by
 not having manually installed packages.  However, if you would like some
 independent testing, I can tinker with it.  I have to figure out the ins
 and outs of GIT first, though.  I do my own stuff with SVN and have not
 learned git yet.

 The latest libvirt in Gentoo is version 0.9.10-r4.  Ignoring the -r4,
 9.10 is about 2 months old, correct?  So I might be waiting a while for
 this patch to make it to my portage tree.

 Is there a specific git command line that I should use to pull a specific
 libvirt code set, or should I just go for the head / bleeding edge?

 Stefan,

   There is a potential bug [1] in the Gentoo package that tracks the
libvirt git repository.  I will wait a few days for the Gentoo folks to
sort it out.  If not, I will remove the Gentoo libvirt package and install
the latest from git manually.  I intend to test this feature and provide
feedback for you.  Again, thank you for this feature.  I understand that
your implementation is to address a network security concern.

I intend to expand to apache/mod_perl/Sys-Virt/libvirt management tool
to concurrently monitor QEMU and LXC.  It would be nice if I could get the
IP address for each virtual system in a uniform way.  I do not know if this
is a feasible feature to request.  I will already have to work around the
differences between QEMU and LXC in code, so this isn't a huge deal.  Just
a suggestion for a possible future feature.

[1] http://forums.gentoo.org/viewtopic-p-7015930.html#7015930
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH V10 0/7] Add DHCP snooping support to nwfilter

2012-04-16 Thread dennis jenkins
On Mon, Apr 16, 2012 at 10:08 AM, Stefan Berger
stef...@linux.vnet.ibm.comwrote:

 This series of patches adds DHCP snooping support to libvirt's
 nwfilter subsystem.


Stefan, David,

   Thank you very much for this functionality.  As a side-effect, it solves
a problem that I needed addressed: namely, to know via Sys-Virt, the IP
address associated with a virtual machine (without having to grovel through
the DHCP lease file, out of band).
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH V10 0/7] Add DHCP snooping support to nwfilter

2012-04-16 Thread dennis jenkins
On Mon, Apr 16, 2012 at 2:22 PM, Stefan Berger
stef...@linux.vnet.ibm.comwrote:

 **
 On 04/16/2012 03:12 PM, dennis jenkins wrote:

 On Mon, Apr 16, 2012 at 10:08 AM, Stefan Berger 
 stef...@linux.vnet.ibm.com wrote:

 This series of patches adds DHCP snooping support to libvirt's
 nwfilter subsystem.


 Stefan, David,

Thank you very much for this functionality.  As a side-effect, it
 solves a problem that I needed addressed: namely, to know via Sys-Virt, the
 IP address associated with a virtual machine (without having to grovel
 through the DHCP lease file, out of band).


 Dennis,

   that's great to hear. Did you test them?

   Stefan


Not yet.  I run Gentoo Linux, and I try to keep my system really clean by
not having manually installed packages.  However, if you would like some
independent testing, I can tinker with it.  I have to figure out the ins
and outs of GIT first, though.  I do my own stuff with SVN and have not
learned git yet.

The latest libvirt in Gentoo is version 0.9.10-r4.  Ignoring the -r4,
9.10 is about 2 months old, correct?  So I might be waiting a while for
this patch to make it to my portage tree.

Is there a specific git command line that I should use to pull a specific
libvirt code set, or should I just go for the head / bleeding edge?
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH V9 0/6] Add DHCP snooping support to nwfilter

2012-04-13 Thread dennis jenkins
On Fri, Apr 13, 2012 at 10:09 AM, Stefan Berger
stef...@linux.vnet.ibm.comwrote:

 This series of patches adds DHCP snooping support to libvirt's
 nwfilter subsystem.

 DHCP snooping detects DHCP leases obtained by a VM and automatically
 adjusts the network traffic filters to reflect the IP addresses
 with which a VM may send its traffic, thus for example preventing
 IP address spoofing.
 Once leases on IP addresses expire or if a VM gives up on a
 lease on an IP address, the filters are also adjusted.
 All leases are persisted and automatically applied upon a VM's restart.
 Leases are associated with the tuple of VM-UUID and interface MAC
 address.

 The following interface XML activates and uses the DHCP snooping:

interface type='bridge'
  source bridge='virbr0'/
  filterref filter='clean-traffic'
parameter name='ip_learning' value='dhcp'/
  /filterref
/interface


 Regards,
   David and Stefan



Would libvirt (via the perl wrapper) be able to query the IP address
information?

I am developing a light-weight web interface for managing several QEMU
instances on my server (apache, mod_perl, Sys-Virt, libvirtd).  I can get
the MAC address of each VM from the XML file ($dom-get_xml_description,
XML::Simple), but at the moment I do not have a clean way to get the
corresponding IP address.

My system runs its own DHCP server and arpwatch.  I was considering
trying to extract the MAC-IP mapping from those, but if QEMU/libvirtd
itself knows the IP in use by the VM, then that would be fantastic.

I should mention that I'm using br0, not virbr0 style bridges.  I don't
know if that matters.

Thank you guys for your excellent work and your time.  Libvirt and the
wrapper APIs are incredibly useful.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list