Re: [libvirt] kernel summit topic - 'containers end-game'

2009-06-30 Thread Balbir Singh
* Serge E. Hallyn  [2009-06-30 15:06:13]:

> Quoting Balbir Singh (bal...@linux.vnet.ibm.com):
> > On Tue, Jun 23, 2009 at 8:26 PM, Serge E. Hallyn wrote:
> > > A topic on ksummit agenda is 'containers end-game and how do we
> > > get there'.
> > >
> > > So for starters, looking just at application (and system) containers, 
> > > what do
> > > the libvirt and liblxc projects want to see in kernel support that is 
> > > currently
> > > missing?  Are there specific things that should be done soon to make 
> > > containers
> > > more useful and usable?
> > >
> > > More generally, the topic raises the question... what 'end-games' are 
> > > there?
> > > A few I can think of off-hand include:
> > >
> > >        1. resource control
> > 
> > We intend to hold a io-controller minisummit before KS, we should have
> > updates on that front. We also need to discuss CPU hard limits and
> > Memory soft limits. We need control for memory large page, mlock, OOM
> > notification support, shared page accounting, etc. Eventually on the
> > libvirt front, we want to isolate cgroup and lxc support into
> > individual components (long term)
> 
> Thanks, Balbir.  By the last sentence, are you talking about having
> cgroup in its own libcgroup, or do you mean something else?
> 
> On the topic of cgroups, does anyone not agree that we should try
> to get rid of the ns cgroup, at least once user namespaces can
> prevent root in a container from escaping their cgroup?
>

I would have no objections to trying to obsolete ns cgroup once user
namespaces can do what you suggest. 

-- 
Balbir

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


[libvirt] [PATCH] logging: remove unused level 0

2009-06-30 Thread Amy Griffis
Some more logging cleanup. Remove all references to log level 0,
and replace with VIR_LOG_DEBUG where appropriate. Also change any
hard numbers to the corresponding VirLogPriority and add
VIR_LOG_DEFAULT for the starting log level.

Signed-off-by: Amy Griffis 
   log_level: accepts the following values:
   
-0: no logging at all
 4: only errors
 3: warnings and errors
 2: informations, warnings and errors
@@ -84,20 +83,19 @@
 
 In all cases the x prefix is the minimal level, acting as a filter:
 
-  0: everything
   1: DEBUG
   2: INFO
   3: WARNING
   4: ERROR
 
 Multiple output can be defined , they just need to be separated by
-   spaces, e.g.: "3:syslog:libvirtd 0:file:/tmp/libvirt.log"
+   spaces, e.g.: "3:syslog:libvirtd 1:file:/tmp/libvirt.log"
will log all warnings and errors to syslog under the libvirtd ident
but also log everything debugging and informations included in the
file /tmp/libvirt.log
 For example setting up the following:
 export LIBVIRT_DEBUG=1
-export LIBVIRT_LOG_OUTPUTS="0:file:virsh.log"
+export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"
 and then running virsh will accumulate the logs in the
 virsh.log file in a way similar to:
 14:29:04.771: debug : virInitialize:278 : register drivers
diff --git a/qemud/libvirtd.conf b/qemud/libvirtd.conf
index 1fd5918..49de466 100644
--- a/qemud/libvirtd.conf
+++ b/qemud/libvirtd.conf
@@ -269,7 +269,7 @@
 # Logging controls
 #
 
-# Logging level: 0 none, 4 errors, 3 warnings, 2 informations, 1 debug
+# Logging level: 4 errors, 3 warnings, 2 informations, 1 debug
 # basically 1 will log everything possible
 #log_level = 3
 
@@ -303,13 +303,12 @@
 #x:file:file_path
 #  output to a file, with the given filepath
 # In all case the x prefix is the minimal level, acting as a filter
-#0: everything
 #1: DEBUG
 #2: INFO
 #3: WARNING
 #4: ERROR
 #
-# Multiple output can be defined , they just need to be separated by spaces.
+# Multiple output can be defined, they just need to be separated by spaces.
 # e.g.:
 # log_outputs="3:syslog:libvirtd"
 # to log all warnings and errors to syslog under the libvirtd ident
diff --git a/qemud/qemud.c b/qemud/qemud.c
index b5e3665..da20aa9 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -128,7 +128,7 @@ static int sigwrite = -1;   /* Signal handler pipe */
 static int ipsock = 0;  /* -l  Listen for TCP/IP */
 
 /* Defaults for logging */
-static int log_level = 3;
+static int log_level = VIR_LOG_DEFAULT;
 static char *log_filters = NULL;
 static char *log_outputs = NULL;
 
