Re: [libvirt] [PATCH] Make QEMU driver use -chardev everywhere when it's available

2009-11-17 Thread Matthew Booth

On 16/11/09 13:30, Daniel P. Berrange wrote:

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c807688..4f4b3db 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1844,12 +1844,36 @@ int qemudBuildCommandLine(virConnectPtr conn,
  if (monitor_chr) {
  virBuffer buf = VIR_BUFFER_INITIALIZER;

-qemudBuildCommandLineChrDevStr(monitor_chr,buf);
-if (virBufferError(buf))
-goto error;
+/* Use -chardev if it's available */
+if (qemuCmdFlags  QEMUD_CMD_FLAG_CHARDEV) {
+char id[16];
+
+if (snprintf(id, sizeof(id), monitor%i, i)  sizeof(id))
+goto error;


This is using 'i' uninitialized I believe. Its a little overkill to do
a printf here at all since there's only ever a single monitor called
'monitor0'


Whoops, cut/paste error. It doesn't sound like this is going to be 
merged immediately, so I'll keep the fix locally for the moment.


Thanks,

Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:   +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490

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


Re: [libvirt] migration: qemu vs. qemu+tcp at virsh vs. libvirt-java

2009-11-17 Thread Thomas Treutner
On Monday 16 November 2009 14:42:16 you wrote:
 On 11/16/2009 12:33 AM, Thomas Treutner wrote:
  Hi,
 
  I'm having a little problem when triggering (live) migration from
  libvirt-java (libvirt.so at client is approx. 0.7.1), I get an error that
  the qemu:// driver for migration URIs is not supported, only qemu+tcp://
 
  Strange thing is, with virsh at the same client (same libvirt.so),
  qemu:// works. Interestingly, the error message seems to come from
  libvirt.so and not libvirt-java.
 
  I'd like to avoid maintaining two different URIs/drivers for normal
  connections and migration destinations, especially as it works flawlessly
  (and fast!) with virsh?
 
  Has anyone clues where this twisted-mind behaviour could come from?

 What is the full argument list you are passing to the migrate function?
 You should only see that 'tcp' error if you are passing an explicit URI,
 which isn't required for standard migration.

domain.migrate(dst, 1, null, dstIP, 0);

where dst is a Connect object created with qemu://nodeX/system - I'm also 
passing a destination IP, could that be the problem? I used this code with 
Xen before. I have two ethXs, one for iSCSI, libvirt, .. and one for br0. 
dstIP is the same IP dst points to, but if it's possible, I'd like to let it 
be configurable that way.

Ah, javadoc says I'm using an URI ;) I'll try your suggestions ASAP.

Thanks!

kr
tom




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


Re: [libvirt] amjed gabteni wants to connect on LinkedIn

2009-11-17 Thread Daniel Veillard
On Mon, Nov 16, 2009 at 11:40:28AM -0800, amjed gabteni wrote:
 I'd like to add you to my professional network on LinkedIn.
 
 - amjed gabteni

  I unsubscribed this address from libvirt list

Daniel

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

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


Re: [libvirt] report OOM in two places in node_device_driver.c

2009-11-17 Thread Daniel Veillard
On Mon, Nov 16, 2009 at 03:11:01PM -0500, Dave Allan wrote:
 I noticed that there are two places in node_device_driver.c in which we  
 don't call virReportOOMError after strdup failure.  The attached small  
 patch adds the two calls.

 Dave

 diff --git a/src/node_device/node_device_driver.c 
 b/src/node_device/node_device_driver.c
 index cddd994..b474d43 100644
 --- a/src/node_device/node_device_driver.c
 +++ b/src/node_device/node_device_driver.c
 @@ -175,6 +175,7 @@ nodeListDevices(virConnectPtr conn,
  virNodeDeviceHasCap(driver-devs.objs[i], cap)) {
  if ((names[ndevs++] = strdup(driver-devs.objs[i]-def-name)) 
 == NULL) {
  virNodeDeviceObjUnlock(driver-devs.objs[i]);
 +virReportOOMError(conn);
  goto failure;
  }
  }
 @@ -379,8 +380,10 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const 
 names, int maxnames)
 
  for (caps = obj-def-caps; caps  ncaps  maxnames; caps = caps-next) 
 {
  names[ncaps] = strdup(virNodeDevCapTypeToString(caps-type));
 -if (names[ncaps++] == NULL)
 +if (names[ncaps++] == NULL) {
 +virReportOOMError(dev-conn);
  goto cleanup;
 +}
  }
  ret = ncaps;
 

  ACK !

   thanks :-)

Daniel

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

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


[libvirt] [PATCH] Fix typo in error message

2009-11-17 Thread Matthew Booth
* src/qemu/qemu_monitor_text.c: Fix typo
* po/*.po: Update typo in translations
---
 po/af.po |2 +-
 po/am.po |2 +-
 po/ar.po |2 +-
 po/as.po |2 +-
 po/be.po |2 +-
 po/bg.po |2 +-
 po/bn.po |2 +-
 po/bn_IN.po  |2 +-
 po/bs.po |2 +-
 po/ca.po |2 +-
 po/cs.po |2 +-
 po/cy.po |2 +-
 po/da.po |2 +-
 po/de.po |2 +-
 po/el.po |2 +-
 po/en_GB.po  |2 +-
 po/es.po |2 +-
 po/et.po |2 +-
 po/eu_ES.po  |2 +-
 po/fa.po |2 +-
 po/fi.po |2 +-
 po/fr.po |2 +-
 po/gl.po |2 +-
 po/gu.po |2 +-
 po/he.po |2 +-
 po/hi.po |2 +-
 po/hr.po |2 +-
 po/hu.po |2 +-
 po/hy.po |2 +-
 po/id.po |2 +-
 po/is.po |2 +-
 po/it.po |2 +-
 po/ja.po |2 +-
 po/ka.po |2 +-
 po/kn.po |2 +-
 po/ko.po |2 +-
 po/ku.po |2 +-
 po/lo.po |2 +-
 po/lt.po |2 +-
 po/lv.po |2 +-
 po/mk.po |2 +-
 po/ml.po |2 +-
 po/mr.po |2 +-
 po/ms.po |2 +-
 po/my.po |2 +-
 po/nb.po |2 +-
 po/nl.po |2 +-
 po/nn.po |2 +-
 po/nso.po|2 +-
 po/or.po |2 +-
 po/pa.po |2 +-
 po/pl.po |2 +-
 po/pt.po |2 +-
 po/pt_BR.po  |2 +-
 po/ro.po |2 +-
 po/ru.po |2 +-
 po/si.po |2 +-
 po/sk.po |2 +-
 po/sl.po |2 +-
 po/sq.po |2 +-
 po/sr.po |2 +-
 po/s...@latin.po   |2 +-
 po/sv.po |2 +-
 po/ta.po |2 +-
 po/te.po |2 +-
 po/th.po |2 +-
 po/tr.po |2 +-
 po/uk.po |2 +-
 po/ur.po |2 +-
 po/vi.po |2 +-
 po/zh_CN.po  |2 +-
 po/zh_TW.po  |2 +-
 po/zu.po |2 +-
 src/qemu/qemu_monitor_text.c |2 +-
 74 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/po/af.po b/po/af.po
index c64deda..c4711be 100644
--- a/po/af.po
+++ b/po/af.po
@@ -4957,7 +4957,7 @@ msgstr failed to read configuration file %s
 
 #: src/qemu/qemu_monitor_text.c:1828
 #, fuzzy, c-format
-msgid failed to remove host metnwork in qemu with '%s'
+msgid failed to remove host network in qemu with '%s'
 msgstr Failed to create domain from %s
 
 #: src/remote/remote_driver.c:328
diff --git a/po/am.po b/po/am.po
index c64deda..c4711be 100644
--- a/po/am.po
+++ b/po/am.po
@@ -4957,7 +4957,7 @@ msgstr failed to read configuration file %s
 
 #: src/qemu/qemu_monitor_text.c:1828
 #, fuzzy, c-format
-msgid failed to remove host metnwork in qemu with '%s'
+msgid failed to remove host network in qemu with '%s'
 msgstr Failed to create domain from %s
 
 #: src/remote/remote_driver.c:328
diff --git a/po/ar.po b/po/ar.po
index c64deda..c4711be 100644
--- a/po/ar.po
+++ b/po/ar.po
@@ -4957,7 +4957,7 @@ msgstr failed to read configuration file %s
 
 #: src/qemu/qemu_monitor_text.c:1828
 #, fuzzy, c-format
-msgid failed to remove host metnwork in qemu with '%s'
+msgid failed to remove host network in qemu with '%s'
 msgstr Failed to create domain from %s
 
 #: src/remote/remote_driver.c:328
diff --git a/po/as.po b/po/as.po
index b84d53b..3598e5b 100644
--- a/po/as.po
+++ b/po/as.po
@@ -5085,7 +5085,7 @@ msgstr %s বিনেস নথিপত্ৰ 
পঢ়োঁতে বিফল
 # c-format
 #: src/qemu/qemu_monitor_text.c:1828
 #, fuzzy, c-format
-msgid failed to remove host metnwork in qemu with '%s'
+msgid failed to remove host network in qemu with '%s'
 msgstr '%s' সহযোগে নেটওয়ার্কের 
ব্যাক-এন্ড মুছে ফেলতে ব্যর্থ\n
 
 #: src/remote/remote_driver.c:328
diff --git a/po/be.po b/po/be.po
index c64deda..c4711be 100644
--- a/po/be.po
+++ b/po/be.po
@@ -4957,7 +4957,7 @@ 

[libvirt] [PATCH] Check for duplicated UUID in XM Xen defines

2009-11-17 Thread Daniel Veillard
  This fixes https://bugzilla.redhat.com/show_bug.cgi?id=504262
where the xen drivers happily allows to define domains with conflicting
UUID. This is similar to the virDomainObjIsDuplicate check done in other
drivers but the internal structures are different so this need to be
done in a special way

Author: Daniel Veillard veill...@redhat.com
Date:   Tue Nov 17 12:06:46 2009 +0100

504262 Check for duplicated UUID in XM Xen defines

* src/xen/xm_internal.c: the XM driver was not checking for previously
  defined UUID on new defines. Similar to virDomainObjIsDuplicate()
  behaviour.

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index f833ce7..47bcc11 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -2623,6 +2623,26 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, 
const char *xml) {
 return (NULL);
 }
 
+/*
+ * check that if there is another domain defined with the same uuid
+ * it has the same name
+ */
+if ((entry = virHashSearch(priv-configCache, xenXMDomainSearchForUUID,
+   (const void *)(def-uuid))) != NULL) {
+   if ((entry-def != NULL)  (entry-def-name != NULL) 
+   (STRNEQ(def-name, entry-def-name))) {
+   char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+   virUUIDFormat(entry-def-uuid, uuidstr);
+   xenXMError(conn, VIR_ERR_OPERATION_FAILED,
+  _(domain '%s' is already defined with uuid %s),
+  entry-def-name, uuidstr);
+   entry = NULL;
+goto error;
+   }
+   entry = NULL;
+}
+
 if (virHashLookup(priv-nameConfigMap, def-name)) {
 /* domain exists, we will overwrite it */
 

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

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


Re: [libvirt] [PATCH] Fix typo in error message

2009-11-17 Thread Daniel Veillard
On Tue, Nov 17, 2009 at 11:04:40AM +, Matthew Booth wrote:
 * src/qemu/qemu_monitor_text.c: Fix typo
 * po/*.po: Update typo in translations

  Please keep the po separate from patches :-)

 diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
 index ee234a1..d39a417 100644
 --- a/src/qemu/qemu_monitor_text.c
 +++ b/src/qemu/qemu_monitor_text.c
 @@ -1635,7 +1635,7 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
  
  if (qemuMonitorCommand(mon, cmd, reply)  0) {
  qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
 - _(failed to remove host metnwork in qemu with 
 '%s'), cmd);
 + _(failed to remove host network in qemu with 
 '%s'), cmd);
  goto cleanup;
  }
  

  sure, applied, thanks :-)

Daniel

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

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


Re: [libvirt] [PATCH] Fix typo in error message

2009-11-17 Thread Matthew Booth

On 17/11/09 11:19, Daniel Veillard wrote:

On Tue, Nov 17, 2009 at 11:04:40AM +, Matthew Booth wrote:

* src/qemu/qemu_monitor_text.c: Fix typo
* po/*.po: Update typo in translations


   Please keep the po separate from patches :-)


Sure. Do you want a separate patch from me, or did you split it?

Matt
--
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:   +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490

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


Re: [libvirt] [PATCH] Check for duplicated UUID in XM Xen defines

2009-11-17 Thread Daniel P. Berrange
On Tue, Nov 17, 2009 at 12:16:11PM +0100, Daniel Veillard wrote:
   This fixes https://bugzilla.redhat.com/show_bug.cgi?id=504262
 where the xen drivers happily allows to define domains with conflicting
 UUID. This is similar to the virDomainObjIsDuplicate check done in other
 drivers but the internal structures are different so this need to be
 done in a special way
 
 Author: Daniel Veillard veill...@redhat.com
 Date:   Tue Nov 17 12:06:46 2009 +0100
 
 504262 Check for duplicated UUID in XM Xen defines
 
 * src/xen/xm_internal.c: the XM driver was not checking for previously
   defined UUID on new defines. Similar to virDomainObjIsDuplicate()
   behaviour.
 
 diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
 index f833ce7..47bcc11 100644
 --- a/src/xen/xm_internal.c
 +++ b/src/xen/xm_internal.c
 @@ -2623,6 +2623,26 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, 
 const char *xml) {
  return (NULL);
  }
  
 +/*
 + * check that if there is another domain defined with the same uuid
 + * it has the same name
 + */
 +if ((entry = virHashSearch(priv-configCache, xenXMDomainSearchForUUID,
 +   (const void *)(def-uuid))) != NULL) {
 + if ((entry-def != NULL)  (entry-def-name != NULL) 
 + (STRNEQ(def-name, entry-def-name))) {
 + char uuidstr[VIR_UUID_STRING_BUFLEN];
 +
 + virUUIDFormat(entry-def-uuid, uuidstr);
 + xenXMError(conn, VIR_ERR_OPERATION_FAILED,
 +_(domain '%s' is already defined with uuid %s),
 +entry-def-name, uuidstr);
 + entry = NULL;
 +goto error;
 + }
 + entry = NULL;
 +}
 +
  if (virHashLookup(priv-nameConfigMap, def-name)) {
  /* domain exists, we will overwrite it */
  
 

ACK, though the indentation looks a little off here.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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


[libvirt] [PATCH] Support QEMU's virtual FAT block device driver

2009-11-17 Thread Daniel P. Berrange
Introduce a new type=dir  mode for disks that allows use of
QEMU's  virtual FAT block device driver. eg

disk type='dir' device='floppy'
  source dir='/tmp/test'/
  target dev='fda' bus='fdc'/
  readonly/
/disk

gets turned into

  -drive file=fat:floppy:/tmp/test,if=floppy,index=0

Only read-only disks are supported with virtual FAT mode

* src/conf/domain_conf.c, src/conf/domain_conf.h: Add type=dir
* docs/schemas/domain.rng: Document new disk type
* src/xen/xend_internal.c, src/xen/xm_internal.c: Raise error for
  unsupported disk types
* tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.args: Fix
  empty disk file handling
* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
  tests/qemuxml2argvtest.c: Test QEMU vitual FAT driver
* src/qemu/qemu_conf.c: Support generating fat:/some/dir type
  disk args
* src/security/security_selinux.c: Temporarily skip labelling
  of directory based disks
---
 docs/schemas/domain.rng|   16 ++
 src/conf/domain_conf.c |   36 --
 src/conf/domain_conf.h |1 +
 src/qemu/qemu_conf.c   |   49 ++-
 src/security/security_selinux.c|3 +
 src/xen/xend_internal.c|7 ++-
 src/xen/xm_internal.c  |   16 +-
 .../qemuxml2argv-disk-cdrom-empty.args |2 +-
 .../qemuxml2argv-disk-drive-fat.args   |1 +
 .../qemuxml2argv-disk-drive-fat.xml|   24 ++
 .../qemuxml2argv-floppy-drive-fat.args |1 +
 .../qemuxml2argv-floppy-drive-fat.xml  |   24 ++
 tests/qemuxml2argvtest.c   |4 ++
 tests/qemuxml2xmltest.c|2 +
 14 files changed, 173 insertions(+), 13 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml

diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 1bf44fd..7a3ef97 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -434,6 +434,22 @@
 ref name=diskspec/
   /interleave
 /group
+group
+  attribute name=type
+valuedir/value
+  /attribute
+  interleave
+optional
+  element name=source
+attribute name=dir
+  ref name=absFilePath/
+/attribute
+empty/
+  /element
+/optional
+ref name=diskspec/
+  /interleave
+/group
 ref name=diskspec/
   /choice
 /element
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0a7eef7..42820a7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -90,7 +90,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
 
 VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
   block,
-  file)
+  file,
+  dir)
 
 VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
   disk,
@@ -777,10 +778,22 @@ virDomainDiskDefParseXML(virConnectPtr conn,
 if ((source == NULL) 
 (xmlStrEqual(cur-name, BAD_CAST source))) {
 
-if (def-type == VIR_DOMAIN_DISK_TYPE_FILE)
+switch (def-type) {
+case VIR_DOMAIN_DISK_TYPE_FILE:
 source = virXMLPropString(cur, file);
-else
+break;
+case VIR_DOMAIN_DISK_TYPE_BLOCK:
 source = virXMLPropString(cur, dev);
+break;
+case VIR_DOMAIN_DISK_TYPE_DIR:
+source = virXMLPropString(cur, dir);
+break;
+default:
+virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _(unexpected disk type %s),
+ virDomainDiskTypeToString(def-type));
+goto error;
+}
 
 /* People sometimes pass a bogus '' source path
when they mean to omit the source element
@@ -3951,12 +3964,25 @@ virDomainDiskDefFormat(virConnectPtr conn,
 }
 
 if (def-src) {
-if (def-type == VIR_DOMAIN_DISK_TYPE_FILE)
+switch (def-type) {
+case VIR_DOMAIN_DISK_TYPE_FILE:
 virBufferEscapeString(buf,   source file='%s'/\n,
  

Re: [libvirt] PATCH: recent qemu-kvm requires -enable-kvm flag to activate VT optimization

2009-11-17 Thread Steve Yarmie

Thanks for pointing that out. I made the changes you suggested.
An updated patch is attached.

btw - I'm using qemu-kvm-0.11.0, but this patch would be relevant when 
running
any version of qemu/qemu-kvm that was released after the upstream merge 
of the

kvm userspace..

-Steve


Daniel P. Berrange wrote:

On Mon, Nov 16, 2009 at 02:15:28AM -0800, Steve Yarmie wrote
 
+/* Should explicitly enable KVM if

+ * 1. Guest domain is 'qemu'
Surely 'kvm' here

+ * 2. The qemu binary has the -enable-kvm flag

+ * NOTE: user must be responsible to load the kvm modules
+ */
+if ((qemuCmdFlags  QEMUD_CMD_FLAG_ENABLE_KVM) 
+def-virtType == VIR_DOMAIN_VIRT_QEMU)



Again, this should be VIR_DOMAIN_VIRT_KVM here - 'qemu' is intended
to be pure emulation only


Regards,
Daniel
  


diff -upr libvirt/src/qemu/qemu_conf.c libvirt-enableKVM/src/qemu/qemu_conf.c
--- libvirt/src/qemu/qemu_conf.c2009-11-17 05:37:23.973599362 -0800
+++ libvirt-enableKVM/src/qemu/qemu_conf.c  2009-11-17 05:41:40.755832169 
-0800
@@ -878,6 +878,8 @@ static unsigned int qemudComputeCmdFlags
 flags |= QEMUD_CMD_FLAG_KQEMU;
 if (strstr(help, -no-kvm))
 flags |= QEMUD_CMD_FLAG_KVM;
+if (strstr(help, -enable-kvm))
+flags |= QEMUD_CMD_FLAG_ENABLE_KVM;
 if (strstr(help, -no-reboot))
 flags |= QEMUD_CMD_FLAG_NO_REBOOT;
 if (strstr(help, -name))
@@ -1595,6 +1597,7 @@ int qemudBuildCommandLine(virConnectPtr 
 struct utsname ut;
 int disableKQEMU = 0;
 int disableKVM = 0;
+int enableKVM = 0;
 int qargc = 0, qarga = 0;
 const char **qargv = NULL;
 int qenvc = 0, qenva = 0;
@@ -1653,6 +1656,15 @@ int qemudBuildCommandLine(virConnectPtr 
 def-virtType == VIR_DOMAIN_VIRT_QEMU)
 disableKVM = 1;
 
+/* Should explicitly enable KVM if
+ * 1. Guest domain is 'kvm'
+ * 2. The qemu binary has the -enable-kvm flag
+ * NOTE: user must be responsible for loading the kvm modules
+ */
+if ((qemuCmdFlags  QEMUD_CMD_FLAG_ENABLE_KVM) 
+def-virtType == VIR_DOMAIN_VIRT_KVM)
+enableKVM = 1;
+
 /*
  * Need to force a 32-bit guest CPU type if
  *
@@ -1780,6 +1792,8 @@ int qemudBuildCommandLine(virConnectPtr 
 ADD_ARG_LIT(-no-kqemu);
 if (disableKVM)
 ADD_ARG_LIT(-no-kvm);
+if (enableKVM)
+ADD_ARG_LIT(-enable-kvm);
 ADD_ARG_LIT(-m);
 ADD_ARG_LIT(memory);
 if (def-hugepage_backed) {
diff -upr libvirt/src/qemu/qemu_conf.h libvirt-enableKVM/src/qemu/qemu_conf.h
--- libvirt/src/qemu/qemu_conf.h2009-11-17 05:37:23.973599362 -0800
+++ libvirt-enableKVM/src/qemu/qemu_conf.h  2009-11-17 05:41:40.755832169 
-0800
@@ -73,6 +73,7 @@ enum qemud_cmd_flags {
 QEMUD_CMD_FLAG_XEN_DOMID = (1  20), /* -xen-domid (new style xen 
integration) */
 QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX = (1  21), /* Does qemu support unix 
domain sockets for migration? */
 QEMUD_CMD_FLAG_CHARDEV   = (1  22), /* Is the new -chardev arg 
available */
+QEMUD_CMD_FLAG_ENABLE_KVM= (1  23), /* Is the -enable-kvm flag 
available to enable KVM full virtualization support */
 };
 
 /* Main driver state */
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] Support QEMU's virtual FAT block device driver

2009-11-17 Thread Daniel Veillard
On Tue, Nov 17, 2009 at 01:20:15PM +, Daniel P. Berrange wrote:
 Introduce a new type=dir  mode for disks that allows use of
 QEMU's  virtual FAT block device driver. eg
 
 disk type='dir' device='floppy'
   source dir='/tmp/test'/
   target dev='fda' bus='fdc'/
   readonly/
 /disk
 
 gets turned into
 
   -drive file=fat:floppy:/tmp/test,if=floppy,index=0
 
 Only read-only disks are supported with virtual FAT mode
 
 * src/conf/domain_conf.c, src/conf/domain_conf.h: Add type=dir
 * docs/schemas/domain.rng: Document new disk type
 * src/xen/xend_internal.c, src/xen/xm_internal.c: Raise error for
   unsupported disk types
 * tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.args: Fix
   empty disk file handling
 * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args,
   tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml,
   tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args,
   tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
   tests/qemuxml2argvtest.c: Test QEMU vitual FAT driver
 * src/qemu/qemu_conf.c: Support generating fat:/some/dir type
   disk args
 * src/security/security_selinux.c: Temporarily skip labelling
   of directory based disks
 ---
  docs/schemas/domain.rng|   16 ++
  src/conf/domain_conf.c |   36 --
  src/conf/domain_conf.h |1 +
  src/qemu/qemu_conf.c   |   49 ++-
  src/security/security_selinux.c|3 +
  src/xen/xend_internal.c|7 ++-
  src/xen/xm_internal.c  |   16 +-
  .../qemuxml2argv-disk-cdrom-empty.args |2 +-
  .../qemuxml2argv-disk-drive-fat.args   |1 +
  .../qemuxml2argv-disk-drive-fat.xml|   24 ++
  .../qemuxml2argv-floppy-drive-fat.args |1 +
  .../qemuxml2argv-floppy-drive-fat.xml  |   24 ++
  tests/qemuxml2argvtest.c   |4 ++
  tests/qemuxml2xmltest.c|2 +
  14 files changed, 173 insertions(+), 13 deletions(-)
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args
  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
 
 diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
 index 1bf44fd..7a3ef97 100644
 --- a/docs/schemas/domain.rng
 +++ b/docs/schemas/domain.rng
 @@ -434,6 +434,22 @@
  ref name=diskspec/
/interleave
  /group
 +group
 +  attribute name=type
 +valuedir/value
 +  /attribute
 +  interleave
 +optional
 +  element name=source
 +attribute name=dir
 +  ref name=absFilePath/
 +/attribute
 +empty/
 +  /element
 +/optional
 +ref name=diskspec/
 +  /interleave
 +/group
  ref name=diskspec/
/choice
  /element
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index 0a7eef7..42820a7 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -90,7 +90,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
  
  VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
block,
 -  file)
 +  file,
 +  dir)
  
  VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
