Re: [libvirt] how to test libvirt?

2016-02-24 Thread Yanbing Du



On 02/24/2016 03:31 PM, Zhangbo (Oscar) wrote:

Hi all:
   AFAIK, there're several ways to test libvirt:
 1) virt-test, which is driven by autotest or avocado-vt, based on qemu-kvm
 2) test driver which is parall to other drivers such as qemu_driver and 
libxl_driver in libvirt.


I'm afraid there's no such specific test suite for this.


 3) make -c tests, which aims to do low level tests, that is to test 
function modules of libvirt.
 4) libvirt-test-API

   I've got 2 questions:
 1) besides the 4 test suites, are there any other automatic-test tools?
 2) is there any testsuite used to test libxl_driver, similar to virt-test?


There's also libvirt-tck for perl binding testing, and cimtest suite for 
libvirt-cim testing.




   Anyone knows that? Thanks in advance.

Oscar.

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



--
Regards,
Yanbing Du

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


Re: [libvirt] [PATCH 5/6] tools: fix the wrong check when use virsh setvcpus --maximum

2015-03-22 Thread Yanbing Du



On 03/20/2015 10:39 PM, Pavel Hrdina wrote:

From: Luyao Huang lhu...@redhat.com

We will ignore --maximum option when only use setvcpus with
this option, like this (this error is another issue):

  # virsh setvcpus test3 --maximum 10
  error: Failed to create controller cpu for group: No such file or directory

this is because we do not set it in flags before we check if there is
a flags set.

Refactor these code and fix the logic.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1204033

Signed-off-by: Luyao Huang lhu...@redhat.com
Signed-off-by: Pavel Hrdina phrd...@redhat.com
---
  tools/virsh-domain.c | 30 ++
  1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1d8225c..9430ad9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6735,6 +6735,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
  VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
  VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
  VSH_EXCLUSIVE_OPTIONS_VAR(guest, config);
+VSH_EXCLUSIVE_OPTIONS_VAR(guest, maximum);
+VSH_EXCLUSIVE_OPTIONS_VAR(config, maximum);


'maximum' should be used with 'config', and 'live' and 'maximum' are 
mutually exclusive




  if (config)
  flags |= VIR_DOMAIN_AFFECT_CONFIG;
@@ -6742,9 +6744,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
  flags |= VIR_DOMAIN_AFFECT_LIVE;
  if (guest)
  flags |= VIR_DOMAIN_VCPU_GUEST;
-/* none of the options were specified */
-if (!current  flags == 0)
-flags = -1;
+if (maximum)
+flags |= VIR_DOMAIN_VCPU_MAXIMUM;

  if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
  return false;
@@ -6754,30 +6755,11 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
  goto cleanup;
  }

