Re: [libvirt] [PATCH] [RFC] nwfilter: fix loadable module support

2010-06-15 Thread Daniel P. Berrange
On Mon, Jun 14, 2010 at 07:49:50AM -0400, Stefan Berger wrote:
 Hello!
 
 I am trying to fix the loadable modules support by removing all direct 
 calls from qemu_driver.c and qemu_conf.c into nwfilter functions. The 
 below patch extends the nwfilter driver interface with 2 more private 
 functions to instantiate and tear down the filters. I call them 
 'private' because no client should ever be calling them via RPC and be 
 able to tear down the filters for example -- they should only ever be 
 callable from within libvirtd.
 
 I extended the qemudShutdownVMDaemon function with the virConnectPtr 
 type of parameter so that I have the pointer to conn-nwfilterDriver to 
 access the private nwfilter driver functions. The problem with that is 
 that the conn pointer is not always available to be passed 
 (qemuReconnectDomain, qemuHandleMonitorEOF), particularly in tear-down 
 functions, and so I have to pass a NULL pointer, which then prevents the 
 calling of the private interface function to tear down the filters.Does 
 anyone have a suggestion on how I would best change the interface with 
 the nwfilter driver to fix this particular problem?

This problem is an artifact of trying to hook this into the main API
driver tables.

In our architecture we want the nwfilter  qemu drivers to be separately
loadable modules, without any hard dependancy between them in either
direction.

Thus the first step is to kill the following two includes from the QEMU
driver source, since using any functions from this header implies that
there's a hard compile time dependancy from QEMU to nwfilter

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index a4f06fb..6d99044 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -54,7 +54,6 @@
 #include network.h
 #include macvtap.h
 #include cpu/cpu.h
-#include nwfilter/nwfilter_gentech_driver.h
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 670ef5d..f9deff6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -81,7 +81,6 @@
 #include xml.h
 #include cpu/cpu.h
 #include macvtap.h
-#include nwfilter/nwfilter_gentech_driver.h
 #include hooks.h
 #include storage_file.h
 

The resulting compile errors show:

qemu/qemu_conf.c: In function ‘qemudNetworkIfaceConnect’:
qemu/qemu_conf.c:1694: error: implicit declaration of function 
‘virNWFilterInstantiateFilter’ [-Wimplicit-function-declaration]
qemu/qemu_conf.c:1694: error: nested extern declaration of 
‘virNWFilterInstantiateFilter’ [-Wnested-externs]
qemu/qemu_conf.c: In function ‘qemudBuildCommandLine’:
qemu/qemu_conf.c:4213: error: implicit declaration of function 
‘virNWFilterTearNWFilter’ [-Wimplicit-function-declaration]
qemu/qemu_conf.c:4213: error: nested extern declaration of 
‘virNWFilterTearNWFilter’ [-Wnested-externs]
qemu/qemu_driver.c: In function ‘qemudStartVMDaemon’:
qemu/qemu_driver.c:3566: error: implicit declaration of function 
‘virNWFilterTearVMNWFilters’ [-Wimplicit-function-declaration]
qemu/qemu_driver.c:3566: error: nested extern declaration of 
‘virNWFilterTearVMNWFilters’ [-Wnested-externs]
qemu/qemu_driver.c: In function ‘qemudDomainAttachNetDevice’:
qemu/qemu_driver.c:7634: error: implicit declaration of function 
‘virNWFilterTearNWFilter’ [-Wimplicit-function-declaration]
qemu/qemu_driver.c:7634: error: nested extern declaration of 
‘virNWFilterTearNWFilter’ [-Wnested-externs]


For loadable modules to work, we need to be able to call those
functions regardless of whether any module is loaded. I would
thus suggest we introduce two new files:

src/conf/domain_nwfilter.h
src/conf/domain_nwfilter.c

And add them to DOMAIN_CONF_SOURCES  in Makefile.am so that they
are compiled into the main binary at all times, thus accessible
to all driver loadable modules.

They should not contain any functional code, just be a glue layer
similar to driver.h, but without any virConnectPtr involved:

   typedef int (*virDomainConfNetFilterSetupDrv)(virDomainNetDefPtr net);
   typedef int (*virDomainConfNetFilterCleanupDrv)(virDomainNetDefPtr net);

   typedef struct {
  virDomainConfNetFilterSetupDrv net;
  virDomainConfNetFilterCleanupDrv net;
   } virDomainConfNetFilterDrv;

   void virDomainConfNetFilterRegister(virDomainConfNetFilterDrv driver);

   int virDomainConfNetFilterSetup(virDomainNetDefPtr net);
   int virDomainConfNetFilterCleanup(virDomainNetDefPtr net);


So, when the nwfilter driver is loaded it calls virDomainConfNetFilterRegister()
to register the setup/teardown functions.

When QEMU needs to add/remove a NIC it calls virDomainConfNetFilterSetup
and virDomainConfNetFilterCleanup appropriately. None of the code now 
requires any virConnectPtr object, and we have totally decoupled the
QEMU and NWfilter drivers


Regards,
Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: 

[libvirt] printf()'s in virsh?

2010-06-15 Thread Justin Clift

Hi guys,

In virsh, in the cmdSchedinfo() function, there's a block of code using 
printf instead of vshPrintf():


  for (i = 0; i  nparams; i++){
  switch (params[i].type) {
  case VIR_DOMAIN_SCHED_FIELD_INT:
   printf(%-15s: %d\n,  params[i].field, params[i].value.i);
   break;
  case VIR_DOMAIN_SCHED_FIELD_UINT:
   printf(%-15s: %u\n,  params[i].field, params[i].value.ui);
   break;
  case VIR_DOMAIN_SCHED_FIELD_LLONG:
   printf(%-15s: %lld\n,  params[i].field, params[i].value.l);
   break;
  case VIR_DOMAIN_SCHED_FIELD_ULLONG:
   printf(%-15s: %llu\n,  params[i].field, params[i].value.ul);
   break;
  case VIR_DOMAIN_SCHED_FIELD_DOUBLE:
   printf(%-15s: %f\n,  params[i].field, params[i].value.d);
   break;
  case VIR_DOMAIN_SCHED_FIELD_BOOLEAN:
   printf(%-15s: %d\n,  params[i].field, params[i].value.b);
   break;
  default:
   printf(not implemented scheduler parameter type\n);
  }
  }