disk,
 @@ -777,10 +778,22 @@ virDomainDiskDefParseXML(virConnectPtr conn,
  if ((source == NULL) 
  (xmlStrEqual(cur-name, BAD_CAST source))) {
  
 -if (def-type == VIR_DOMAIN_DISK_TYPE_FILE)
 +switch (def-type) {
 +case VIR_DOMAIN_DISK_TYPE_FILE:
  source = virXMLPropString(cur, file);
 -else
 +break;
 +case VIR_DOMAIN_DISK_TYPE_BLOCK:
  source = virXMLPropString(cur, dev);
 +break;
 +case VIR_DOMAIN_DISK_TYPE_DIR:
 +source = virXMLPropString(cur, dir);
 +break;
 +default:
 +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
 + _(unexpected disk type %s),
 + 
 virDomainDiskTypeToString(def-type));
 +goto error;
 +}
  
  /* People sometimes pass a bogus '' source path
 when they mean to omit the source element
 @@ -3951,12 +3964,25 @@ virDomainDiskDefFormat(virConnectPtr conn,
  }
  
  if (def-src) {
 -if 

[libvirt] [PATCH] 504914 Xen scheduler setting problems

2009-11-17 Thread Daniel Veillard

504914 Xen scheduler setting problems

https://bugzilla.redhat.com/show_bug.cgi?id=504914
Doing virsh schedinfo rhel5u3 --cap 65535
the hypervisor does the call, but does not change the
value nor raise an error. Best is just to consider it's not in
the allowed values
The problem is that the error won't be ouput since the xend driver
will then be called and raise an error
error: this function is not supported by the hypervisor: unsupported in
xendConfigVersion  4
which will override the useful information from
xenUnifiedDomainSetSchedulerParameters()
So best is to also invert the order in which the xen sub-drivers are
called

* src/xen/xen_hypervisor.c: mark 65535 cap value as out of bound
* src/xen/xen_hypervisor.c: reverse the order of the calls to the xen
  sub drivers to get the error message if needed

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 4bfcce4..a7da2ec 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1524,7 +1524,8 @@ xenUnifiedDomainSetSchedulerParameters (virDomainPtr dom,
 GET_PRIVATE(dom-conn);
 int i, ret;
 
-for (i = 0; i  XEN_UNIFIED_NR_DRIVERS; ++i) {
+/* do the hypervisor call last to get better error */
+for (i = XEN_UNIFIED_NR_DRIVERS - 1; i = 0; i--) {
 if (priv-opened[i]  drivers[i]-domainSetSchedulerParameters) {
ret = drivers[i]-domainSetSchedulerParameters(dom, params, 
nparams);
if (ret == 0)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 843102a..4254bcd 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -1345,8 +1345,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
 } else if (STREQ (params[i].field, str_cap) 
 params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
 val = params[i].value.ui;
-if (val  USHRT_MAX) {
-snprintf(buf, sizeof(buf), _(Credit scheduler cap 
parameter (%d) is out of range (0-65535)), val);
+if (val = USHRT_MAX) {
+snprintf(buf, sizeof(buf), _(Credit scheduler cap 
parameter (%d) is out of range (0-65534)), val);
 virXenErrorFunc (domain-conn, VIR_ERR_INVALID_ARG, 
__FUNCTION__, buf, val);
 return(-1);
 }

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

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


Re: [libvirt] [PATCH] Support QEMU's virtual FAT block device driver

2009-11-17 Thread Daniel P. Berrange
On Tue, Nov 17, 2009 at 04:08:08PM +0100, Daniel Veillard wrote:
 On Tue, Nov 17, 2009 at 01:20:15PM +, Daniel P. Berrange wrote:
  Introduce a new type=dir  mode for disks that allows use of
  QEMU's  virtual FAT block device driver. eg
  
  disk type='dir' device='floppy'
source dir='/tmp/test'/
target dev='fda' bus='fdc'/
readonly/
  /disk
  
  gets turned into
  
-drive file=fat:floppy:/tmp/test,if=floppy,index=0
  
  Only read-only disks are supported with virtual FAT mode
  
  * src/conf/domain_conf.c, src/conf/domain_conf.h: Add type=dir
  * docs/schemas/domain.rng: Document new disk type
  * src/xen/xend_internal.c, src/xen/xm_internal.c: Raise error for
unsupported disk types
  * tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.args: Fix
empty disk file handling
  * tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args,
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml,
tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args,
tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
tests/qemuxml2argvtest.c: Test QEMU vitual FAT driver
  * src/qemu/qemu_conf.c: Support generating fat:/some/dir type
disk args
  * src/security/security_selinux.c: Temporarily skip labelling
of directory based disks
  ---
   docs/schemas/domain.rng|   16 ++
   src/conf/domain_conf.c |   36 --
   src/conf/domain_conf.h |1 +
   src/qemu/qemu_conf.c   |   49 
  ++-
   src/security/security_selinux.c|3 +
   src/xen/xend_internal.c|7 ++-
   src/xen/xm_internal.c  |   16 +-
   .../qemuxml2argv-disk-cdrom-empty.args |2 +-
   .../qemuxml2argv-disk-drive-fat.args   |1 +
   .../qemuxml2argv-disk-drive-fat.xml|   24 ++
   .../qemuxml2argv-floppy-drive-fat.args |1 +
   .../qemuxml2argv-floppy-drive-fat.xml  |   24 ++
   tests/qemuxml2argvtest.c   |4 ++
   tests/qemuxml2xmltest.c|2 +
   14 files changed, 173 insertions(+), 13 deletions(-)
   create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args
   create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml
   create mode 100644 
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args
   create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
  
  diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
  index 1bf44fd..7a3ef97 100644
  --- a/docs/schemas/domain.rng
  +++ b/docs/schemas/domain.rng
  @@ -434,6 +434,22 @@
   ref name=diskspec/
 /interleave
   /group
  +group
  +  attribute name=type
  +valuedir/value
  +  /attribute
  +  interleave
  +optional
  +  element name=source
  +attribute name=dir
  +  ref name=absFilePath/
  +/attribute
  +empty/
  +  /element
  +/optional
  +ref name=diskspec/
  +  /interleave
  +/group
   ref name=diskspec/
 /choice
   /element
  diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
  index 0a7eef7..42820a7 100644
  --- a/src/conf/domain_conf.c
  +++ b/src/conf/domain_conf.c
  @@ -90,7 +90,8 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
   
   VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
 block,
  -  file)
  +  file,
  +  dir)
   
   VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
 disk,
  @@ -777,10 +778,22 @@ virDomainDiskDefParseXML(virConnectPtr conn,
   if ((source == NULL) 
   (xmlStrEqual(cur-name, BAD_CAST source))) {
   
  -if (def-type == VIR_DOMAIN_DISK_TYPE_FILE)
  +switch (def-type) {
  +case VIR_DOMAIN_DISK_TYPE_FILE:
   source = virXMLPropString(cur, file);
  -else
  +break;
  +case VIR_DOMAIN_DISK_TYPE_BLOCK:
   source = virXMLPropString(cur, dev);
  +break;
  +case VIR_DOMAIN_DISK_TYPE_DIR:
  +source = virXMLPropString(cur, dir);
  +break;
  +default:
  +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
  + _(unexpected disk type %s),
  + 
  virDomainDiskTypeToString(def-type));
  +goto error;
  +}
   
   /* People sometimes pass a bogus '' 

Re: [libvirt] PATCH: configure.in should use 'ld' from $PATH for checking version-script syntax, not hardcode /usr/bin/ld

2009-11-17 Thread Paolo Bonzini

On 11/16/2009 11:42 PM, Daniel Veillard wrote:

that won't differentiate ld in $PATH from /usr/bin/ld which
is the actual command launched by gcc (or rather collect2) ... so
unfortunately that's still gcc only and even then incomplete:-)


If --print-prog-name gives only ld that means collect2 will walk the 
$PATH.  But if gcc was configured with --with-ld=something, or if a -B 
option is included in $CC, then --print-prog-name will print a full path.


Example (PATH includes ~/bin):

$ cat ~/bin/ld
#! /bin/sh
echo hello from $0  /dev/tty
exec /usr/bin/ld $@

$ gcc --print-prog-name=ld
ld
$ gcc f.c
hello from /home/pbonzini/bin/ld

$ gcc -B$HOME/bin --print-prog-name=ld
/home/pbonzini/bin/ld
$ gcc -B$HOME/bin f.c
hello from /home/pbonzini/bin/ld

$ gcc -B$HOME/./bin --print-prog-name=ld
/home/pbonzini/./bin/ld
$ gcc -B$HOME/./bin f.c
hello from /home/pbonzini/./bin/ld

HTH,

Paolo

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


Re: [libvirt] [PATCH 1/2] Pull schedular affinity code out into a separate module

2009-11-17 Thread Daniel P. Berrange
On Mon, Nov 16, 2009 at 06:07:25PM +0100, Daniel Veillard wrote:
 On Mon, Nov 16, 2009 at 04:49:29PM +, Daniel P. Berrange wrote:
  * src/Makefile.am: Add processinfo.h/processinfo.c
  * src/util/processinfo.c, src/util/processinfo.h: Module providing
APIs for getting/setting process CPU affinity
  * src/qemu/qemu_driver.c: Switch over to new APIs for schedular
affinity
  * src/libvirt_private.syms: Export virProcessInfoSetAffinity
and virProcessInfoGetAffinity to internal drivers
  ---
   src/Makefile.am  |4 +-
   src/libvirt_private.syms |5 ++
   src/qemu/qemu_driver.c   |   73 +
   src/util/processinfo.c   |  101 
  ++
   src/util/processinfo.h   |   37 +
   5 files changed, 175 insertions(+), 45 deletions(-)
   create mode 100644 src/util/processinfo.c
   create mode 100644 src/util/processinfo.h
  
  diff --git a/src/Makefile.am b/src/Makefile.am
  @@ -268,7 +269,8 @@ NODE_DEVICE_DRIVER_HAL_SOURCES =
  \
  node_device/node_device_hal.h
   
   NODE_DEVICE_DRIVER_UDEV_SOURCES =  \
  -   node_device/node_device_udev.c
  +   node_device/node_device_udev.c  \
  +   node_device/node_device_udev.h
   
   
   #
 
   Can you commit that separately as this is a bug fix for 0.7.3 in any
 case ?

Opps yes, I didn't notice that got in here !

  diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
  index c473d49..e880c2e 100644
  --- a/src/libvirt_private.syms
  +++ b/src/libvirt_private.syms
  @@ -374,6 +374,11 @@ pciDeviceListUnlock;
   pciDeviceListSteal;
   
   
  +# processinfo.h
  +virProcessInfoSetAffinity;
  +virProcessInfoGetAffinity;
 
   On one hand this is a bug fix and will affect testers, on the other hand
 this is also a relatively heavy cleanup, but it's probably a good idea
 to commit this before 0.7.3
 
   ACK,

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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 2/2] Alternate CPU affinity impl to cope with NR_CPUS 1024

2009-11-17 Thread Daniel P. Berrange
On Mon, Nov 16, 2009 at 06:13:05PM +0100, Daniel Veillard wrote:
 On Mon, Nov 16, 2009 at 04:49:30PM +, Daniel P. Berrange wrote:
  The cpu_set_t type can only cope with NR_CPUS = 1024, beyond this
  it is neccessary to use alternate CPU_SET maps with a dynamically
  allocated CPU map
  
  +realloc:
  +masklen = CPU_ALLOC_SIZE(numcpus);
  +mask = CPU_ALLOC(numcpus);
  +
  +if (!mask) {
  +virReportOOMError(NULL);
  +return -1;
  +}
  +
  +CPU_ZERO_S(masklen, mask);
  +for (i = 0 ; i  maxcpu ; i++) {
  +if (VIR_CPU_USABLE(map, maplen, 0, i))
  +CPU_SET_S(i, masklen, mask);
  +}
  +
  +if (sched_setaffinity(pid, masklen, mask)  0) {
  +CPU_FREE(mask);
  +if (errno == EINVAL 
  +numcpus  (1024  8)) { /* 262144 cpus ought to be enough for 
  anyone */
  +numcpus = numcpus  2;
 
let's just 
  numcpus *= 2;
or
  numcpus *= 4;
 it's not like we want to shave a microsecond, makes code less readable.



 
  +goto realloc;
  +}
  +virReportSystemError(NULL, errno,
  + _(cannot set CPU affinity on process %d), 
  pid);
  +return -1;
  +}
  +CPU_FREE(mask);
  +#else
  +/* Legacy method uses a fixed size cpu mask, only allows upto 1024 
  cpus */
   cpu_set_t mask;
   
   CPU_ZERO(mask);
  @@ -51,6 +93,7 @@ int virProcessInfoSetAffinity(pid_t pid,
_(cannot set CPU affinity on process %d), 
  pid);
   return -1;
   }
  +#endif
   
   return 0;
   }
  @@ -61,6 +104,46 @@ int virProcessInfoGetAffinity(pid_t pid,
 int maxcpu)
   {
   int i;
  +#ifdef CPU_ALLOC
  +/* New method dynamically allocates cpu mask, allowing unlimted cpus */
  +int numcpus = 1024;
  +size_t masklen;
  +cpu_set_t *mask;
  +
  +/* Not only may the statically allocated cpu_set_t be too small,
  + * but there is no way to ask the kernel what size is large enough.
  + * So you have no option but to pick a size, try, catch EINVAL,
  + * enlarge, and re-try.
  + *
  + * http://lkml.org/lkml/2009/7/28/620
  + */
  +realloc:
  +masklen = CPU_ALLOC_SIZE(numcpus);
  +mask = CPU_ALLOC(numcpus);
  +
  +if (!mask) {
  +virReportOOMError(NULL);
  +return -1;
  +}
  +
  +CPU_ZERO_S(masklen, mask);
  +if (sched_getaffinity(pid, masklen, mask)  0) {
  +CPU_FREE(mask);
  +if (errno == EINVAL 
  +numcpus  (1024  8)) { /* 262144 cpus ought to be enough for 
  anyone */
  +numcpus = numcpus  2;
 
   same
 I would also make numcpus a static variable, so that you don't repeat he
 loop each time you go though one of those APIs. 

Using static variables in this kind of context are not thread-safe
and I don't really want to introduce locking in here. FYI, in the
common case of kernels compiled with a sensible NR_CPUS, there will
only ever be a single pass in the loop. In the uncommon case of using
a NR_CPUS=4096, I picked 1024 and the ' 2', to ensure there is only
two passes in the loop (first fails, second succeeds). So i don't think
it needs optimizing further

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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: iptables.c: fix deprecated cmd syntax

2009-11-17 Thread Daniel P. Berrange
On Sun, Nov 15, 2009 at 06:55:17PM -0800, Steve Yarmie wrote:
 default iptables rules uses deprecated cmdline syntax
 When using iptables-1.4.5 with libvirt warnings appear:
 
 debug : virRun:827 : Command stderr: Using intrapositioned negation 
 (`--option ! this`) is deprecated in favor of extrapositioned (`! --option 
 this`).
 
 simple patch against src/util/iptables.c fixes it..
 
 Reference Bugzilla ID: 533775

 diff -ur libvirt/src/util/iptables.c libvirt-ipt/src/util/iptables.c
 --- libvirt/src/util/iptables.c   2009-11-08 20:57:08.458909225 -0800
 +++ libvirt-ipt/src/util/iptables.c   2009-11-08 21:19:48.554615398 -0800
 @@ -1067,7 +1067,7 @@
  return iptablesAddRemoveRule(ctx-nat_postrouting,
   action,
   --source, network,
 - --destination, !, network,
 + !, --destination, network,
   --out-interface, physdev,
   --jump, MASQUERADE,
   NULL);
 @@ -1075,7 +1075,7 @@
  return iptablesAddRemoveRule(ctx-nat_postrouting,
   action,
   --source, network,
 - --destination, !, network,
 + !, --destination, network,
   --jump, MASQUERADE,
   NULL);
  }

ACK, looks good


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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: recent qemu-kvm requires -enable-kvm flag to activate VT optimization

2009-11-17 Thread Daniel P. Berrange
On Tue, Nov 17, 2009 at 06:02:56AM -0800, Steve Yarmie wrote:

 diff -upr libvirt/src/qemu/qemu_conf.c libvirt-enableKVM/src/qemu/qemu_conf.c
 --- libvirt/src/qemu/qemu_conf.c  2009-11-17 05:37:23.973599362 -0800
 +++ libvirt-enableKVM/src/qemu/qemu_conf.c2009-11-17 05:41:40.755832169 
 -0800
 @@ -878,6 +878,8 @@ static unsigned int qemudComputeCmdFlags
  flags |= QEMUD_CMD_FLAG_KQEMU;
  if (strstr(help, -no-kvm))
  flags |= QEMUD_CMD_FLAG_KVM;
 +if (strstr(help, -enable-kvm))
 +flags |= QEMUD_CMD_FLAG_ENABLE_KVM;
  if (strstr(help, -no-reboot))
  flags |= QEMUD_CMD_FLAG_NO_REBOOT;
  if (strstr(help, -name))
 @@ -1595,6 +1597,7 @@ int qemudBuildCommandLine(virConnectPtr 
  struct utsname ut;
  int disableKQEMU = 0;
  int disableKVM = 0;
 +int enableKVM = 0;
  int qargc = 0, qarga = 0;
  const char **qargv = NULL;
  int qenvc = 0, qenva = 0;
 @@ -1653,6 +1656,15 @@ int qemudBuildCommandLine(virConnectPtr 
  def-virtType == VIR_DOMAIN_VIRT_QEMU)
  disableKVM = 1;
  
 +/* Should explicitly enable KVM if
 + * 1. Guest domain is 'kvm'
 + * 2. The qemu binary has the -enable-kvm flag
 + * NOTE: user must be responsible for loading the kvm modules
 + */
 +if ((qemuCmdFlags  QEMUD_CMD_FLAG_ENABLE_KVM) 
 +def-virtType == VIR_DOMAIN_VIRT_KVM)
 +enableKVM = 1;
 +
  /*
   * Need to force a 32-bit guest CPU type if
   *
 @@ -1780,6 +1792,8 @@ int qemudBuildCommandLine(virConnectPtr 
  ADD_ARG_LIT(-no-kqemu);
  if (disableKVM)
  ADD_ARG_LIT(-no-kvm);
 +if (enableKVM)
 +ADD_ARG_LIT(-enable-kvm);
  ADD_ARG_LIT(-m);
  ADD_ARG_LIT(memory);
  if (def-hugepage_backed) {
 diff -upr libvirt/src/qemu/qemu_conf.h libvirt-enableKVM/src/qemu/qemu_conf.h
 --- libvirt/src/qemu/qemu_conf.h  2009-11-17 05:37:23.973599362 -0800
 +++ libvirt-enableKVM/src/qemu/qemu_conf.h2009-11-17 05:41:40.755832169 
 -0800
 @@ -73,6 +73,7 @@ enum qemud_cmd_flags {
  QEMUD_CMD_FLAG_XEN_DOMID = (1  20), /* -xen-domid (new style xen 
 integration) */
  QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX = (1  21), /* Does qemu support unix 
 domain sockets for migration? */
  QEMUD_CMD_FLAG_CHARDEV   = (1  22), /* Is the new -chardev arg 
 available */
 +QEMUD_CMD_FLAG_ENABLE_KVM= (1  23), /* Is the -enable-kvm flag 
 available to enable KVM full virtualization support */
  };
  
  /* Main driver state */


ACK, this looks good now

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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] RFC exposing SRIOV PF-VF relationships

2009-11-17 Thread Daniel P. Berrange
On Mon, Nov 16, 2009 at 04:14:34PM -0500, Dave Allan wrote:
 It would be helpful to have an API that exposes the relationship between 
 SR IOV physical functions (PFs) and virtual functions (VFs).  I'm 
 thinking of implementing three new API calls and adding a small amount 
 of additional information in the node device pci device capability, as 
 in the attached patch.  Let me know what you think.

Do we really need extra APis for this, vs exposing it in the XML ?

I'd think we either use the existing parent/child relationship. ie
munge a VF's parent link to point to the PF device, or we could just
add a new element giving the device name of the physical function.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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] Re: [Patch v0.4] iSCSI Multi-IQN (Libvirt Support)

