Re: [libvirt] [PATCH 1/5] Public API to allow defining new domain using OVA file

2013-02-11 Thread Daniel P. Berrange
On Fri, Feb 08, 2013 at 05:26:24PM -0800, Ata Bohra wrote:
> 
> 
> 
> > NACK,  as I said with previous postings, this does not belong in
> > libvirt APIs, it should be built as a layer above. 
> [AB]: Thanks for reviewing this Daniel. I completly understand the concern of 
> not making it part of libvirt API, but as discussed in other thread 
> (https://www.redhat.com/archives/libvir-list/2012-December/msg00385.html) I 
> was unable to find API supported way to 
> upload OVA disk to the ESX server (which is an integral part of OVA install). 

See the virStorageVolUpload API.

> >Further this API design fundamentally flawed as it is assuming the hypervisor
> > driver can access files that are on the libvirt application
> > machine which is not the case in general.
> [AB]: If possible please suggest if there can be any other way to overcome
>   this design flaw.  
> Further, there are two unrealted reviews that I posted fixing issues with
> exisitng ESX driver, it would be useful if someone can review them.

Again see the design of the virStorageVolUpload API

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


Re: [libvirt] [PATCH 1/5] Public API to allow defining new domain using OVA file

2013-02-08 Thread Ata Bohra



> NACK,  as I said with previous postings, this does not belong in
> libvirt APIs, it should be built as a layer above. 
[AB]: Thanks for reviewing this Daniel. I completly understand the concern of 
not making it part of libvirt API, but as discussed in other thread 
(https://www.redhat.com/archives/libvir-list/2012-December/msg00385.html) I was 
unable to find API supported way to 
upload OVA disk to the ESX server (which is an integral part of OVA install). 
 
>Further this API design fundamentally flawed as it is assuming the hypervisor
> driver can access files that are on the libvirt application
> machine which is not the case in general.
[AB]: If possible please suggest if there can be any other way to overcome  
this design flaw.  
Further, there are two unrealted reviews that I posted fixing issues with
exisitng ESX driver, it would be useful if someone can review them.
 
1. https://www.redhat.com/archives/libvir-list/2012-December/msg01377.html
2. https://www.redhat.com/archives/libvir-list/2013-January/msg7.html

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

Re: [libvirt] [PATCH 1/5] Public API to allow defining new domain using OVA file

2013-01-07 Thread Daniel P. Berrange
On Sat, Jan 05, 2013 at 11:33:51PM -0800, Ata E Husain Bohra wrote:
> Appends a new API to libvirt public driver that supports
> defining a new domain using OVA format.
> 
> API expects following inputs:
> 1. connection pointer.
> 2. path to OVA package (single file format).
> 3. Storage pool name where new domain needs to be created.
> 
> API returns pointers to newly created domain that is not powered ON.
> 
> Libvirt driver sanitizes the inputs and calls hypervisor specific
> driver callbacks to abstract OVA install implementation.
> ---
>  include/libvirt/libvirt.h.in |3 +++
>  src/driver.h |5 
>  src/libvirt.c|   58 
> ++
>  src/libvirt_public.syms  |5 
>  4 files changed, 71 insertions(+)
> 
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index 09c89c5..ea342bc 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1919,6 +1919,9 @@ int virDomainMemoryPeek 
> (virDomainPtr dom,
>   */
>  virDomainPtrvirDomainDefineXML  (virConnectPtr conn,
>   const char *xml);
> +virDomainPtrvirDomainDefineOVA  (virConnectPtr conn,
> + const char *ovapath,
> + const char *poolname);


NACK,  as I said with previous postings, this does not belong in
libvirt APIs, it should be built as a layer above. Further this
API design fundamentally flawed as it is assuming the hypervisor
driver can access files that are on the libvirt application
machine which is not the case in general.

Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

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


[libvirt] [PATCH 1/5] Public API to allow defining new domain using OVA file

2013-01-05 Thread Ata E Husain Bohra
Appends a new API to libvirt public driver that supports
defining a new domain using OVA format.

API expects following inputs:
1. connection pointer.
2. path to OVA package (single file format).
3. Storage pool name where new domain needs to be created.

API returns pointers to newly created domain that is not powered ON.

Libvirt driver sanitizes the inputs and calls hypervisor specific
driver callbacks to abstract OVA install implementation.
---
 include/libvirt/libvirt.h.in |3 +++
 src/driver.h |5 
 src/libvirt.c|   58 ++
 src/libvirt_public.syms  |5 
 4 files changed, 71 insertions(+)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 09c89c5..ea342bc 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1919,6 +1919,9 @@ int virDomainMemoryPeek (virDomainPtr 
dom,
  */
 virDomainPtrvirDomainDefineXML  (virConnectPtr conn,
  const char *xml);
+virDomainPtrvirDomainDefineOVA  (virConnectPtr conn,
+ const char *ovapath,
+ const char *poolname);
 int virDomainUndefine   (virDomainPtr domain);
 
 typedef enum {
diff --git a/src/driver.h b/src/driver.h
index 01c95cf..08382a0 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -274,6 +274,10 @@ typedef int
 typedef virDomainPtr
 (*virDrvDomainDefineXML)(virConnectPtr conn,
  const char *xml);
+typedef virDomainPtr
+(*virDrvDomainDefineOVA)(virConnectPtr conn,
+ const char *ovapath,
+ const char *poolname);
 typedef int
 (*virDrvDomainUndefine) (virDomainPtr dom);
 typedef int
@@ -1008,6 +1012,7 @@ struct _virDriver {
 virDrvDomainCreate  domainCreate;
 virDrvDomainCreateWithFlags domainCreateWithFlags;
 virDrvDomainDefineXML   domainDefineXML;
+virDrvDomainDefineOVA   domainDefineOVA;
 virDrvDomainUndefinedomainUndefine;
 virDrvDomainUndefineFlags   domainUndefineFlags;
 virDrvDomainAttachDevicedomainAttachDevice;
diff --git a/src/libvirt.c b/src/libvirt.c
index 6d1da12..bdc21b4 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1988,6 +1988,8 @@ error:
 return NULL;
 }
 
+
+
 /**
  * virDomainCreateLinux:
  * @conn: pointer to the hypervisor connection
@@ -8334,6 +8336,62 @@ error:
 }
 
 /**
+ * virDomainDefineOVA:
+ * @conn: pointer to the hypervisor connection
+ * @ovapath: OVA file path
+ * @poolname: storage pool where domain needs to be created
+ *
+ * OVA stands for Open Virtualuzation Archive and consist of
+ * three important components:
+ * 1. XML descriptor: defines the virtual machine hardware description,
+ *network connectivity etc.
+ * 2. Virtual disk (may be compressed or optimized).
+ * 3. Manifest file.
+ *
+ * Define a new domain but does not start it.
+ * This function may require privileged access to the hypervisor.
+ *
+ * Returns a new domain object or NULL in case of failure
+ */
+virDomainPtr
+virDomainDefineOVA(virConnectPtr conn, const char *ovapath,
+   const char *poolname)
+{
+VIR_DEBUG("conn=%p, ovaPath=%s, poolname=%s",
+  conn, ovapath, poolname);
+
+virResetLastError();
+
+if (!VIR_IS_CONNECT(conn)) {
+virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+virDispatchError(NULL);
+return NULL;
+}
+if (conn->flags & VIR_CONNECT_RO) {
+virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+goto error;
+}
+virCheckNonNullArgGoto(ovapath, error);
+virCheckNonNullArgGoto(poolname, error);
+
+if (conn->driver->domainDefineOVA) {
+virDomainPtr ret;
+ret = conn->driver->domainDefineOVA(
+conn, ovapath, poolname);
+if (!ret)
+goto error;
+return ret;
+}
+
+virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+virDispatchError(conn);
+return NULL;
+
+}
+
+/**
  * virDomainCreate:
  * @domain: pointer to a defined domain
  *
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 2107519..1af48c9 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -585,4 +585,9 @@ LIBVIRT_1.0.2 {
 virDomainOpenChannel;
 } LIBVIRT_1.0.1;
 
+LIBVIRT_1.0.3 {
+global:
+virDomainDefineOVA;
+} LIBVIRT_1.0.2;
+
 #  define new API here using predicted next version number 
-- 
1.7.9.5

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