These should be vshPrintf() shouldn't they?

Regards and best wishes,

Justin Clift

--
Salasaga  -  Open Source eLearning IDE
  http://www.salasaga.org

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


[libvirt] [PATCH] Allow one-or-more boot dev=.../ entries

2010-06-15 Thread Philipp Hahn

According to docs/formatdomain.html.in, The boot element can be
repeated multiple times to setup a priority list of boot devices to try
in turn. The Relax-NG schema required / allowed exactly one entry.

Signed-off-by: Philipp Hahn h...@univention.de
---
 docs/schemas/domain.rng |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 9121da3..99a37f2 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -115,7 +115,9 @@
 /optional
 choice
   ref name=osbootkernel/
-  ref name=osbootdev/
+  oneOrMore
+ref name=osbootdev/
+  /oneOrMore
 /choice
   /interleave
 /element
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] Allow one-or-more boot dev=.../ entries

2010-06-15 Thread Philipp Hahn

According to docs/formatdomain.html.in, The boot element can be
repeated multiple times to setup a priority list of boot devices to try
in turn. The Relax-NG schema required / allowed exactly one entry.

Signed-off-by: Philipp Hahn h...@univention.de
---
 docs/schemas/domain.rng |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 9121da3..99a37f2 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -115,7 +115,9 @@
 /optional
 choice
   ref name=osbootkernel/
-  ref name=osbootdev/
+  oneOrMore
+ref name=osbootdev/
+  /oneOrMore
 /choice
   /interleave
 /element
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] Fix description of virStorageVolGetInfo()

2010-06-15 Thread Philipp Hahn

Probably a copy-paste-bug in python/libvirt-override-api.xml:
virStorageVolGetInfo() extracts information about a storage volume,
not the storage pool as virStoragePoolGetInfo() does.

Signed-off-by: Philipp Hahn h...@univention.de
---
 python/libvirt-override-api.xml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index be28b40..ca16993 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -183,7 +183,7 @@
   arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/
 /function
 function name='virStorageVolGetInfo' file='python'
-  infoExtract information about a storage pool. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted./info
+  infoExtract information about a storage volume. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted./info
   return type='int *' info='the list of information or None in case of error'/
   arg name='vol' type='virStorageVolPtr' info='a storage vol object'/
 /function
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 0/2]: Small fixes for PCI device assignment

2010-06-15 Thread Chris Lalancette
This series fixes a couple of bugs found while testing libvirt PCI
device assignment.

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


[libvirt] [PATCH 1/2] Check for active PCI devices when doing nodedevice operations.

2010-06-15 Thread Chris Lalancette
In the current libvirt PCI code, there is no checking whether
a PCI device is in use by a guest when doing node device
detach or reattach.  This causes problems when a device is
assigned to a guest, and the administrator starts issuing
nodedevice commands.  Make it so that we check the list
of active devices when trying to detach/reattach, and only
allow the operation if the device is not assigned to a guest.

Signed-off-by: Chris Lalancette clala...@redhat.com
---
 src/qemu/qemu_driver.c |   20 +++-
 src/util/pci.c |   16 ++--
 src/util/pci.h |4 ++--
 src/xen/xen_driver.c   |4 ++--
 4 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fc5585e..66e9f52 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2858,7 +2858,7 @@ qemuPrepareHostPCIDevices(struct qemud_driver *driver,
 goto cleanup;
 
 if (pciDeviceGetManaged(dev) 
-pciDettachDevice(dev)  0)
+pciDettachDevice(dev, driver-activePciHostdevs)  0)
 goto cleanup;
 }
 