2009-11-17 Thread Daniel P. Berrange
On Mon, Nov 16, 2009 at 01:58:08PM -0500, Dave Allan wrote:
 diff --git a/src/storage_backend_iscsi.c b/src/storage_backend_iscsi.c
 index b516add..1fb21a5 100644
 --- a/src/storage_backend_iscsi.c
 +++ b/src/storage_backend_iscsi.c
 @@ -39,6 +39,10 @@
  #include storage_backend_iscsi.h
  #include util.h
  #include memory.h
 +#include sys/types.h
 +#include sys/stat.h
 +#include fcntl.h
 +#include unistd.h
 
  #define VIR_FROM_THIS VIR_FROM_STORAGE
 
 @@ -159,13 +163,54 @@ virStorageBackendISCSIConnection(virConnectPtr conn,
   const char *portal,
   const char *action)
  {
 -const char *const cmdargv[] = {
 -ISCSIADM, --mode, node, --portal, portal,
 ---targetname, pool-def-source.devices[0].path, action, NULL
 -};
 -
 -if (virRun(conn, cmdargv, NULL)  0)
 -return -1;
 +DIR *dir;
 +struct dirent *entry;
 +
 +
 + if (pool-def-source.initiator.iqnname != NULL) {
 
 What's the point of this loop?  At best, it's unneeded complexity, at 
 worst it will match multiple interface names which will create the 
 multiple sessions per pool scenario that I explicitly want to avoid.
 
 Secondly, if you want to do some sort of validation of the iqn, why are 
 you reading from a hardcoded directory?  Can you use the output of 
 iscsiadm?  That is likely to be a more stable interface than the 
 directory which I would expect is a compile time option to the iscsi 
 initiator.

I'm really wondering much the same here - I don't see the purpose
in iterating over this directory. The iqn given in the XML ought
to be able to be passed straight to iscsadm's -I parameter


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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 v2] Disk- and Controller Hotplug

2009-11-17 Thread Daniel P. Berrange
On Tue, Nov 17, 2009 at 12:53:31AM +0100, wolfgang.maue...@siemens.com wrote:
 Hi,
 
 this is the second revision of a patch series to improve disk
 hotadd support for libvirt. It focuses on the qemu backend, but
 is naturally designed to be compatible with other backends as
 well. The objective is two-fold:
 
 1.) Split off controller from disk handling. This is done by
 introducing a new domain element controller that is used to
 describe disk controllers. Support for hotplugging such
 controllers is added.  Support to reference controllers by
 name is also included.
 2.) disks can now be associated with a specific controller;
 this is done by means of a controller subelemnt for disks.
 
 This patch addresses the questions that were raised during the
 review of the initial submission, massages the code by fixing
 some whitespace issues, gets static controller configurations to
 work, and adds documentation. Notice that in contrast to the
 first submission I did not include the patch that adds support
 for disk- and controller hot_remove_. Since the qemu codebase is
 still in bit of a flux wrt.  the necessary patches required for
 this functionality, it will reappear some time later as a
 separate submission.