@@ -2499,15 +2499,16 @@ qemudSetLogging(virConfPtr conf, const char *filename) {
 log_outputs = strdup(debugEnv);
 }
 if (!log_outputs) {
+char *tmp = NULL;
 if (godaemon) {
-char *tmp = NULL;
 if (virAsprintf (&tmp, "%d:syslog:libvirtd", log_level) < 0)
 goto free_and_fail;
-virLogParseOutputs (tmp);
-VIR_FREE (tmp);
 } else {
-virLogParseOutputs("0:stderr:libvirtd");
+if (virAsprintf(&tmp, "%d:stderr", log_level) < 0)
+goto free_and_fail;
 }
+virLogParseOutputs(tmp);
+VIR_FREE(tmp);
 } else {
 virLogParseOutputs(log_outputs);
 }
diff --git a/src/logging.c b/src/logging.c
index fd1d5d4..d13ae0f 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -119,7 +119,7 @@ static int virLogNbOutputs = 0;
 /*
  * Default priorities
  */
-static virLogPriority virLogDefaultPriority = VIR_LOG_WARN;
+static virLogPriority virLogDefaultPriority = VIR_LOG_DEFAULT;
 
 static int virLogResetFilters(void);
 static int virLogResetOutputs(void);
@@ -174,7 +174,7 @@ int virLogStartup(void) {
 virLogLen = 0;
 virLogStart = 0;
 virLogEnd = 0;
-virLogDefaultPriority = VIR_LOG_WARN;
+virLogDefaultPriority = VIR_LOG_DEFAULT;
 virLogUnlock();
 return(0);
 }
@@ -196,7 +196,7 @@ int virLogReset(void) {
 virLogLen = 0;
 virLogStart = 0;
 virLogEnd = 0;
-virLogDefaultPriority = VIR_LOG_WARN;
+virLogDefaultPriority = VIR_LOG_DEFAULT;
 virLogUnlock();
 return(0);
 }
@@ -689,7 +689,7 @@ int virLogParseOutputs(const char *outputs) {
 virSkipSpaces(&cur);
 while (*cur != 0) {
 prio= virParseNumber(&cur);
-if ((prio < 0) || (prio > 4))
+if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR))
 return(-1);
 if (*cur != ':')
 return(-1);
@@ -770,7 +770,7 @@ int virLogParseFilters(const char *filters) {
 virSkipSpaces(&cur);
 while (*cur != 0) {
 prio= virParseNumber(&cur);
-if ((prio < 0) || (prio > 4))
+if ((prio < VIR_LOG_DEBUG) || (prio > VIR_LOG_ERROR))
 return(-1);
 if (*cur != ':')
 return(-1);
diff --git a/src/logging.h b/src/logging.h
index d99bb31..0b9

Re: [libvirt] [PATCH 1/1] Fix pool create when pool already exists.

2009-06-30 Thread Daniel P. Berrange
On Tue, Jun 30, 2009 at 04:22:38PM -0400, David Allan wrote:
> * src/storage_driver.c: don't call virStoragePoolObjRemove when a pool create 
> call fails because the pool already exists.
> ---
>  src/storage_driver.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/storage_driver.c b/src/storage_driver.c
> index 69dcbda..5a26993 100644
> --- a/src/storage_driver.c
> +++ b/src/storage_driver.c
> @@ -476,6 +476,8 @@ storagePoolCreate(virConnectPtr conn,
>  if (pool) {
>  virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
>"%s", _("storage pool already exists"));
> +virStoragePoolObjUnlock(pool);
> +pool = NULL;
>  goto cleanup;
>  }

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


[libvirt] [PATCH 1/1] Fix pool create when pool already exists.

2009-06-30 Thread David Allan
* src/storage_driver.c: don't call virStoragePoolObjRemove when a pool create 
call fails because the pool already exists.
---
 src/storage_driver.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/storage_driver.c b/src/storage_driver.c
index 69dcbda..5a26993 100644
--- a/src/storage_driver.c
+++ b/src/storage_driver.c
@@ -476,6 +476,8 @@ storagePoolCreate(virConnectPtr conn,
 if (pool) {
 virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
   "%s", _("storage pool already exists"));
+virStoragePoolObjUnlock(pool);
+pool = NULL;
 goto cleanup;
 }
 
-- 
1.6.0.6

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


[libvirt] [PATCH 0/1] Fix pool create when pool already exists

2009-06-30 Thread David Allan
When storagePoolCreate is called to define a pool that already exists, it 
mistakenly destroys the existing pool.  This patch fixes the problem.  

Dave

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


Re: [libvirt] kernel summit topic - 'containers end-game'

2009-06-30 Thread Serge E. Hallyn
Quoting Balbir Singh (bal...@linux.vnet.ibm.com):
> On Tue, Jun 23, 2009 at 8:26 PM, Serge E. Hallyn wrote:
> > A topic on ksummit agenda is 'containers end-game and how do we
> > get there'.
> >
> > So for starters, looking just at application (and system) containers, what 
> > do
> > the libvirt and liblxc projects want to see in kernel support that is 
> > currently
> > missing?  Are there specific things that should be done soon to make 
> > containers
> > more useful and usable?
> >
> > More generally, the topic raises the question... what 'end-games' are there?
> > A few I can think of off-hand include:
> >
> >        1. resource control
> 
> We intend to hold a io-controller minisummit before KS, we should have
> updates on that front. We also need to discuss CPU hard limits and
> Memory soft limits. We need control for memory large page, mlock, OOM
> notification support, shared page accounting, etc. Eventually on the
> libvirt front, we want to isolate cgroup and lxc support into
> individual components (long term)

Thanks, Balbir.  By the last sentence, are you talking about having
cgroup in its own libcgroup, or do you mean something else?

On the topic of cgroups, does anyone not agree that we should try
to get rid of the ns cgroup, at least once user namespaces can
prevent root in a container from escaping their cgroup?

thanks,
-serge

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


Re: [libvirt] feature or bug?

2009-06-30 Thread Daniel Veillard
On Tue, Jun 30, 2009 at 09:51:12AM -0400, Gene Czarcinski wrote:
> Yet another question.
> 
> I am using the virt-manager GUI.  When I begin to define a new guest and 
> attempt to "browse" to specify where the iso image file is, the GUI dialog 
> brings me up in my home directory.  But, almost everything associated with 
> libvirt is done as the root user.
> 
> By default, why isn't the initial directory "/var/lib/libvirt/images"?

  /var/lib/libvirt/images contains the images for the guest, i.e. the
data for your domain. The ISO will be the data needed to create the OS
for that guest, and that's different and can be located anywhere.

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] your patence is appreciated

2009-06-30 Thread Daniel Veillard
On Tue, Jun 30, 2009 at 09:46:37AM -0400, Gene Czarcinski wrote:
> I really hate being a bit of a PITA with all of my question/comments, but I 
> am 
> just trying to use Fedora virtualization in a manner where I can reasonably 
> manage the configuration.  
> 
> I suspect I am not the first ex-VMware user and I will not be the last such 
> user who is trying to use Fedora virtualization in place of VMware.  I am 
> very 
> familiar with how guests are "managed" with VMware.

  Okay, good to know !

> I want Fedora (and Linux) virtualization to be a good product.  Your patience 
> is appreciated!

  Good to know too, libvirt/virt-manager is present in various place and
with different capabilities, so one of the big difference w.r.t. VMWare
is that there is many variations, in a large part depending on your
setup, hence my initial answer.

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] feature or bug?