@@ -2938,7 +2938,7 @@ qemuPrepareHostDevices(struct qemud_driver *driver,
 
 
 static void
-qemudReattachManagedDevice(pciDevice *dev)
+qemudReattachManagedDevice(pciDevice *dev, struct qemud_driver *driver)
 {
 int retries = 100;
 
@@ -2948,7 +2948,7 @@ qemudReattachManagedDevice(pciDevice *dev)
 usleep(100*1000);
 retries--;
 }
-if (pciReAttachDevice(dev)  0) {
+if (pciReAttachDevice(dev, driver-activePciHostdevs)  0) {
 virErrorPtr err = virGetLastError();
 VIR_ERROR(_(Failed to re-attach PCI device: %s),
   err ? err-message : _(unknown error));
@@ -2995,7 +2995,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,
 
 for (i = 0; i  pciDeviceListCount(pcidevs); i++) {
 pciDevice *dev = pciDeviceListGet(pcidevs, i);
-qemudReattachManagedDevice(dev);
+qemudReattachManagedDevice(dev, driver);
 }
 
 pciDeviceListFree(pcidevs);
@@ -7727,7 +7727,7 @@ static int qemudDomainAttachHostPciDevice(struct 
qemud_driver *driver,
 return -1;
 
 if (!pciDeviceIsAssignable(pci, !driver-relaxedACS) ||
-(hostdev-managed  pciDettachDevice(pci)  0) ||
+(hostdev-managed  pciDettachDevice(pci, driver-activePciHostdevs) 
 0) ||
 pciResetDevice(pci, driver-activePciHostdevs)  0) {
 pciFreeDevice(pci);
 return -1;
@@ -7815,7 +7815,7 @@ error:
 if (pciResetDevice(pci, driver-activePciHostdevs)  0)
 VIR_WARN0(Unable to reset PCI device after assign failure);
 else if (hostdev-managed 
- pciReAttachDevice(pci)  0)
+ pciReAttachDevice(pci, driver-activePciHostdevs)  0)
 VIR_WARN0(Unable to re-attach PCI device after assign failure);
 pciFreeDevice(pci);
 
@@ -8726,7 +8726,7 @@ static int qemudDomainDetachHostPciDevice(struct 
qemud_driver *driver,
 pciDeviceListDel(driver-activePciHostdevs, pci);
 if (pciResetDevice(pci, driver-activePciHostdevs)  0)
 ret = -1;
-qemudReattachManagedDevice(pci);
+qemudReattachManagedDevice(pci, driver);
 pciFreeDevice(pci);
 }
 
@@ -11179,6 +11179,7 @@ out:
 static int
 qemudNodeDeviceDettach (virNodeDevicePtr dev)
 {
+struct qemud_driver *driver = dev-conn-privateData;
 pciDevice *pci;
 unsigned domain, bus, slot, function;
 int ret = -1;
@@ -11190,7 +11191,7 @@ qemudNodeDeviceDettach (virNodeDevicePtr dev)
 if (!pci)
 return -1;
 
-if (pciDettachDevice(pci)  0)
+if (pciDettachDevice(pci, driver-activePciHostdevs)  0)
 goto out;
 
 ret = 0;
@@ -11202,6 +11203,7 @@ out:
 static int
 qemudNodeDeviceReAttach (virNodeDevicePtr dev)
 {
+struct qemud_driver *driver = dev-conn-privateData;
 pciDevice *pci;
 unsigned domain, bus, slot, function;
 int ret = -1;
@@ -11213,7 +11215,7 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
 if (!pci)
 return -1;
 
-if (pciReAttachDevice(pci)  0)
+if (pciReAttachDevice(pci, driver-activePciHostdevs)  0)
 goto out;
 
 ret = 0;
diff --git a/src/util/pci.c b/src/util/pci.c
index 0c6d308..fe128db 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -815,7 +815,7 @@ pciBindDeviceToStub(pciDevice *dev, const char *driver)
 }
 
 int
-pciDettachDevice(pciDevice *dev)
+pciDettachDevice(pciDevice *dev, pciDeviceList *activeDevs)
 {
 const char *driver = pciFindStubDriver();
 if (!driver) {
@@ -824,6 +824,12 @@ pciDettachDevice(pciDevice *dev)
 return -1;
 }
 
+if (activeDevs  pciDeviceListFind(activeDevs, dev)) {
+pciReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Not detaching active device %s), dev-name);
+return -1;
+}
+
 return pciBindDeviceToStub(dev, driver);
 }
 
@@ -876,7 +882,7 @@ 

[libvirt] [PATCH 2/2] Fix crash when detaching devices from qemu domains.

2010-06-15 Thread Chris Lalancette
Make sure to *not* call qemuDomainPCIAddressReleaseAddr if
QEMUD_CMD_FLAG_DEVICE is *not* set (for older qemu).  This
prevents a crash when trying to do device detachment from
a qemu guest.

Signed-off-by: Chris Lalancette clala...@redhat.com
---
 src/qemu/qemu_driver.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 66e9f52..93072a4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8522,9 +8522,9 @@ static int qemudDomainDetachPciControllerDevice(struct 
qemud_driver *driver,
 vm-def-ncontrollers = 0;
 }
 
-if (qemuDomainPCIAddressReleaseAddr(priv-pciaddrs, detach-info)  0) {
+if ((qemuCmdFlags  QEMUD_CMD_FLAG_DEVICE) 
+qemuDomainPCIAddressReleaseAddr(priv-pciaddrs, detach-info)  0)
 VIR_WARN0(Unable to release PCI address on controller);
-}
 
 virDomainControllerDefFree(detach);
 
@@ -8730,9 +8730,9 @@ static int qemudDomainDetachHostPciDevice(struct 
qemud_driver *driver,
 pciFreeDevice(pci);
 }
 
-if (qemuDomainPCIAddressReleaseAddr(priv-pciaddrs, detach-info)  0) {
+if ((qemuCmdFlags  QEMUD_CMD_FLAG_DEVICE) 
+qemuDomainPCIAddressReleaseAddr(priv-pciaddrs, detach-info)  0)
 VIR_WARN0(Unable to release PCI address on controller);
-}
 
 if (vm-def-nhostdevs  1) {
 memmove(vm-def-hostdevs + i,
-- 
1.6.6.1

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


[libvirt] [PATCH v2] nwfilter: fix loadable module support

2010-06-15 Thread Stefan Berger
Following Daniel Berrange's suggestion of introducing another driver 
interface, I now wrote the below patch where the nwfilter driver 
registers the functions to instantiate and teardown the nwfilters with a 
function in conf/domain_nwfilter.c called virDomainConfNWFilterRegister. 
Previous helper functions that were called from qemu_driver.c and 
qemu_conf.c were move into conf/domain_nwfilter.h with slight renaming 
done for consistency. Those functions now call the function expored by 
domain_nwfilter.c, which in turn call the functions of the new driver 
interface, if available.


Signed-off-by: Stefan Berger stef...@us.ibm.com


---
 src/Makefile.am|3 -
 src/conf/domain_nwfilter.c |   51 
 src/conf/domain_nwfilter.h |   68 
+

 src/libvirt_private.syms   |5 ++
 src/nwfilter/nwfilter_driver.c |   22 ++
 src/nwfilter/nwfilter_gentech_driver.h |   17 
 src/qemu/qemu_conf.c   |   11 ++---
 src/qemu/qemu_driver.c |2
 8 files changed, 155 insertions(+), 24 deletions(-)

Index: libvirt-acl/src/nwfilter/nwfilter_gentech_driver.h
===
--- libvirt-acl.orig/src/nwfilter/nwfilter_gentech_driver.h
+++ libvirt-acl/src/nwfilter/nwfilter_gentech_driver.h
@@ -67,21 +67,4 @@ void virNWFilterDomainFWUpdateCB(void *p
  const char *name ATTRIBUTE_UNUSED,
  void *data);

-
-/* tear down an interface's filter before tearing down the interface */
-static inline void
-virNWFilterTearNWFilter(virDomainNetDefPtr net) {
-if ((net-filter)  (net-ifname))
-virNWFilterTeardownFilter(net);
-}
-
-
-static inline void
-virNWFilterTearVMNWFilters(virDomainObjPtr vm) {
-int i;
-
-for (i = 0; i  vm-def-nnets; i++)
-virNWFilterTearNWFilter(vm-def-nets[i]);
-}
-
 #endif
Index: libvirt-acl/src/qemu/qemu_conf.c
===
--- libvirt-acl.orig/src/qemu/qemu_conf.c
+++ libvirt-acl/src/qemu/qemu_conf.c
@@ -54,7 +54,7 @@
 #include network.h
 #include macvtap.h
 #include cpu/cpu.h
-#include nwfilter/nwfilter_gentech_driver.h
+#include domain_nwfilter.h

 #define VIR_FROM_THIS VIR_FROM_QEMU

@@ -1514,9 +1514,10 @@ int qemudExtractVersion(struct qemud_dri
 /**
  * qemudPhysIfaceConnect:
  * @conn: pointer to virConnect object
+ * @driver: pointer to the qemud_driver
  * @net: pointer to he VM's interface description with direct device type
- * @linkdev: The name of the physical interface to link the macvtap to
- * @brmode: The mode to put the macvtap device into
+ * @qemuCmdFlags: flags for qemu
+ * @vmuuid: The UUID of the VM (needed by 802.1Qbh)
  *
  * Returns a filedescriptor on success or -1 in case of error.
  */
@@ -1555,7 +1556,7 @@ qemudPhysIfaceConnect(virConnectPtr conn

 if (rc = 0) {
 if ((net-filter)  (net-ifname)) {
-err = virNWFilterInstantiateFilter(conn, net);
+err = virNWFilterInstantiateNWFilter(conn, net);
 if (err) {
 close(rc);
 rc = -1;
@@ -1688,7 +1689,7 @@ qemudNetworkIfaceConnect(virConnectPtr c

 if (tapfd = 0) {
 if ((net-filter)  (net-ifname)) {
-err = virNWFilterInstantiateFilter(conn, net);
+err = virNWFilterInstantiateNWFilter(conn, net);
 if (err) {
 close(tapfd);
 tapfd = -1;
Index: libvirt-acl/src/qemu/qemu_driver.c
===
--- libvirt-acl.orig/src/qemu/qemu_driver.c
+++ libvirt-acl/src/qemu/qemu_driver.c
@@ -81,7 +81,7 @@
 #include xml.h
 #include cpu/cpu.h
 #include macvtap.h
-#include nwfilter/nwfilter_gentech_driver.h
+#include domain_nwfilter.h
 #include hooks.h
 #include storage_file.h

Index: libvirt-acl/src/Makefile.am
===
--- libvirt-acl.orig/src/Makefile.am
+++ libvirt-acl/src/Makefile.am
@@ -97,7 +97,8 @@ DRIVER_SOURCES =\
 # Domain driver generic impl APIs
 DOMAIN_CONF_SOURCES =\
 conf/capabilities.c conf/capabilities.h\
-conf/domain_conf.c conf/domain_conf.h
+conf/domain_conf.c conf/domain_conf.h\
+conf/domain_nwfilter.c conf/domain_nwfilter.h

 DOMAIN_EVENT_SOURCES =\
 conf/domain_event.c conf/domain_event.h
Index: libvirt-acl/src/conf/domain_nwfilter.h
===
--- /dev/null
+++ libvirt-acl/src/conf/domain_nwfilter.h
@@ -0,0 +1,68 @@
+/*
+ * domain_nwfilter.h:
+ *
+ * Copyright (C) 2010 IBM Corporation
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU 

Re: [libvirt] [PATCH 1/2] Check for active PCI devices when doing nodedevice operations.

2010-06-15 Thread Daniel P. Berrange
On Tue, Jun 15, 2010 at 08:03:11AM -0400, Chris Lalancette wrote:
 In the current libvirt PCI code, there is no checking whether
 a PCI device is in use by a guest when doing node device
 detach or reattach.  This causes problems when a device is
 assigned to a guest, and the administrator starts issuing
 nodedevice commands.  Make it so that we check the list
 of active devices when trying to detach/reattach, and only
 allow the operation if the device is not assigned to a guest.
 
 Signed-off-by: Chris Lalancette clala...@redhat.com
 ---
  src/qemu/qemu_driver.c |   20 +++-
  src/util/pci.c |   16 ++--
  src/util/pci.h |4 ++--
  src/xen/xen_driver.c   |4 ++--
  4 files changed, 29 insertions(+), 15 deletions(-)
 
 @@ -11179,6 +11179,7 @@ out:
  static int
  qemudNodeDeviceDettach (virNodeDevicePtr dev)
  {
 +struct qemud_driver *driver = dev-conn-privateData;
  pciDevice *pci;
  unsigned domain, bus, slot, function;
  int ret = -1;
 @@ -11190,7 +11191,7 @@ qemudNodeDeviceDettach (virNodeDevicePtr dev)
  if (!pci)
  return -1;
  
 -if (pciDettachDevice(pci)  0)
 +if (pciDettachDevice(pci, driver-activePciHostdevs)  0)
  goto out;
  
  ret = 0;
 @@ -11202,6 +11203,7 @@ out:
  static int
  qemudNodeDeviceReAttach (virNodeDevicePtr dev)
  {
 +struct qemud_driver *driver = dev-conn-privateData;
  pciDevice *pci;
  unsigned domain, bus, slot, function;
  int ret = -1;
 @@ -11213,7 +11215,7 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
  if (!pci)
  return -1;
  
 -if (pciReAttachDevice(pci)  0)
 +if (pciReAttachDevice(pci, driver-activePciHostdevs)  0)
  goto out;
  
  ret = 0;

You're accessing 'driver' here without first locking it

Regards,
Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org-o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


Re: [libvirt] [PATCH 1/2] Check for active PCI devices when doing nodedevice operations.

2010-06-15 Thread Chris Lalancette
On 06/15/10 - 01:13:00PM, Daniel P. Berrange wrote:
  @@ -11179,6 +11179,7 @@ out:
   static int
   qemudNodeDeviceDettach (virNodeDevicePtr dev)
   {
  +struct qemud_driver *driver = dev-conn-privateData;
   pciDevice *pci;
   unsigned domain, bus, slot, function;
   int ret = -1;
  @@ -11190,7 +11191,7 @@ qemudNodeDeviceDettach (virNodeDevicePtr dev)
   if (!pci)
   return -1;
   
  -if (pciDettachDevice(pci)  0)
  +if (pciDettachDevice(pci, driver-activePciHostdevs)  0)
   goto out;
   
   ret = 0;
  @@ -11202,6 +11203,7 @@ out:
   static int
   qemudNodeDeviceReAttach (virNodeDevicePtr dev)
   {
  +struct qemud_driver *driver = dev-conn-privateData;
   pciDevice *pci;
   unsigned domain, bus, slot, function;
   int ret = -1;
  @@ -11213,7 +11215,7 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
   if (!pci)
   return -1;
   
  -if (pciReAttachDevice(pci)  0)
  +if (pciReAttachDevice(pci, driver-activePciHostdevs)  0)
   goto out;
   
   ret = 0;
 
 You're accessing 'driver' here without first locking it

D'oh, of course.  Thanks for that.  Updated patch below.
From 56b1d0463790b52e23975968c54d4f9f9a3c5fbd Mon Sep 17 00:00:00 2001
From: Chris Lalancette clala...@redhat.com
Date: Mon, 14 Jun 2010 17:12:35 -0400
Subject: [PATCH v2 1/2] Check for active PCI devices when doing nodedevice 
operations.

In the current libvirt PCI code, there is no checking whether
a PCI device is in use by a guest when doing node device
detach or reattach.  This causes problems when a device is
assigned to a guest, and the administrator starts issuing
nodedevice commands.  Make it so that we check the list
of active devices when trying to detach/reattach, and only
allow the operation if the device is not assigned to a guest.

v2: Add locking to qemudNodeDeviceDettach and qemudNodeDeviceReAttach

Signed-off-by: Chris Lalancette clala...@redhat.com
---
 src/qemu/qemu_driver.c |   24 +++-
 src/util/pci.c |   16 ++--
 src/util/pci.h |4 ++--
 src/xen/xen_driver.c   |4 ++--
 4 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fc5585e..769ee0f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2858,7 +2858,7 @@ qemuPrepareHostPCIDevices(struct qemud_driver *driver,
 goto cleanup;
 
 if (pciDeviceGetManaged(dev) 
-pciDettachDevice(dev)  0)
+pciDettachDevice(dev, driver-activePciHostdevs)  0)
 goto cleanup;
 }
 
@@ -2938,7 +2938,7 @@ qemuPrepareHostDevices(struct qemud_driver *driver,
 
 
 static void
-qemudReattachManagedDevice(pciDevice *dev)
+qemudReattachManagedDevice(pciDevice *dev, struct qemud_driver *driver)
 {
 int retries = 100;
 
@@ -2948,7 +2948,7 @@ qemudReattachManagedDevice(pciDevice *dev)
 usleep(100*1000);
 retries--;
 }
-if (pciReAttachDevice(dev)  0) {
+if (pciReAttachDevice(dev, driver-activePciHostdevs)  0) {
 virErrorPtr err = virGetLastError();
 VIR_ERROR(_(Failed to re-attach PCI device: %s),
   err ? err-message : _(unknown error));
@@ -2995,7 +2995,7 @@ qemuDomainReAttachHostDevices(struct qemud_driver *driver,
 
 for (i = 0; i  pciDeviceListCount(pcidevs); i++) {
 pciDevice *dev = pciDeviceListGet(pcidevs, i);
-qemudReattachManagedDevice(dev);
+qemudReattachManagedDevice(dev, driver);
 }
 
 pciDeviceListFree(pcidevs);
@@ -7727,7 +7727,7 @@ static int qemudDomainAttachHostPciDevice(struct 
qemud_driver *driver,
 return -1;
 
 if (!pciDeviceIsAssignable(pci, !driver-relaxedACS) ||
-(hostdev-managed  pciDettachDevice(pci)  0) ||
+(hostdev-managed  pciDettachDevice(pci, driver-activePciHostdevs) 
 0) ||
 pciResetDevice(pci, driver-activePciHostdevs)  0) {
 pciFreeDevice(pci);
 return -1;
@@ -7815,7 +7815,7 @@ error:
 if (pciResetDevice(pci, driver-activePciHostdevs)  0)
 VIR_WARN0(Unable to reset PCI device after assign failure);
 else if (hostdev-managed 
- pciReAttachDevice(pci)  0)
+ pciReAttachDevice(pci, driver-activePciHostdevs)  0)
 VIR_WARN0(Unable to re-attach PCI device after assign failure);
 pciFreeDevice(pci);
 
@@ -8726,7 +8726,7 @@ static int qemudDomainDetachHostPciDevice(struct 
qemud_driver *driver,
 pciDeviceListDel(driver-activePciHostdevs, pci);
 if (pciResetDevice(pci, driver-activePciHostdevs)  0)
 ret = -1;
-qemudReattachManagedDevice(pci);
+qemudReattachManagedDevice(pci, driver);
 pciFreeDevice(pci);
 }
 
@@ -11179,6 +11179,7 @@ out:
 static int
 qemudNodeDeviceDettach (virNodeDevicePtr dev)
 {
+struct qemud_driver *driver = dev-conn-privateData;
 pciDevice *pci;
 unsigned domain, bus, slot, 

Re: [libvirt] [PATCH] maint: simplify some ignore files

2010-06-15 Thread Jiri Denemark
 * .hgignore: Delete, no longer used.
 * examples/python/.gitignore: Delete, covered globally.
 * include/.gitignore: Likewise.
 * python/tests/.gitignore: Likewise.
 * docs/schemas/.gitignore: Likewise.
 * tests/xml2sexprdata/.gitignore: Likewise.
 * tests/sexpr2xmldata/.gitignore: Likewise.
 * tests/confdata/.gitignore: Likewise.
 * tests/xencapsdata/.gitignore: Likewise.
 * tests/xmconfigdata/.gitignore: Likewise.
 * tests/xml2sexprdata/.gitignore: Likewise.

Make sense, ACK.

Jirka

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


Re: [libvirt] [PATCH] maint: simplify some ignore files

2010-06-15 Thread Eric Blake
On 06/15/2010 07:29 AM, Jiri Denemark wrote:
 * .hgignore: Delete, no longer used.
 * examples/python/.gitignore: Delete, covered globally.
 * include/.gitignore: Likewise.
 * python/tests/.gitignore: Likewise.
 * docs/schemas/.gitignore: Likewise.
 * tests/xml2sexprdata/.gitignore: Likewise.
 * tests/sexpr2xmldata/.gitignore: Likewise.
 * tests/confdata/.gitignore: Likewise.
 * tests/xencapsdata/.gitignore: Likewise.
 * tests/xmconfigdata/.gitignore: Likewise.
 * tests/xml2sexprdata/.gitignore: Likewise.
 
 Make sense, ACK.

Thanks; pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] esx: Accept 'disk' as harddisk device type in .vmx files

2010-06-15 Thread Jiri Denemark
  src/esx/esx_vmx.c |   12 
  1 files changed, 8 insertions(+), 4 deletions(-)
 
 diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
 index 5cadb5a..675318f 100644
 --- a/src/esx/esx_vmx.c
 +++ b/src/esx/esx_vmx.c
 @@ -1542,16 +1542,20 @@ esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, 
 int device, int bus,
  if (virFileHasSuffix(fileName, .vmdk)) {
  if (deviceType != NULL) {
  if (bus == VIR_DOMAIN_DISK_BUS_SCSI 
 -STRCASENEQ(deviceType, scsi-hardDisk)) {
 +STRCASENEQ(deviceType, scsi-hardDisk) 
 +STRCASENEQ(deviceType, disk)) {
  ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
_(Expecting VMX entry '%s' to be 
 'scsi-hardDisk' 
 -but found '%s'), deviceType_name, 
 deviceType);
 +or 'disk' but found '%s'), deviceType_name,
 +  deviceType);
  goto cleanup;
  } else if (bus == VIR_DOMAIN_DISK_BUS_IDE 
 -   STRCASENEQ(deviceType, ata-hardDisk)) {
 +   STRCASENEQ(deviceType, ata-hardDisk) 
 +   STRCASENEQ(deviceType, disk)) {
  ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
_(Expecting VMX entry '%s' to be 
 'ata-hardDisk' 
 -but found '%s'), deviceType_name, 
 deviceType);
 +or 'disk' but found '%s'), deviceType_name,
 +  deviceType);
  goto cleanup;
  }
  }

ACK

Jirka

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


Re: [libvirt] [PATCH] esx: Update case insensitive .vmx tests

2010-06-15 Thread Jiri Denemark
 Commit b9efc7dc3b97ef667ab99cee884b8485ebcb2f91 made virFileHasSuffix
 case insensitive. Honor this in the tests by switching vmdk to VMDK.
 ---
  tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx |2 +-
  tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx 
 b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx
 index 3626c5e..bd36cf8 100644
 --- a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx
 +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx
 @@ -18,7 +18,7 @@ SCSI0.SHAREDBUS = NONE
  SCSI0.VIRTUALDEV = LSILOGIC
  MEMSIZE = 1024
  SCSI0:0.PRESENT = TRUE
 -SCSI0:0.FILENAME = FEDORA11.vmdk
 +SCSI0:0.FILENAME = FEDORA11.VMDK
  SCSI0:0.DEVICETYPE = SCSI-HARDDISK
  IDE0:0.PRESENT = TRUE
  IDE0:0.CLIENTDEVICE = TRUE
 diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml 
 b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
 index 0be570f..3131bb2 100644
 --- a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
 +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml
 @@ -14,7 +14,7 @@
devices
  disk type='file' device='disk'
driver name='LSILOGIC'/
 -  source file='[datastore] directory/FEDORA11.vmdk'/
 +  source file='[datastore] directory/FEDORA11.VMDK'/
target dev='sda' bus='scsi'/
  /disk
  interface type='bridge'

IIUC this change is not strictly required, it's just to make the .vmx file use
upper case letters consistently, right?

ACK anyway.

Jirka

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


Re: [libvirt] [PATCH] virsh: mark autostart answers for translation

2010-06-15 Thread Jiri Denemark
 This is a trivial fix for several autostart yes/no strings that
 weren't correctly marked for translation.
 ---
  tools/virsh.c |8 
  1 files changed, 4 insertions(+), 4 deletions(-)

ACK

Jirka

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


Re: [libvirt] [PATCHv2 2/5] remote: protocol implementation for virDomainCreateWithFlags

2010-06-15 Thread Eric Blake
On 06/11/2010 07:33 AM, Daniel P. Berrange wrote:
 On Thu, Jun 10, 2010 at 12:21:20PM -0600, Eric Blake wrote:
 Define the wire format for the new virDomainCreateWithFlags
 API, and implement client and server side of marshaling code.

 * daemon/remote.c (remoteDispatchDomainCreateWithFlags): Add
 server side dispatch for virDomainCreateWithFlags.
 * src/remote/remote_driver.c (remoteDomainCreateWithFlags)
 (remote_driver): Client side serialization.
 * src/remote/remote_protocol.x
 (remote_domain_create_with_flags_args)
 (remote_domain_create_with_flags_ret)
 (REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS): Define wire format.
 * daemon/remote_dispatch_args.h: Regenerate.
 * daemon/remote_dispatch_prototypes.h: Likewise.
 * daemon/remote_dispatch_table.h: Likewise.
 * src/remote/remote_protocol.c: Likewise.
 * src/remote/remote_protocol.h: Likewise.
 * src/remote_protocol-structs: Likewise.
 ---

 diff from v1: use right type in .x, then rerun 'make rpcgen'.

diff from v2:

diff --git i/daemon/remote.c w/daemon/remote.c
index 88a5494..1e33066 100644
--- i/daemon/remote.c
+++ w/daemon/remote.c
@@ -1234,7 +1234,8 @@ remoteDispatchDomainCreateWithFlags (struct
qemud_server *server ATTRIBUTE_UNUSE
 remoteDispatchConnError(rerr, conn);
 return -1;
 }
-ret-dom.id = dom-id;
+
+make_nonnull_domain (ret-dom, dom);
 virDomainFree(dom);
 return 0;
 }
diff --git i/src/remote_protocol-structs w/src/remote_protocol-structs
index 2e67931..43af89e 100644
--- i/src/remote_protocol-structs
+++ w/src/remote_protocol-structs
@@ -408,7 +408,7 @@ struct remote_domain_create_args {
 };
 struct remote_domain_create_with_flags_args {
remote_nonnull_domain  dom;
-   intflags;
+   u_int  flags;
 };
 struct remote_domain_create_with_flags_ret {
remote_nonnull_domain  dom;


 +if (virDomainCreateWithFlags (dom, args-flags) == -1) {
 +virDomainFree(dom);
 +remoteDispatchConnError(rerr, conn);
 +return -1;
 +}
 +ret-dom.id = dom-id;
 
 Although its only the 'id' value the client cares about, since we
 have a full 'remote_domain' object on the wire, we should initialize
 all the fields just in case we need it in the future. So just call
 into  make_nonnull_domain() instead of setting dom.id directly.

Done.

 +++ b/src/remote_protocol-structs
 @@ -406,6 +406,13 @@ struct remote_num_of_defined_domains_ret {
  struct remote_domain_create_args {
  remote_nonnull_domain  dom;
  };
 +struct remote_domain_create_with_flags_args {
 +remote_nonnull_domain  dom;
 +intflags;
 +};
 
 I think this needs updating to 'unsigned' to match the changed .x file
 too

Yep, make check eventually called me on it - it stemmed from me not
re-running 'make check' after 'make rpcgen' prior to posting the series.
 I'm wondering if we should make the 'make rpcgen' target smart enough
to also update remote_protocol-structs, thus making this one of the
generated files, or whether keeping the manual step in the loop is nice
for forcing the developer to remember that the patch is intentionally
adjusting the wire protocol.

Given your ACKs on the rest of the series, and the small extent of the
v3 diff listed above to address your comments, I have pushed the series.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] virsh: mark autostart answers for translation

2010-06-15 Thread Eric Blake
On 06/15/2010 08:50 AM, Jiri Denemark wrote:
 This is a trivial fix for several autostart yes/no strings that
 weren't correctly marked for translation.
 ---
  tools/virsh.c |8 
  1 files changed, 4 insertions(+), 4 deletions(-)
 
 ACK

Pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Update to libvirt-lxc driver doc page

2010-06-15 Thread Eric Blake
On 06/07/2010 08:55 AM, Serge Hallyn wrote:
 Here is a new drvlxc.html.in file to make the first example work.  I'll
 play with the second example next.

Thanks for the sample text; it looked good to me on a first read.  Are
you willing to finish out this patch by also including the patch to
Makefile.am to generate drvlxc.html and distribute the new file?

However, when I tried the example, I got:

$ virsh --connect lxc:/// start vm1
error: Failed to start domain vm1
error: internal error Container 'LIBVIR_LXC_CMD' unexpectedly shutdown
during startup

when using the virsh in Fedora 13 (libvirt-0.7.7-4.fc13.x86_64).  What
setup did you test with, to help me in updating my system to have a
similar setup?

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Update to libvirt-lxc driver doc page

2010-06-15 Thread Serge E. Hallyn
Quoting Eric Blake (ebl...@redhat.com):
 On 06/07/2010 08:55 AM, Serge Hallyn wrote:
  Here is a new drvlxc.html.in file to make the first example work.  I'll
  play with the second example next.
 
 Thanks for the sample text; it looked good to me on a first read.  Are
 you willing to finish out this patch by also including the patch to
 Makefile.am to generate drvlxc.html and distribute the new file?

Uh, sure.  As I got yelled at last time for not sending the .in file
I was sure it was in there.  But I see it, will send an update.

 However, when I tried the example, I got:
 
 $ virsh --connect lxc:/// start vm1
 error: Failed to start domain vm1
 error: internal error Container 'LIBVIR_LXC_CMD' unexpectedly shutdown
 during startup
 
 when using the virsh in Fedora 13 (libvirt-0.7.7-4.fc13.x86_64).  What
 setup did you test with, to help me in updating my system to have a
 similar setup?

I used ubuntu lucid.  I'll try to reproduce in an uptodate fedora 13.
However LIBVIR_LXC_CMD shouldn't be in the xml at all, rather the
result of

find /usr -name libvirt_lxc

should take its place.

(I haven't yet attacked the second example, so if you prefer to wait
for a single complete update, I'll try to get to that soon-ish)

thanks,
-serge

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


Re: [libvirt] Update to libvirt-lxc driver doc page

2010-06-15 Thread Eric Blake
On 06/15/2010 04:11 PM, Serge E. Hallyn wrote:
 Thanks for the sample text; it looked good to me on a first read.  Are
 you willing to finish out this patch by also including the patch to
 Makefile.am to generate drvlxc.html and distribute the new file?
 
 Uh, sure.  As I got yelled at last time for not sending the .in file
 I was sure it was in there.  But I see it, will send an update.

Hmm, we're probably confusing each other.  Sorry about that ;)

Your previous email attached drvlxc.html.in, and I thought it was a new
file; but looking at git, it is already an existing file.  So the
question now is generating the diff between your version and what is
already in git.

 I used ubuntu lucid.  I'll try to reproduce in an uptodate fedora 13.
 However LIBVIR_LXC_CMD shouldn't be in the xml at all, rather the
 result of
 
   find /usr -name libvirt_lxc
 
 should take its place.

Doh!  Yep, that would explain it.  I'll try again ;)

 
 (I haven't yet attacked the second example, so if you prefer to wait
 for a single complete update, I'll try to get to that soon-ish)

At this point, since you are improving an existing file, rather than
writing a new one, it's a lot easier to maintain your changes in git and
post just the changeset that describes the differences.  The
README-hacking file has some hints for first-time git users, and both
the list and IRC can serve as additional resources if you have more
questions.

http://libvirt.org/git/?p=libvirt.git;a=blob;f=README-hacking

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Update to libvirt-lxc driver doc page

2010-06-15 Thread Eric Blake
On 06/15/2010 04:18 PM, Eric Blake wrote:
  find /usr -name libvirt_lxc

 should take its place.
 
 Doh!  Yep, that would explain it.  I'll try again ;)

Yes, it worked just fine with /usr/libexec/libvirt_lxc - I was able to
attach to a limited lxc console.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] Update to libvirt-lxc driver doc page

2010-06-15 Thread Serge E. Hallyn
Quoting Eric Blake (ebl...@redhat.com):
 http://libvirt.org/git/?p=libvirt.git;a=blob;f=README-hacking

Doh - I had no idea the web pages were just sitting in libvirt.git/docs!
Now it all makes sense.  Thanks.

-serge

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


[libvirt] [PATCH] virsh: change printf() calls to vshPrint()

2010-06-15 Thread Justin Clift
Trivial fix changing printf() calls to vshPrint() where the ctl
variable is available.
---

Haven't created a BZ for this yet, as I'm not sure it's important enough
to warrant pushing into anything other than git head.

Should a BZ be created anyway?


 tools/virsh.c |   40 
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 07f2a1e..d8d2220 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1620,25 +1620,25 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
 for (i = 0; i  nparams; i++){
 switch (params[i].type) {
 case VIR_DOMAIN_SCHED_FIELD_INT:
- printf(%-15s: %d\n,  params[i].field, params[i].value.i);
+ vshPrint(ctl, %-15s: %d\n,  params[i].field, 
params[i].value.i);
  break;
 case VIR_DOMAIN_SCHED_FIELD_UINT:
- printf(%-15s: %u\n,  params[i].field, params[i].value.ui);
+ vshPrint(ctl, %-15s: %u\n,  params[i].field, 
params[i].value.ui);
  break;
 case VIR_DOMAIN_SCHED_FIELD_LLONG:
- printf(%-15s: %lld\n,  params[i].field, params[i].value.l);
+ vshPrint(ctl, %-15s: %lld\n,  params[i].field, 
params[i].value.l);
  break;
 case VIR_DOMAIN_SCHED_FIELD_ULLONG:
- printf(%-15s: %llu\n,  params[i].field, params[i].value.ul);
+ vshPrint(ctl, %-15s: %llu\n,  params[i].field, 
params[i].value.ul);
  break;
 case VIR_DOMAIN_SCHED_FIELD_DOUBLE:
- printf(%-15s: %f\n,  params[i].field, params[i].value.d);
+ vshPrint(ctl, %-15s: %f\n,  params[i].field, 
params[i].value.d);
  break;
 case VIR_DOMAIN_SCHED_FIELD_BOOLEAN:
- printf(%-15s: %d\n,  params[i].field, params[i].value.b);
+ vshPrint(ctl, %-15s: %d\n,  params[i].field, 
params[i].value.b);
  break;
 default:
- printf(not implemented scheduler parameter type\n);
+ vshPrint(ctl, not implemented scheduler parameter type\n);
 }
 }
 }
@@ -2654,7 +2654,7 @@ cmdDumpXML(vshControl *ctl, const vshCmd *cmd)
 
 dump = virDomainGetXMLDesc(dom, flags);
 if (dump != NULL) {
-printf(%s, dump);
+vshPrint(ctl, %s, dump);
 VIR_FREE(dump);
 } else {
 ret = FALSE;
@@ -2700,7 +2700,7 @@ cmdDomXMLFromNative(vshControl *ctl, const vshCmd *cmd)
 
 xmlData = virConnectDomainXMLFromNative(ctl-conn, format, configData, 
flags);
 if (xmlData != NULL) {
-printf(%s, xmlData);
+vshPrint(ctl, %s, xmlData);
 VIR_FREE(xmlData);
 } else {
 ret = FALSE;
@@ -2745,7 +2745,7 @@ cmdDomXMLToNative(vshControl *ctl, const vshCmd *cmd)
 
 configData = virConnectDomainXMLToNative(ctl-conn, format, xmlData, 
flags);
 if (configData != NULL) {
-printf(%s, configData);
+vshPrint(ctl, %s, configData);
 VIR_FREE(configData);
 } else {
 ret = FALSE;
@@ -3217,7 +3217,7 @@ cmdNetworkDumpXML(vshControl *ctl, const vshCmd *cmd)
 
 dump = virNetworkGetXMLDesc(network, 0);
 if (dump != NULL) {
-printf(%s, dump);
+vshPrint(ctl, %s, dump);
 VIR_FREE(dump);
 } else {
 ret = FALSE;
@@ -3806,7 +3806,7 @@ cmdInterfaceDumpXML(vshControl *ctl, const vshCmd *cmd)
 
 dump = virInterfaceGetXMLDesc(iface, flags);
 if (dump != NULL) {
-printf(%s, dump);
+vshPrint(ctl, %s, dump);
 VIR_FREE(dump);
 } else {
 ret = FALSE;
@@ -4094,7 +4094,7 @@ cmdNWFilterDumpXML(vshControl *ctl, const vshCmd *cmd)
 
 dump = virNWFilterGetXMLDesc(nwfilter, 0);
 if (dump != NULL) {
-printf(%s, dump);
+vshPrint(ctl, %s, dump);
 VIR_FREE(dump);
 } else {
 ret = FALSE;
@@ -4566,7 +4566,7 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
 return FALSE;
 
 if (printXML) {
-printf(%s, xml);
+vshPrint(ctl, %s, xml);
 VIR_FREE(xml);
 } else {
 pool = virStoragePoolCreateXML(ctl-conn, xml, 0);
@@ -4655,7 +4655,7 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
 return FALSE;
 
 if (printXML) {
-printf(%s, xml);
+vshPrint(ctl, %s, xml);
 VIR_FREE(xml);
 } else {
 pool = virStoragePoolDefineXML(ctl-conn, xml, 0);
@@ -4859,7 +4859,7 @@ cmdPoolDumpXML(vshControl *ctl, const vshCmd *cmd)
 
 dump = virStoragePoolGetXMLDesc(pool, 0);
 if (dump != NULL) {
-printf(%s, dump);
+vshPrint(ctl, %s, dump);
 VIR_FREE(dump);
 } else {
 ret = FALSE;
@@ -5925,7 +5925,7 @@ cmdVolDumpXML(vshControl *ctl, const vshCmd *cmd)
 
 dump = virStorageVolGetXMLDesc(vol, 0);
 if (dump != NULL) {
-printf(%s, dump);
+