[libvirt] Ping Re: [PATCH V4] blockjob: Fix error checking of blockjob status

2018-01-12 Thread WangJie (Captain)
ping

On 2018/1/5 10:53, Jie Wang wrote:
> offset and len can also be equal to 0 on failed if blockjob return
> status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
> so we need to check 'error' in this case.
> ---
>  src/qemu/qemu_monitor_json.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..39c0909 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>  case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
>  error = virJSONValueObjectGetString(data, "error");
>  /* Make sure the whole device has been processed */
> -if (offset != len)
> +if (offset != len || error)
>  event = VIR_DOMAIN_BLOCK_JOB_FAILED;
>  break;
>  case VIR_DOMAIN_BLOCK_JOB_CANCELED:
> 

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


[libvirt] Ping Re: [PATCH V4] blockjob: Fix error checking of blockjob status

2018-01-09 Thread WangJie (Captain)
Ping

On 2018/1/5 10:53, Jie Wang wrote:
> offset and len can also be equal to 0 on failed if blockjob return
> status:"BLOCK_JOB_COMPLETED" with error:"File descriptor in bad state",
> so we need to check 'error' in this case.
> ---
>  src/qemu/qemu_monitor_json.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index e45868b..39c0909 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
>  case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
>  error = virJSONValueObjectGetString(data, "error");
>  /* Make sure the whole device has been processed */
> -if (offset != len)
> +if (offset != len || error)
>  event = VIR_DOMAIN_BLOCK_JOB_FAILED;
>  break;
>  case VIR_DOMAIN_BLOCK_JOB_CANCELED:


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


[libvirt] Ping Re: A question for external snapshots with flag“VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE”

2017-02-27 Thread WangJie (Captain)


On 2017/2/25 9:41, WangJie (Captain) wrote:
> Hello, I got a question here. When we create consistent active external 
> snapshots with flag “VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE” , the 
> qemuDomainSnapshotFSFreeze will be called firstly to freeze all filesystems 
> in vm, and then create snapshots. For windows vm, freezing filesystems used 
> by vss service. If IO pressure in vm is too big or internal error happened in 
> vss , freezing filesytems will failed , and qemuDomainSnapshotFSFreeze 
> returns 0 which meaning that no filesystems are frozen. In the function 
> qemuDomainSnapshotCreateActiveExternal, libvirt creates external snapshots 
> all the same in such a situation that qemuDomainSnapshotFSFreeze returns 0, 
> but the created snapshots are not consistent snapshots in such a situation . 
> So shouldn't we abandon creating snapshots and goto cleanup in the situation 
> that qemuDomainSnapshotFSFreeze returns 0?
>
> The code below:
>
>
> static int
> qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
>virQEMUDriverPtr driver,
>virDomainObjPtr vm,
>virDomainSnapshotObjPtr snap,
>unsigned int flags)
> {
> virObjectEventPtr event;
> bool resume = false;
> int ret = -1;
> qemuDomainObjPrivatePtr priv = vm->privateData;
> char *xml = NULL;
> bool memory = snap->def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
> bool memory_unlink = false;
> bool atomic = !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC);
> bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION);
> int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
> bool pmsuspended = false;
> virQEMUDriverConfigPtr cfg = NULL;
> int compressed;
> char *compressedpath = NULL;
>
> /* If quiesce was requested, then issue a freeze command, and a
>  * counterpart thaw command when it is actually sent to agent.
>  * The command will fail if the guest is paused or the guest agent
>  * is not running, or is already quiesced.  */
> if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) {
> int freeze = qemuDomainSnapshotFSFreeze(driver, vm, NULL, 0);
> if (freeze < 0) {
> /* the helper reported the error */
> if (freeze == -2)
> thaw = -1; /* the command is sent but agent failed */
> goto cleanup;
> }
> thaw = 1;
> }
> 
> ..
> .. 

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

[libvirt] A question for external snapshots with flag“VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE”

2017-02-24 Thread WangJie (Captain)
Hello, I got a question here. When we create consistent active external 
snapshots with flag “VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE” , the 
qemuDomainSnapshotFSFreeze will be called firstly to freeze all filesystems in 
vm, and then create snapshots. For windows vm, freezing filesystems used by vss 
service. If IO pressure in vm is too big or internal error happened in vss , 
freezing filesytems will failed , and qemuDomainSnapshotFSFreeze returns 0 
which meaning that no filesystems are frozen. In the function 
qemuDomainSnapshotCreateActiveExternal, libvirt creates external snapshots all 
the same in such a situation that qemuDomainSnapshotFSFreeze returns 0, but the 
created snapshots are not consistent snapshots in such a situation . So 
shouldn't we abandon creating snapshots and goto cleanup in the situation that 
qemuDomainSnapshotFSFreeze returns 0?


The code below:


static int
qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
   virQEMUDriverPtr driver,
   virDomainObjPtr vm,
   virDomainSnapshotObjPtr snap,
   unsigned int flags)
{
virObjectEventPtr event;
bool resume = false;
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
char *xml = NULL;
bool memory = snap->def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
bool memory_unlink = false;
bool atomic = !!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC);
bool transaction = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION);
int thaw = 0; /* 1 if freeze succeeded, -1 if freeze failed */
bool pmsuspended = false;
virQEMUDriverConfigPtr cfg = NULL;
int compressed;
char *compressedpath = NULL;

/* If quiesce was requested, then issue a freeze command, and a
 * counterpart thaw command when it is actually sent to agent.
 * The command will fail if the guest is paused or the guest agent
 * is not running, or is already quiesced.  */
if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) {
int freeze = qemuDomainSnapshotFSFreeze(driver, vm, NULL, 0);
if (freeze < 0) {
/* the helper reported the error */
if (freeze == -2)
thaw = -1; /* the command is sent but agent failed */
goto cleanup;
}
thaw = 1;
}

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

Re: [libvirt] [PATCH] remove the dead code this patch is to remove the dead code Signed-off-by: JieWang <wangji...@huawei.com>

2016-08-24 Thread WangJie (Captain)
Thank you! This is my first time to commit patch, I'll do better next time. :)

On 2016/8/22 20:46, Martin Kletzander wrote:
> On Mon, Aug 22, 2016 at 01:30:08PM +0100, Richard W.M. Jones wrote:
>> On Mon, Aug 22, 2016 at 08:17:37PM +0800, JieWang wrote:
>>> Signed-off-by: JieWang 
>>> ---
>>>  src/qemu/qemu_migration.c | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
>>> index 6a683f7..759e15a 100644
>>> --- a/src/qemu/qemu_migration.c
>>> +++ b/src/qemu/qemu_migration.c
>>> @@ -1602,7 +1602,6 @@ qemuMigrationPrecreateDisk(virConnectPtr conn,
>>> _("cannot precreate storage for disk type '%s'"),
>>> virStorageTypeToString(disk->src->type));
>>>  goto cleanup;
>>> -break;
>>>  }
>>>
>>>  if ((vol = virStorageVolLookupByName(pool, volName))) {
>>
>> ACK.
>>
>> As this seems completely trivial, I pushed it without waiting for a
>> second ACK, although I did compile-test it.
>>
> 
> You could've fixed the commit message in order for it not to be all in
> one line...  Well, maybe next time.
> 
>> Rich.
>>
>> -- 
>> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
>> Read my programming and virtualization blog: http://rwmj.wordpress.com
>> virt-p2v converts physical machines to virtual machines.  Boot with a
>> live CD or over the network (PXE) and turn machines into KVM guests.
>> http://libguestfs.org/virt-v2v
>>
>> -- 
>> libvir-list mailing list
>> libvir-list@redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list

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