2009-06-30 Thread Gene Czarcinski
Yet another question.

I am using the virt-manager GUI.  When I begin to define a new guest and 
attempt to "browse" to specify where the iso image file is, the GUI dialog 
brings me up in my home directory.  But, almost everything associated with 
libvirt is done as the root user.

By default, why isn't the initial directory "/var/lib/libvirt/images"?

Gene

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


[libvirt] your patence is appreciated

2009-06-30 Thread Gene Czarcinski
I really hate being a bit of a PITA with all of my question/comments, but I am 
just trying to use Fedora virtualization in a manner where I can reasonably 
manage the configuration.  

I suspect I am not the first ex-VMware user and I will not be the last such 
user who is trying to use Fedora virtualization in place of VMware.  I am very 
familiar with how guests are "managed" with VMware.

I want Fedora (and Linux) virtualization to be a good product.  Your patience 
is appreciated!

Gene

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


Re: [libvirt] need some help/asdive

2009-06-30 Thread Gene Czarcinski
On Tuesday 30 June 2009 06:19:46 Daniel P. Berrange wrote:
> On Tue, Jun 30, 2009 at 04:47:31AM -0400, Gene Czarcinski wrote:
> > On Sunday 28 June 2009 11:35:55 Daniel P. Berrange wrote:
> > > > My second question concerns the location of the disk images:  what is
> > > > the "best practical way" to move these out of the root partition?  I
> > > > have come up with these different approaches which could/may work:
> > > >
> > > > 1. change the "path" value in /etc/libvirt/storage/default.xml to
> > > > point to a directory in a different partition.
> > > >
> > > > 2. Use a /etc/fstab entry to "bind mount" a directory in a separate
> > > > partition onto /var/lib/libvirt/images
> > > >
> > > > 3. Just use an /etc/fstab entry to mount a partition on
> > > > /var/lib/libvirt/images or, perhaps, on /var/lib/libvirt. [This could
> > > > be done during system installation]
> > > >
> > > > OK, any comments on these??
> > >
> > > There's no real 'right' answer here, but I'd recommend 1. really.
> >
> > There might not be a right answer but 1 is definitely a wrong answer.
>
> No it isn't.
>
> > Changing /etc/libvirt/storage/default.xml to point to a directory in a
> > separate partition with lost of free space was easy.  However, when I
> > tried to create a new guest using virt-manager and the creation "wizard",
> > for the disk image, it still showed the free space available in the root
> > partition (8GB) rather than that of the other partition (120GB),
>
> Sounds like you didn't reload the configuration after editing it. If you
> edit the file directly you need to send SIGHUP to the daemon. It is better
> to use the 'virsh pool-edit' command which ensures it is immediately
> reloaded.

