Re: [libvirt] [PATCH] add console support in libxl

2013-07-17 Thread Jim Fehlig
Bamvor Jian Zhang wrote:
 Hi, Jim

 thanks your reply. one comment below.

  已写入 Jim Fehlig jfeh...@suse.com On 07/04/2013 05:58 AM, Bamvor Jian 
 Zhang wrote:
   
 BTW, do all of these types work with Xen?  I've only tested with type 'pty', 
  
  
 which works fine with both pv and hvm guests. 
 
 i only test the pty type too. lots of type is introduced in 2b84e445(Add 
 libxenlight driver), i add the missing type compare with qemu driver. maybe 
 it will be used in future. for now, only pty is needed for my console patch.
   

I found some time today to test type={unix,tcp,file,udp} and they seem
to work fine with Xen 4.3, but HVM guests only.  I suppose that is
expected since qemu is not being used for serial ports for PV guests.

Can you fix all my previous comments, rebase the patch, and send a V2?

Oh, and one more thing...

 @@ -4739,6 +4857,7 @@ static virDriver libxlDriver = {
  .domainManagedSave = libxlDomainManagedSave, /* 0.9.2 */
  .domainHasManagedSaveImage = libxlDomainHasManagedSaveImage, /* 0.9.2 */
  .domainManagedSaveRemove = libxlDomainManagedSaveRemove, /* 0.9.2 */
 +.domainOpenConsole = libxlDomainOpenConsole, /* 1.0.8 */
  .domainIsActive = libxlDomainIsActive, /* 0.9.0 */
  .domainIsPersistent = libxlDomainIsPersistent, /* 0.9.0 */
  .domainIsUpdated = libxlDomainIsUpdated, /* 0.9.0 */

AFAIK,  the next release will be 1.1.1.

Regards,
Jim

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

Re: [libvirt] [PATCH] add console support in libxl

2013-07-17 Thread Eric Blake
On 07/17/2013 03:21 PM, Jim Fehlig wrote:
 Oh, and one more thing...
 
 @@ -4739,6 +4857,7 @@ static virDriver libxlDriver = {
  .domainManagedSave = libxlDomainManagedSave, /* 0.9.2 */
  .domainHasManagedSaveImage = libxlDomainHasManagedSaveImage, /* 0.9.2 */
  .domainManagedSaveRemove = libxlDomainManagedSaveRemove, /* 0.9.2 */
 +.domainOpenConsole = libxlDomainOpenConsole, /* 1.0.8 */
  .domainIsActive = libxlDomainIsActive, /* 0.9.0 */
  .domainIsPersistent = libxlDomainIsPersistent, /* 0.9.0 */
  .domainIsUpdated = libxlDomainIsUpdated, /* 0.9.0 */
 
 AFAIK,  the next release will be 1.1.1.

Correct; after 1.0.6, we released 1.1.0, and are now working towards 1.1.1.

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



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

Re: [libvirt] [PATCH] add console support in libxl

2013-07-16 Thread Bamvor Jian Zhang
Hi, Jim

thanks your reply. one comment below.

 已写入 Jim Fehlig jfeh...@suse.com On 07/04/2013 05:58 AM, Bamvor Jian 
 Zhang wrote:
  this patch introduce the console api in libxl driver for both pv and 
  hvm guest.  and import and update the libxlMakeChrdevStr function 
  which was deleted in commit dfa1e1dd. 
  
  Signed-off-by: Bamvor Jian Zhang bjzh...@suse.com 
  --- 
src/libxl/libxl_conf.c   |  97 ++ 
src/libxl/libxl_conf.h   |   3 ++ 
src/libxl/libxl_driver.c | 119  
 +++ 
3 files changed, 219 insertions(+) 
  
  diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c 
  index e170357..08095bc 100644 
  --- a/src/libxl/libxl_conf.c 
  +++ b/src/libxl/libxl_conf.c 
  @@ -332,6 +332,99 @@ error: 
} 
 
static int 
  +libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf) 
  +{ 
  +const char *type = virDomainChrTypeToString(def-source.type); 
  +int ret; 
  + 
  +if (!type) { 
  +virReportError(VIR_ERR_INTERNAL_ERROR, 
  +   %s, _(unexpected chr device type)); 
  +return -1; 
  +} 
  + 
  +switch (def-source.type) { 
  +case VIR_DOMAIN_CHR_TYPE_NULL: 
  +case VIR_DOMAIN_CHR_TYPE_STDIO: 
  +case VIR_DOMAIN_CHR_TYPE_VC: 
  +case VIR_DOMAIN_CHR_TYPE_PTY: 
  +if (virAsprintf(buf, %s, type)  0) { 
  +virReportOOMError(); 
  
 This will need rebased now that Michal's Introduce OOM reporting to  
 virAsprintf patchset is committed. 
  
 https://www.redhat.com/archives/libvir-list/2013-July/msg00506.html 
  
  +return -1; 
  +} 
  +break; 
  + 
  +case VIR_DOMAIN_CHR_TYPE_FILE: 
  +case VIR_DOMAIN_CHR_TYPE_PIPE: 
  +if (virAsprintf(buf, %s:%s, type, 
  +def-source.data.file.path)  0) { 
  +virReportOOMError(); 
  +return -1; 
  +} 
  +break; 
  + 
  +case VIR_DOMAIN_CHR_TYPE_DEV: 
  +if (virAsprintf(buf, %s, def-source.data.file.path)  0) { 
  +virReportOOMError(); 
  +return -1; 
  +} 
  +break; 
  +case VIR_DOMAIN_CHR_TYPE_UDP: { 
  +const char *connectHost = def-source.data.udp.connectHost; 
  +const char *bindHost = def-source.data.udp.bindHost; 
  +const char *bindService  = def-source.data.udp.bindService; 
  + 
  +if (connectHost == NULL) 
  +connectHost = ; 
  +if (bindHost == NULL) 
  +bindHost = ; 
  +if (bindService == NULL) 
  +bindService = 0; 
  + 
  +ret = virAsprintf(buf, udp:%s:%s@%s:%s, 
  +  connectHost, 
  +  def-source.data.udp.connectService, 
  +  bindHost, 
  +  bindService); 
  +if ( ret  0) { 
  
 Extra space between '(' and 'ret', caught by 'make syntax-check'. 
  
  +virReportOOMError(); 
  +return -1; 
  +} 
  +break; 
  +} 
  +case VIR_DOMAIN_CHR_TYPE_TCP: 
  +if (def-source.data.tcp.protocol ==  
 VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET) { 
  +ret = virAsprintf(buf, telnet:%s:%s%s, 
  +  def-source.data.tcp.host, 
  +  def-source.data.tcp.service, 
  +  def-source.data.tcp.listen ?  
 ,server,nowait : ); 
  +} else { 
  +ret = virAsprintf(buf, tcp:%s:%s%s, 
  +  def-source.data.tcp.host, 
  +  def-source.data.tcp.service, 
  +  def-source.data.tcp.listen ?  
 ,server,nowait : ); 
  +} 
  +if ( ret  0) { 
  
 Extra space here too. 
  
  +virReportOOMError(); 
  +return -1; 
  +} 
  +break; 
  + 
  +case VIR_DOMAIN_CHR_TYPE_UNIX: 
  +ret = virAsprintf(buf, unix:%s%s, 
  +  def-source.data.nix.path, 
  +  def-source.data.nix.listen ? 
  ,server,nowait  
 : ); 
  +if ( ret  0) { 
  
 And here. 

 BTW, do all of these types work with Xen?  I've only tested with type 'pty',  
  
 which works fine with both pv and hvm guests. 
i only test the pty type too. lots of type is introduced in 2b84e445(Add 
libxenlight driver), i add the missing type compare with qemu driver. maybe it 
will be used in future. for now, only pty is needed for my console patch.

thanks

Bamvor
  +virReportOOMError(); 
  +return -1; 
  +} 
  +break; 
  +} 
  + 
  +

Re: [libvirt] [PATCH] add console support in libxl

2013-07-12 Thread Jim Fehlig

On 07/04/2013 05:58 AM, Bamvor Jian Zhang wrote:

this patch introduce the console api in libxl driver for both pv and
hvm guest.  and import and update the libxlMakeChrdevStr function
which was deleted in commit dfa1e1dd.

Signed-off-by: Bamvor Jian Zhang bjzh...@suse.com
---
  src/libxl/libxl_conf.c   |  97 ++
  src/libxl/libxl_conf.h   |   3 ++
  src/libxl/libxl_driver.c | 119 +++
  3 files changed, 219 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index e170357..08095bc 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -332,6 +332,99 @@ error:
  }
  
  static int

+libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf)
+{
+const char *type = virDomainChrTypeToString(def-source.type);
+int ret;
+
+if (!type) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   %s, _(unexpected chr device type));
+return -1;
+}
+
+switch (def-source.type) {
+case VIR_DOMAIN_CHR_TYPE_NULL:
+case VIR_DOMAIN_CHR_TYPE_STDIO:
+case VIR_DOMAIN_CHR_TYPE_VC:
+case VIR_DOMAIN_CHR_TYPE_PTY:
+if (virAsprintf(buf, %s, type)  0) {
+virReportOOMError();


This will need rebased now that Michal's Introduce OOM reporting to 
virAsprintf patchset is committed.


https://www.redhat.com/archives/libvir-list/2013-July/msg00506.html


+return -1;
+}
+break;
+
+case VIR_DOMAIN_CHR_TYPE_FILE:
+case VIR_DOMAIN_CHR_TYPE_PIPE:
+if (virAsprintf(buf, %s:%s, type,
+def-source.data.file.path)  0) {
+virReportOOMError();
+return -1;
+}
+break;
+
+case VIR_DOMAIN_CHR_TYPE_DEV:
+if (virAsprintf(buf, %s, def-source.data.file.path)  0) {
+virReportOOMError();
+return -1;
+}
+break;
+case VIR_DOMAIN_CHR_TYPE_UDP: {
+const char *connectHost = def-source.data.udp.connectHost;
+const char *bindHost = def-source.data.udp.bindHost;
+const char *bindService  = def-source.data.udp.bindService;
+
+if (connectHost == NULL)
+connectHost = ;
+if (bindHost == NULL)
+bindHost = ;
+if (bindService == NULL)
+bindService = 0;
+
+ret = virAsprintf(buf, udp:%s:%s@%s:%s,
+  connectHost,
+  def-source.data.udp.connectService,
+  bindHost,
+  bindService);
+if ( ret  0) {


Extra space between '(' and 'ret', caught by 'make syntax-check'.


+virReportOOMError();
+return -1;
+}
+break;
+}
+case VIR_DOMAIN_CHR_TYPE_TCP:
+if (def-source.data.tcp.protocol == 
VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET) {
+ret = virAsprintf(buf, telnet:%s:%s%s,
+  def-source.data.tcp.host,
+  def-source.data.tcp.service,
+  def-source.data.tcp.listen ? ,server,nowait : 
);
+} else {
+ret = virAsprintf(buf, tcp:%s:%s%s,
+  def-source.data.tcp.host,
+  def-source.data.tcp.service,
+  def-source.data.tcp.listen ? ,server,nowait : 
);
+}
+if ( ret  0) {


Extra space here too.


+virReportOOMError();
+return -1;
+}
+break;
+
+case VIR_DOMAIN_CHR_TYPE_UNIX:
+ret = virAsprintf(buf, unix:%s%s,
+  def-source.data.nix.path,
+  def-source.data.nix.listen ? ,server,nowait : 
);
+if ( ret  0) {


And here.

BTW, do all of these types work with Xen?  I've only tested with type 'pty', 
which works fine with both pv and hvm guests.



+virReportOOMError();
+return -1;
+}
+break;
+}
+
+return 0;
+}
+
+static int
  libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
  {
  libxl_domain_build_info *b_info = d_config-b_info;
@@ -404,6 +497,10 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, 
libxl_domain_config *d_config)
  if (VIR_STRDUP(b_info-u.hvm.boot, bootorder)  0)
  goto error;
  
+if (def-nserials 

+(libxlMakeChrdevStr(def-serials[0], b_info-u.hvm.serial)  0))
+goto error;
+
  /*
   * The following comment and calculation were taken directly from
   * libxenlight's internal function libxl_get_required_shadow_memory():
diff --git a/src/libxl/libxl_conf.h