What libvirt version / GIT changeset  did you create these patches
against ?  The current libvirt QEMU driver code in GIT is quite
different, so the patches here don't apply for me as is.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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] RFC exposing SRIOV PF-VF relationships

2009-11-17 Thread Dave Allan

Daniel P. Berrange wrote:

On Mon, Nov 16, 2009 at 04:14:34PM -0500, Dave Allan wrote:
It would be helpful to have an API that exposes the relationship between 
SR IOV physical functions (PFs) and virtual functions (VFs).  I'm 
thinking of implementing three new API calls and adding a small amount 
of additional information in the node device pci device capability, as 
in the attached patch.  Let me know what you think.


Do we really need extra APis for this, vs exposing it in the XML ?

I'd think we either use the existing parent/child relationship. ie
munge a VF's parent link to point to the PF device, or we could just
add a new element giving the device name of the physical function.


My first thought was also to use the parent/child relationship, but I 
talked to Chris Wright about it and the PF/VF relationship is in 
addition to, rather than a replacement of, the parent/child device 
relationship.  In other words, the parent of both a PF and VF is the PCI 
device, so we do need to add new elements for physical and virtual 
functions.  I'll dispense with the API and simply add to the XML.


Dave

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


RE: [libvirt] Re: [Patch v0.4] iSCSI Multi-IQN (Libvirt Support)