So we are all working for the same base, I am running Fedora 11 with all 
updates applied as of the date of this message:

libvirt-0.6.2-12.fc11.x86_64
selinux-policy-3.6.12-57.fc11.noarch (from updates-testing)
kernel-2.6.29.5-191.fc11.x86_64
qemu-common-0.10.5-3.fc11.x86_64
qemu-kvm-0.10.5-3.fc11.x86_64

The processor is an AMD Phenom II 940 with 8 GB ram.

OK, I removed my bind-mount (which works) and edited 
/etc/libvirt/storage/default.xml so that "path" points to the directory in a 
separate "extra" partition from root.  Root currently has about 8GB free space 
and the "extra" partition has 120GB free space.  The file context for the 
directory on the "extra" partition has been setup with semanage.

I am not sure just what daemon you are talking about doing a SIGHUP to but I 
did:  "/etc/init.d/libvirtd restart"

When I try to create a new guest, the free space for the disk image is 8GB 
(same as root).

OK, reboot the host! [this should certainly force the configuration to be re-
read]

I try creating a new guest again but, again, the free space for the disk image 
is 8GB (still the same as root).

Now I change the "path" in /etc/libvirt/storage/default.xml back to 
/var/lib/libvirt/images", add the bind-mount entry to /etc/fstab to mount the 
"extra" partition on /var/lib/libvirt/images, reboot ... now when I try to 
create a new guest, the amount of free space for the disk image shows as 
120GB.

My guess is that "/var/lib/libvirt/images" is hardcoded somewhere in the code.

What am I missing?
* * * * *
BTW, the "virsh pool-edit" may be a great command but when I try it, it says 
it requires the "" option.

Also, when I do "virsh -h", a large number of commands are listed none of 
which I can find any documentation on through google (let alone on any man 
page).
* * * * *
Gene

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


[libvirt] PATCH : Opennebula, adding xen i686 domain capability and updating some error messages

2009-06-30 Thread Abel Míguez Rodríguez
Hi,

this patch uses "OPERATION_INVALID" error instead "OPERATION_FAILED" error 
where should be used, also adds a missing capability, defining Xen i686 domains.

Thanks for the patches,

--- one_driver.c.bak    2009-06-30 15:02:28.0 +0200
+++ one_driver.c    2009-06-30 15:02:29.0 +0200
@@ -505,7 +505,7 @@ static int oneDomainShutdown(virDomainPt
 ret= 0;
 goto return_point;
 }
-    oneError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+    oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
  _("Wrong state to perform action"));
 goto return_point;
 }
@@ -541,7 +541,7 @@ static int oneDomainDestroy(virDomainPtr
 if(c_oneCancel(vm->pid)) {
 /* VM not running, delete the instance at ONE DB */
 if(c_oneFinalize(vm->pid)){
-    oneError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+    oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
  _("Wrong state to perform action"));
 goto return_point;
 }
@@ -576,11 +576,11 @@ static int oneDomainSuspend(virDomainPtr
 ret=0;
 goto return_point;
 }
-    oneError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+    oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
  _("Wrong state to perform action"));
 goto return_point;
 }