-if (flags == -1) {
+/* none of the options were specified */
+if (!current  flags == 0) {
  if (virDomainSetVcpus(dom, count) != 0)
  goto cleanup;
  } else {
-/* If the --maximum flag was given, we need to ensure only the
-   --config flag is in effect as well */
-if (maximum) {
-vshDebug(ctl, VSH_ERR_DEBUG, --maximum flag was given\n);
-
-flags |= VIR_DOMAIN_VCPU_MAXIMUM;
-
-/* If neither the --config nor --live flags were given, OR
-   if just the --live flag was given, we need to error out
-   warning the user that the --maximum flag can only be used
-   with the --config flag */
-if (live || !config) {
-
-/* Warn the user about the invalid flag combination */
-vshError(ctl, _(--maximum must be used with --config only));
-goto cleanup;
-}
-}
-
-/* Apply the virtual cpu changes */
  if (virDomainSetVcpusFlags(dom, count, flags)  0)
  goto cleanup;
  }



--
Regards,
Yanbing Du

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


[libvirt] [PATCH] virsh: Allow attach-disk to specify disk target bus

2014-07-01 Thread Yanbing Du
From: Yanbing Du y...@ydu-0.nay.redhat.com

By default, the bus type is inferred from the style of the device
name('target' in this command), e.g. a device named 'sda' will
typically be exported using a SCSI bus. Actually, not only SCSI bus,
but USB/SATA bus also use this kind of device name. So add '--bus'
option for attach-disk command to allow user specify the target bus.

Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c | 14 --
 tools/virsh.pod  |  9 +++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index f55dae4..4488250 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -277,6 +277,10 @@ static const vshCmdOptDef opts_attach_disk[] = {
  .flags = VSH_OFLAG_REQ,
  .help = N_(target of disk device)
 },
+{.name = bus,
+ .type = VSH_OT_STRING,
+ .help = N_(target bus of disk device)
+},
 {.name = driver,
  .type = VSH_OT_STRING,
  .help = N_(driver of disk device)
@@ -502,7 +506,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
 const char *source = NULL, *target = NULL, *driver = NULL,
 *subdriver = NULL, *type = NULL, *mode = NULL,
 *cache = NULL, *serial = NULL, *straddr = NULL,
-*wwn = NULL;
+*wwn = NULL, *targetbus = NULL;
 struct DiskAddress diskAddr;
 bool isFile = false, functionReturn = false;
 int ret;
@@ -536,6 +540,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
 vshCommandOptStringReq(ctl, cmd, serial, serial)  0 ||
 vshCommandOptStringReq(ctl, cmd, wwn, wwn)  0 ||
 vshCommandOptStringReq(ctl, cmd, address, straddr)  0 ||
+vshCommandOptStringReq(ctl, cmd, bus, targetbus)  0 ||
 vshCommandOptStringReq(ctl, cmd, sourcetype, stype)  0)
 goto cleanup;
 
@@ -590,7 +595,12 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
 if (source)
 virBufferAsprintf(buf, source %s='%s'/\n,
   isFile ? file : dev, source);
-virBufferAsprintf(buf, target dev='%s'/\n, target);
+virBufferAsprintf(buf, target dev='%s', target);
+if (targetbus) {
+virBufferAsprintf(buf,  bus='%s', targetbus);
+}
+virBufferAddLit(buf, /\n);
+
 if (mode)
 virBufferAsprintf(buf, %s/\n, mode);
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index b248c9a..3550825 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2091,7 +2091,7 @@ expected.
 
 =item Battach-disk Idomain Isource Itarget
 [[[I--live] [I--config] | [I--current]] | [I--persistent]]
-[I--driver driver] [I--subdriver subdriver] [I--cache cache]
+[I--bus] [I--driver driver] [I--subdriver subdriver] [I--cache cache]
 [I--type type] [I--mode mode] [I--sourcetype sourcetype]
 [I--serial serial] [I--wwn wwn] [I--rawio]
 [I--address address] [I--multifunction] [I--print-xml]
@@ -2099,7 +2099,12 @@ expected.
 Attach a new disk device to the domain.
 Isource is path for the files and devices. Itarget controls the bus or
 device under which the disk is exposed to the guest OS. It indicates the
-logical device name.  Idriver can be Ifile, Itap or Iphy for the Xen
+logical device name; the optional Ibus attribute specifies the type of
+disk device to emulate; possible values are driver specific, with typical
+values being Iide, Iscsi, Ivirtio, Ixen, Iusb, Isata, or Isd,
+if omitted, the bus type is inferred from the style of the device name (e.g.
+a device named 'sda' will typically be exported using a SCSI bus).
+Idriver can be Ifile, Itap or Iphy for the Xen
 hypervisor depending on the kind of access; or Iqemu for the QEMU emulator.
 Further details to the driver can be passed using Isubdriver. For Xen
 Isubdriver can be Iaio, while for QEMU subdriver should match the format
-- 
1.9.3

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


[libvirt] [PATCH] doc: Update help for virsh_desc command

2013-08-22 Thread Yanbing Du
Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ccb6080..47fd6cb 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6657,19 +6657,19 @@ static const vshCmdOptDef opts_desc[] = {
 },
 {.name = live,
  .type = VSH_OT_BOOL,
- .help = N_(modify/get running state)
+ .help = N_(get/set description of running state domain)
 },
 {.name = config,
  .type = VSH_OT_BOOL,
- .help = N_(modify/get persistent configuration)
+ .help = N_(get/set description of persistent definition domain)
 },
 {.name = current,
  .type = VSH_OT_BOOL,
- .help = N_(modify/get current state configuration)
+ .help = N_(get/set description of current state domain)
 },
 {.name = title,
  .type = VSH_OT_BOOL,
- .help = N_(modify/get the title instead of description)
+ .help = N_(get/set the title instead of description)
 },
 {.name = edit,
  .type = VSH_OT_BOOL,
-- 
1.7.1

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


[libvirt] [PATCH] virsh-domain: Check if domain is running for ttyconsole cmd

2013-08-13 Thread Yanbing Du
Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4081451..9ccbc35 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9139,6 +9139,12 @@ cmdTTYConsole(vshControl *ctl, const vshCmd *cmd)
 if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
 return false;
 
+/* Check if the domain is active */
+if (!virDomainIsActive(dom)) {
+vshError(ctl, _(Domain is not running));
+goto cleanup;
+}
+
 doc = virDomainGetXMLDesc(dom, 0);
 if (!doc)
 goto cleanup;
-- 
1.7.1

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


[libvirt] [PATCH] Fix the stdout in print_job_progress()

2013-03-29 Thread Yanbing Du
Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d1e6f9d..10b646f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1407,7 +1407,7 @@ print_job_progress(const char *label, unsigned long long 
remaining,
 
 /* see comments in vshError about why we must flush */
 fflush(stdout);
-fprintf(stderr, \r%s: [%3d %%], label, progress);
+fprintf(stdout, \r%s: [%3d %%], label, progress);
 fflush(stderr);
 }
 
-- 
1.7.1

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


Re: [libvirt] [PATCH] Fix the stdout in print_job_progress()

2013-03-29 Thread Yanbing Du


- Original Message -
 From: Eric Blake ebl...@redhat.com
 To: Yanbing Du y...@redhat.com
 Cc: libvir-list@redhat.com
 Sent: Friday, March 29, 2013 7:14:41 PM
 Subject: Re: [libvirt] [PATCH] Fix the stdout in print_job_progress()
 
 On 03/29/2013 04:33 AM, Yanbing Du wrote:
  Signed-off-by: Yanbing Du y...@redhat.com
  ---
   tools/virsh-domain.c |2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)
  
  diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
  index d1e6f9d..10b646f 100644
  --- a/tools/virsh-domain.c
  +++ b/tools/virsh-domain.c
  @@ -1407,7 +1407,7 @@ print_job_progress(const char *label,
  unsigned long long remaining,
   
   /* see comments in vshError about why we must flush */
   fflush(stdout);
  -fprintf(stderr, \r%s: [%3d %%], label, progress);
  +fprintf(stdout, \r%s: [%3d %%], label, progress);
 
 NACK.  Progress is intentionally reported to stderr (hence flushing
 stdout before printing progress, and flushing stderr after).
 

OK, i see. 
Thanks for your reply.

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

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


[libvirt] [PATCH] Correct DESCRIPTION for virsh help blockcopy

2013-03-26 Thread Yanbing Du
Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 592a6e8..fc5cb1e 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1603,7 +1603,7 @@ static const vshCmdInfo info_block_copy[] = {
  .data = N_(Start a block copy operation.)
 },
 {.name = desc,
- .data = N_(Populate a disk from its backing image.)
+ .data = N_(Copy a disk backing image chain to dest.)
 },
 {.name = NULL}
 };
-- 
1.7.1

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


[libvirt] [PATCH] Remove the redundant parentheses in migrate help

2013-03-25 Thread Yanbing Du
Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 128e516..592a6e8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -8286,7 +8286,7 @@ static const vshCmdOptDef opts_migrate[] = {
 },
 {.name = change-protection,
  .type = VSH_OT_BOOL,
- .help = N_(prevent any configuration changes to domain until migration 
ends))
+ .help = N_(prevent any configuration changes to domain until migration 
ends)
 },
 {.name = unsafe,
  .type = VSH_OT_BOOL,
-- 
1.7.1

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


[libvirt] [PATCH] Fix a copypaste error for virsh dump help

2013-03-15 Thread Yanbing Du
Signed-off-by: Yanbing Du y...@redhat.com
---
 tools/virsh-domain.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ab90f58..aa45e72 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4358,7 +4358,7 @@ static const vshCmdOptDef opts_dump[] = {
 {.name = bypass-cache,
  .type = VSH_OT_BOOL,
  .flags = 0,
- .help = N_(avoid file system cache when saving)
+ .help = N_(avoid file system cache when dumping)
 },
 {.name = reset,
  .type = VSH_OT_BOOL,
-- 
1.7.1

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