2009-11-17 Thread Shyam_Iyer


 -Original Message-
 From: Daniel P. Berrange [mailto:berra...@redhat.com]
 Sent: Tuesday, November 17, 2009 11:21 PM
 To: Dave Allan
 Cc: Bellad, Sudhir; libvir-list@redhat.com; Iyer, Shyam; Domsch, Matt;
 KM, Paniraja
 Subject: Re: [libvirt] Re: [Patch v0.4] iSCSI Multi-IQN (Libvirt
 Support)
 
 On Mon, Nov 16, 2009 at 01:58:08PM -0500, Dave Allan wrote:
  diff --git a/src/storage_backend_iscsi.c
 b/src/storage_backend_iscsi.c
  index b516add..1fb21a5 100644
  --- a/src/storage_backend_iscsi.c
  +++ b/src/storage_backend_iscsi.c
  @@ -39,6 +39,10 @@
   #include storage_backend_iscsi.h
   #include util.h
   #include memory.h
  +#include sys/types.h
  +#include sys/stat.h
  +#include fcntl.h
  +#include unistd.h
 
   #define VIR_FROM_THIS VIR_FROM_STORAGE
 
  @@ -159,13 +163,54 @@ virStorageBackendISCSIConnection(virConnectPtr
 conn,
const char *portal,
const char *action)
   {
  -const char *const cmdargv[] = {
  -ISCSIADM, --mode, node, --portal, portal,
  ---targetname, pool-def-source.devices[0].path, action,
 NULL
  -};
  -
  -if (virRun(conn, cmdargv, NULL)  0)
  -return -1;
  +DIR *dir;
  +struct dirent *entry;
  +
  +
  +   if (pool-def-source.initiator.iqnname != NULL) {
 
  What's the point of this loop?  At best, it's unneeded complexity,
at
  worst it will match multiple interface names which will create the
  multiple sessions per pool scenario that I explicitly want to avoid.
 
  Secondly, if you want to do some sort of validation of the iqn, why
 are
  you reading from a hardcoded directory?  Can you use the output of
  iscsiadm?  That is likely to be a more stable interface than the
  directory which I would expect is a compile time option to the iscsi
  initiator.
 
 I'm really wondering much the same here - I don't see the purpose
 in iterating over this directory. The iqn given in the XML ought
 to be able to be passed straight to iscsadm's -I parameter
 

Iscsiadm's -I parameter takes iface name as the parameter value and not
the iqn name.

So I believe this approach could be taken -

1) Get the iqn for the corresponding iface name using the following
command
#iscsiadm -m iface

Example output:

[r...@localhost libvirt-0.7.1-15-org]# iscsiadm -m iface
default tcp,default,default,unknown
iser iser,default,default,unknown
bnx2i bnx2i,default,default,unknown
iface1 tcp,default,default,iqn.1994-05.com.fedora:iqnBellad
iface3 tcp,default,default,iqn.dell
iface0 tcp,unknown,unknown,iqn.1994-05.com.fedora:iqnSudhir

The last value is the initiator iqn name.


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


Re: [libvirt] Re: [Patch v0.4] iSCSI Multi-IQN (Libvirt Support)

2009-11-17 Thread Dave Allan

shyam_i...@dell.com wrote:



-Original Message-
From: Daniel P. Berrange [mailto:berra...@redhat.com]
Sent: Tuesday, November 17, 2009 11:21 PM
To: Dave Allan
Cc: Bellad, Sudhir; libvir-list@redhat.com; Iyer, Shyam; Domsch, Matt;
KM, Paniraja
Subject: Re: [libvirt] Re: [Patch v0.4] iSCSI Multi-IQN (Libvirt
Support)

On Mon, Nov 16, 2009 at 01:58:08PM -0500, Dave Allan wrote:

diff --git a/src/storage_backend_iscsi.c

b/src/storage_backend_iscsi.c

index b516add..1fb21a5 100644
--- a/src/storage_backend_iscsi.c
+++ b/src/storage_backend_iscsi.c
@@ -39,6 +39,10 @@
 #include storage_backend_iscsi.h
 #include util.h
 #include memory.h
+#include sys/types.h
+#include sys/stat.h
+#include fcntl.h
+#include unistd.h

 #define VIR_FROM_THIS VIR_FROM_STORAGE

@@ -159,13 +163,54 @@ virStorageBackendISCSIConnection(virConnectPtr

conn,

  const char *portal,
  const char *action)
 {
-const char *const cmdargv[] = {
-ISCSIADM, --mode, node, --portal, portal,
---targetname, pool-def-source.devices[0].path, action,

NULL

-};
-
-if (virRun(conn, cmdargv, NULL)  0)
-return -1;
+DIR *dir;
+struct dirent *entry;
+
+
+   if (pool-def-source.initiator.iqnname != NULL) {

What's the point of this loop?  At best, it's unneeded complexity,

at

worst it will match multiple interface names which will create the
multiple sessions per pool scenario that I explicitly want to avoid.

Secondly, if you want to do some sort of validation of the iqn, why

are

you reading from a hardcoded directory?  Can you use the output of
iscsiadm?  That is likely to be a more stable interface than the
directory which I would expect is a compile time option to the iscsi
initiator.

I'm really wondering much the same here - I don't see the purpose
in iterating over this directory. The iqn given in the XML ought
to be able to be passed straight to iscsadm's -I parameter



Iscsiadm's -I parameter takes iface name as the parameter value and not
the iqn name.

So I believe this approach could be taken -

1) Get the iqn for the corresponding iface name using the following
command
#iscsiadm -m iface

Example output:

[r...@localhost libvirt-0.7.1-15-org]# iscsiadm -m iface
default tcp,default,default,unknown
iser iser,default,default,unknown
bnx2i bnx2i,default,default,unknown
iface1 tcp,default,default,iqn.1994-05.com.fedora:iqnBellad
iface3 tcp,default,default,iqn.dell
iface0 tcp,unknown,unknown,iqn.1994-05.com.fedora:iqnSudhir

The last value is the initiator iqn name.



Oh, ok, that makes sense.  If you use the output of iscsiadm and STREQ 
on a portion of the output instead of strstr to match the iqn, that 
should be fine.  You should also break out of the loop once you've 
matched the iqn.


Dave

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