-    oneError(dom->conn,dom,VIR_ERR_OPERATION_FAILED,
+    oneError(dom->conn,dom,VIR_ERR_OPERATION_INVALID,
  _("domain is not running"));
 } else {
 oneError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,
@@ -609,11 +609,11 @@ static int oneDomainResume(virDomainPtr 
 ret=0;
 goto return_point;
 }
-    oneError(dom->conn, dom, VIR_ERR_OPERATION_FAILED,
+    oneError(dom->conn, dom, VIR_ERR_OPERATION_INVALID,
  _("Wrong state to perform action"));
 goto return_point;
 }
-    oneError(dom->conn,dom,VIR_ERR_OPERATION_FAILED,
+    oneError(dom->conn,dom,VIR_ERR_OPERATION_INVALID,
  _("domain is not paused "));
 } else {
 oneError(dom->conn, dom, VIR_ERR_INVALID_DOMAIN,


--- one_conf.c.bak    2009-06-30 15:01:06.0 +0200
+++ one_conf.c    2009-06-30 15:00:58.0 +0200
@@ -94,6 +94,27 @@ virCapsPtr oneCapsInit(void)
 {
 goto no_memory;
 }
+    if ((guest = virCapabilitiesAddGuest(caps,
+ "xen",
+ "i686",
+ 32,
+ NULL,
+ NULL,
+ 0,
+ NULL)) == NULL)
+    {
+    goto no_memory;
+    }
+    if (virCapabilitiesAddGuestDomain(guest,
+  "one",
+  NULL,
+  NULL,
+  0,
+  NULL) == NULL)
+    {
+    goto no_memory;
+    }
+
 
 return caps;
 




Abel Miguez Rodriguez

 Distributed System Architecture Group  
 (http://dsa-research.org)

 GridWay, http://www.gridway.org
 OpenNEbula, http://www.opennebula.org




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


Re: [libvirt] PATCH: Remove unused Open Nebula code, fix potential missing NULL terminator

2009-06-30 Thread Daniel Veillard
On Tue, Jun 30, 2009 at 12:06:56PM +0100, Daniel P. Berrange wrote:
> This patch removes a bunch of unused Open Nebula code which has a number
> of flaws. It also fixes handling of a strncpy() call to ensure there is
> a NULL terminator in the copied string. And finally it makes a couple
> of strings be 'const' since they're never changed

  Great, that removes the problems pointed by Jim, ACK !

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] problem: deleting a guest

2009-06-30 Thread Gene Czarcinski
On Tuesday 30 June 2009 06:17:36 Daniel P. Berrange wrote:
> > 2. Delete the definition of a new guest but not the related configuration
> > and disk-image files.
>
> The "definition" is the configuration. If you delete an inactive guest,
> this is removing the configuration file on disk
>
> > 3. Delete the guest definition and the related configuration and disk
> > image files but NOT and CD/DVD image files external to
> > /var/lib/libvirt/images.
>
> The virt-manager UI already allows this. Select an inactive guest, and
> press the 'Delete' button. It'll offer to delete associated disks, and only
> selecting private disk images by default, but can be overriden to deleted
> shared disk and CDROMs if desired.

I must have been blind!  My only excuse is that I have not had my morning 
coffee!

The delete function is there [why didn't I see it?  ... I have no idea!].

The delete function does everything I want it to and even has the right set of 
options!

Change this up to "pilot error".  I am just thankful I did not bugzilla this!

Gene

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


[libvirt] PATCH: Remove unused Open Nebula code, fix potential missing NULL terminator

2009-06-30 Thread Daniel P. Berrange
This patch removes a bunch of unused Open Nebula code which has a number
of flaws. It also fixes handling of a strncpy() call to ensure there is
a NULL terminator in the copied string. And finally it makes a couple
of strings be 'const' since they're never changed

Daniel

Index: src/opennebula/one_client.c
===
RCS file: /data/cvs/libvirt/src/opennebula/one_client.c,v
retrieving revision 1.1
diff -u -p -r1.1 one_client.c
--- src/opennebula/one_client.c 24 Jun 2009 17:32:56 -  1.1
+++ src/opennebula/one_client.c 30 Jun 2009 11:05:12 -
@@ -33,16 +33,9 @@ void c_oneStart()
 xmlrpc_client_init2(&one_client.env, XMLRPC_CLIENT_NO_FLAGS,
 "OpenNebula API Client", "1.2", NULL, 0);
 
-one_client.error=0;
-
-#ifdef ONED_PORT
-one_client.url=(char *)malloc(64);
-snprintf(one_client.url, 63, "http://localhost:%d/RPC2";, ONED_PORT);
-#else
-one_client.url=(char *)"http://localhost:2633/RPC2";;
-#endif
-
-one_client.session=(char *)"one-session";
+one_client.error = 0;
+one_client.url = "http://localhost:2633/RPC2";;
+one_client.session = "one-session";
 };
 
 
@@ -94,35 +87,6 @@ int c_oneMigrate(int vmid, int hid, int 
 return c_oneReturnCode(resultP);
 }
 
-int c_oneAllocate(char* template_file)
-{
-int file;
-int size;
-int bytes_read;
-char *file_text;
-int return_code;
-
-file=open(template_file, O_RDONLY);
-size=lseek(file, 0, SEEK_END);
-lseek(file, 0, SEEK_SET);
-
-file_text=(char *)malloc(size+1);
-bytes_read=read(file, file_text, size);
-close(file);
-
-if(bytes_read==size) {
-file_text[size]=0;
-
-return_code=c_oneAllocateTemplate(file_text);
-free(file_text);
-
-return return_code;
-} else {
-free(file_text);
-return -1;
-}
-}
-
 int c_oneAllocateTemplate(char* vm_template)
 {
 xmlrpc_value *resultP;
@@ -222,6 +186,7 @@ int c_oneVmInfo(int vmid, char* ret_info
 if( return_code )
 {
 strncpy(ret_info, return_string, length-1);
+ret_info[length-1] = '\0';
 
 xmlrpc_DECREF(resultP);
 free(return_string);
@@ -241,9 +206,6 @@ void c_oneFree()
 {
 xmlrpc_env_clean(&one_client.env);
 xmlrpc_client_cleanup();
-#ifdef ONE_PORT
-free(one_client.url);
-#endif
 }
 
 
Index: src/opennebula/one_client.h
===
RCS file: /data/cvs/libvirt/src/opennebula/one_client.h,v
retrieving revision 1.1
diff -u -p -r1.1 one_client.h
--- src/opennebula/one_client.h 24 Jun 2009 17:32:56 -  1.1
+++ src/opennebula/one_client.h 30 Jun 2009 11:05:12 -
@@ -24,8 +24,8 @@
 
 struct _oneClient {
 xmlrpc_env env;
-char *url;
-char *session;
+const char *url;
+const char *session;
 char *error;
 };
 
@@ -38,8 +38,6 @@ int c_oneDeploy(int vmid, int hid);
 
 int c_oneMigrate(int vmid, int hid, int flag);
 
-int c_oneAllocate(char* template_file);
-
 int c_oneAllocateTemplate(char* vm_template);
 
 int c_oneAction(int vmid,char* action);

-- 
|: 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] How does libvirt 0.6.3 load kvm driver

2009-06-30 Thread Jason Wong

Daniel P. Berrange wrote:

On Tue, Jun 30, 2009 at 06:38:35PM +0800, Jason Wong wrote:
  

Daniel P. Berrange wrote:


On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
 
  
Let me clarify, the KVM qemu driver, in my understanding is the part 
that responsible for the communication between  KVM hypervisor and 
libvirt (I think it is in the source code qemu_driver.c).
For KVM kernel module, I have manually use "modprobe kvm" command into 
kernel.


Perhaps  I  should use the term "qemu driver" instead of "kvm driver".



Ah, so you mean the libvirt QEMU driver isn't working. The best first
step to diagnosing those problems is to stop the libvirtd daemon,
and run it manually with debugging enabled

  LIBVIRT_DEBUG=1 /usr/sbin/libvirtd

with any luck there will be some failure reported explaining why the
QEMU driver didn't activate.

Daniel
  

Dear Daniel,

I have enable the libvirt debug mode by setting LIBVIRT_DEBUG=1 and here 
is the debug message:


=== debug message 
=

17:41:11.219: debug : virInitialize:290 : register drivers
17:41:11.219: debug : virRegisterDriver:667 : registering Test as driver 0
17:41:11.219: debug : virRegisterNetworkDriver:567 : registering Test as 
network driver 0
17:41:11.219: debug : virRegisterStorageDriver:598 : registering Test as 
storage driver 0
17:41:11.219: debug : virRegisterDeviceMonitor:629 : registering Test as 
device driver 0

17:41:11.219: debug : virRegisterDriver:667 : registering Xen as driver 1
17:41:11.219: debug : vboxRegister:68 : VBoxCGlueInit failed: 0.0.0, 
errorval=-1

17:41:11.219: debug : virRegisterDriver:667 : registering VBOX as driver 2
17:41:11.219: debug : virConnectOpen:1050 : name=qemu:///system
17:41:11.219: debug : do_open:920 : name "qemu:///system" to URI 
components:

scheme qemu
opaque (null)
authority (null)
server (null)
user (null)
port 0
path /system

17:41:11.219: debug : do_open:930 : trying driver 0 (Test) ...
17:41:11.219: debug : do_open:936 : driver 0 Test returned DECLINED
17:41:11.219: debug : do_open:930 : trying driver 1 (Xen) ...
17:41:11.219: debug : do_open:936 : driver 1 Xen returned DECLINED
17:41:11.219: debug : do_open:930 : trying driver 2 (VBOX) ...
17:41:11.219: debug : do_open:936 : driver 2 VBOX returned DECLINED
libvir: error : could not connect to qemu:///system
17:41:11.219: debug : virUnrefConnect:210 : unref connection 0x60dd00 1
17:41:11.219: debug : virReleaseConnect:171 : release connection 0x60dd00
libvirt error: could not connect to qemu:///system (code=5)
error: failed to connect to hypervisor
end of debug message 
=


From the debug message, it seems that libvirt does not load qemu drivr 
but it load Xen and VBOX driver
However, the fact is that I have load KVM kernel module into kernel by 
using "modprobe kvm" and "modprobe kvm_intel"

And the result of "lsmod|grep kvm" shows:

= result of lsmod 
==

[r...@node2 ~]# lsmod | grep kvm
kvm_intel  46664  0
kvm   166224  1 kvm_intel
[r...@node2 ~]#
= end of result of lsmod 
=


--
Jason Wong

System engineer

Cluster Technology Limited

Email: hcw...@clustertech.com

Direct Line: (852) 2655-6129

Tel: (852) 2655-6100

Fax: (852) 2994-2101

Website: www.clustertech.com
--

**
The information and attachment contained in this e-mail originating from
Cluster Technology Limited is confidential and intended solely for
the specified addressees. If you have received this email in error,
please do not read, copy, distribute, disclose or use any information of
this email in any way and please immediately notify the sender and delete
this email. Thank you for your cooperation.
**

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


Re: [libvirt] How does libvirt 0.6.3 load kvm driver

2009-06-30 Thread Daniel P. Berrange
On Tue, Jun 30, 2009 at 06:38:35PM +0800, Jason Wong wrote:
> Daniel P. Berrange wrote:
> >On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
> >  
> 
> Let me clarify, the KVM qemu driver, in my understanding is the part 
> that responsible for the communication between  KVM hypervisor and 
> libvirt (I think it is in the source code qemu_driver.c).
> For KVM kernel module, I have manually use "modprobe kvm" command into 
> kernel.
> 
> Perhaps  I  should use the term "qemu driver" instead of "kvm driver".

Ah, so you mean the libvirt QEMU driver isn't working. The best first
step to diagnosing those problems is to stop the libvirtd daemon,
and run it manually with debugging enabled

  LIBVIRT_DEBUG=1 /usr/sbin/libvirtd

with any luck there will be some failure reported explaining why the
QEMU driver didn't activate.

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] How does libvirt 0.6.3 load kvm driver

2009-06-30 Thread Jason Wong

Daniel P. Berrange wrote:

On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
  

Dear all,

I found that libvirt 0.6.3 seems does not load KVM driver while libvirt 
0.3.3 does.


Situation description:

I am using CentOS 5.3, and the kernel I used is 2.6.30.
I downloaded the kernel from kernel.org andcompile it. KVM was compiled 
as a module.
libvirt: libvirt 0.6.3, released by Eucalyptus(a cloud computing 
infrastructure software which supports KVM as well)


(1) libvirt 0.6.3 does not load KVM driver




No libvirt release has ever loaded the KVM kernel modules. This is
left upto the OS distribution vendor to deal with. In Fedora, the
KVM RPM installs a script that loads them upon boot. I'm not sure
what CentOS does.

Daniel
  

Dear Daniel,

Let me clarify, the KVM qemu driver, in my understanding is the part 
that responsible for the communication between  KVM hypervisor and 
libvirt (I think it is in the source code qemu_driver.c).
For KVM kernel module, I have manually use "modprobe kvm" command into 
kernel.


Perhaps  I  should use the term "qemu driver" instead of "kvm driver".

--
Jason Wong

System engineer

Cluster Technology Limited

Email: hcw...@clustertech.com

Direct Line: (852) 2655-6129

Tel: (852) 2655-6100

Fax: (852) 2994-2101

Website: www.clustertech.com
--

**
The information and attachment contained in this e-mail originating from
Cluster Technology Limited is confidential and intended solely for
the specified addressees. If you have received this email in error,
please do not read, copy, distribute, disclose or use any information of
this email in any way and please immediately notify the sender and delete
this email. Thank you for your cooperation.
**

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


Re: [libvirt] need some help/asdive

2009-06-30 Thread Daniel P. Berrange
On Tue, Jun 30, 2009 at 04:47:31AM -0400, Gene Czarcinski wrote:
> On Sunday 28 June 2009 11:35:55 Daniel P. Berrange wrote:
> > > My second question concerns the location of the disk images:  what is the
> > > "best practical way" to move these out of the root partition?  I have
> > > come up with these different approaches which could/may work:
> > >
> > > 1. change the "path" value in /etc/libvirt/storage/default.xml to point
> > > to a directory in a different partition.
> > >
> > > 2. Use a /etc/fstab entry to "bind mount" a directory in a separate
> > > partition onto /var/lib/libvirt/images
> > >
> > > 3. Just use an /etc/fstab entry to mount a partition on
> > > /var/lib/libvirt/images or, perhaps, on /var/lib/libvirt. [This could be
> > > done during system installation]
> > >
> > > OK, any comments on these??
> >
> > There's no real 'right' answer here, but I'd recommend 1. really.
> 
> There might not be a right answer but 1 is definitely a wrong answer.

No it isn't.

> Changing /etc/libvirt/storage/default.xml to point to a directory in a 
> separate partition with lost of free space was easy.  However, when I tried 
> to 
> create a new guest using virt-manager and the creation "wizard", for the disk 
> image, it still showed the free space available in the root partition (8GB) 
> rather than that of the other partition (120GB),

Sounds like you didn't reload the configuration after editing it. If you
edit the file directly you need to send SIGHUP to the daemon. It is better
to use the 'virsh pool-edit' command which ensures it is immediately
reloaded.

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] problem: deleting a guest

2009-06-30 Thread Daniel P. Berrange
On Tue, Jun 30, 2009 at 05:13:49AM -0400, Gene Czarcinski wrote:
> I defined a new guest using the virt-manager GUI ... everything fine so far.  
> I 
> then decided that my definition was not correct (or I could be done with that 
> guest) and could not find a way to delete the guest.
> 
> OK, quit virt-manager, delete the configuration and disk-image files for the 
> guest, restart libvirtd, and then start virt-manager again.  The guest 
> definition (according to virt-manager) was still there.  I finnaly got rid of 
> the definition by re-booting the system.  THIS IS NOT SATISFACTORY!
> 
> IMHO, I should be able to:
> 
> 1. Define a new guest.
> 
> 2. Delete the definition of a new guest but not the related configuration and 
> disk-image files.

The "definition" is the configuration. If you delete an inactive guest,
this is removing the configuration file on disk

> 3. Delete the guest definition and the related configuration and disk image 
> files 
> but NOT and CD/DVD image files external to /var/lib/libvirt/images.

The virt-manager UI already allows this. Select an inactive guest, and press
the 'Delete' button. It'll offer to delete associated disks, and only selecting
private disk images by default, but can be overriden to deleted shared disk
and CDROMs if desired.

> 4. Import new guests which were created as clones, copied from another host, 
> or convert created from something like VMware.

That's on the todo list.

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] problem: deleting a guest

2009-06-30 Thread Daniel Veillard
On Tue, Jun 30, 2009 at 05:13:49AM -0400, Gene Czarcinski wrote:
> I defined a new guest using the virt-manager GUI ... everything fine so far.  
> I 
> then decided that my definition was not correct (or I could be done with that 
> guest) and could not find a way to delete the guest.
> 
> OK, quit virt-manager, delete the configuration and disk-image files for the 
> guest, restart libvirtd, and then start virt-manager again.  The guest 
> definition (according to virt-manager) was still there.  I finnaly got rid of 
> the definition by re-booting the system.  THIS IS NOT SATISFACTORY!

  Of course it's a bug, but you don't really provide any way to
reproduce it ! What kind of hypervisor/guest did you create. Was that
locally or remotely. What version of libvirt and virt-manager di you
use ? All this are basic informations allowing to process your feedback,
without them there is no way we can make any progress explaining or
working around that bug !

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] How does libvirt 0.6.3 load kvm driver

2009-06-30 Thread Daniel P. Berrange
On Tue, Jun 30, 2009 at 01:59:36PM +0800, Jason Wong wrote:
> Dear all,
> 
> I found that libvirt 0.6.3 seems does not load KVM driver while libvirt 
> 0.3.3 does.
> 
> Situation description:
> 
> I am using CentOS 5.3, and the kernel I used is 2.6.30.
> I downloaded the kernel from kernel.org andcompile it. KVM was compiled 
> as a module.
> libvirt: libvirt 0.6.3, released by Eucalyptus(a cloud computing 
> infrastructure software which supports KVM as well)
> 
> (1) libvirt 0.6.3 does not load KVM driver


No libvirt release has ever loaded the KVM kernel modules. This is
left upto the OS distribution vendor to deal with. In Fedora, the
KVM RPM installs a script that loads them upon boot. I'm not sure
what CentOS does.

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] problem: deleting a guest

2009-06-30 Thread Gene Czarcinski
I defined a new guest using the virt-manager GUI ... everything fine so far.  I 
then decided that my definition was not correct (or I could be done with that 
guest) and could not find a way to delete the guest.

OK, quit virt-manager, delete the configuration and disk-image files for the 
guest, restart libvirtd, and then start virt-manager again.  The guest 
definition (according to virt-manager) was still there.  I finnaly got rid of 
the definition by re-booting the system.  THIS IS NOT SATISFACTORY!

IMHO, I should be able to:

1. Define a new guest.

2. Delete the definition of a new guest but not the related configuration and 
disk-image files.

3. Delete the guest definition and the related configuration and disk image 
files 
but NOT and CD/DVD image files external to /var/lib/libvirt/images.

4. Import new guests which were created as clones, copied from another host, 
or convert created from something like VMware.

Not it is certainly possible (or even likely) that I h\just do not understand 
how to do things yet.  Or, this could be a bug.  Or, this could be a lack of 
capabilities.

Help appreciated in pointing me in the right direction.  I will bugzilla where 
appropriate.

Gene

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


Re: [libvirt] need some help/asdive

2009-06-30 Thread Gene Czarcinski
On Sunday 28 June 2009 11:35:55 Daniel P. Berrange wrote:
> > My second question concerns the location of the disk images:  what is the
> > "best practical way" to move these out of the root partition?  I have
> > come up with these different approaches which could/may work:
> >
> > 1. change the "path" value in /etc/libvirt/storage/default.xml to point
> > to a directory in a different partition.
> >
> > 2. Use a /etc/fstab entry to "bind mount" a directory in a separate
> > partition onto /var/lib/libvirt/images
> >
> > 3. Just use an /etc/fstab entry to mount a partition on
> > /var/lib/libvirt/images or, perhaps, on /var/lib/libvirt. [This could be
> > done during system installation]
> >
> > OK, any comments on these??
>
> There's no real 'right' answer here, but I'd recommend 1. really.

There might not be a right answer but 1 is definitely a wrong answer.

Changing /etc/libvirt/storage/default.xml to point to a directory in a 
separate partition with lost of free space was easy.  However, when I tried to 
create a new guest using virt-manager and the creation "wizard", for the disk 
image, it still showed the free space available in the root partition (8GB) 
rather than that of the other partition (120GB),

So I resorted to 2 which appears to work OK.

My current thinking is to use option 3 ultimately.  That way, I can get things 
configured when I install a new system.

If you believe that option 1 should work then there appears to be a bug.  
Please clarify.  If there is a bug, I will bugzilla it.

Gene

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