On 03/25/2013 03:32 PM, [email protected] wrote:
> From: whuang <[email protected]>
>
> Signed-off-by: whuang <[email protected]>
> ---
>  virttest/virsh.py | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/virttest/virsh.py b/virttest/virsh.py
> index f847d92..ce0a5ca 100644
> --- a/virttest/virsh.py
> +++ b/virttest/virsh.py
> @@ -1557,3 +1557,38 @@ def cpu_stats(name, options, **dargs):
>          cmd += " %s" % options
>  
>      return command(cmd, **dargs)
> +
> +def change_media(name, device, source, options, **dargs):
> +    """
> +    Change media of CD or floppy drive.
> +
> +    @param: name: VM's name.
> +    @param: path: Fully-qualified path or target of disk device
> +    @param: source: source of the media
> +    @param: options: command change_media options.
> +    @param: dargs: standardized virsh function API keywords
> +    @return: CmdResult instance
> +    """
> +    cmd = "change-media %s %s %s" % (name, device, source) 
> +    if options: 
> +        cmd += " %s " % options
> +    return command(cmd, **dargs)
> +
> +def attach_disk(name, option="", **dargs):
> +    """
> +    Attach a Disk to VM.
> +
> +    @param: name: name of guest
> +    @param: option: options to pass to command
> +    @param: dargs: standardized virsh function API keywords
> +    @return: CmdResult object
> +    """
> +    cmd = "attach-disk "
> +
> +    if name:
> +        cmd += "--domain %s" % name
> +    if option:
> +        cmd += " %s" % option
> +
> +    return command(cmd, **dargs)
> +

I have committed Li's attach-detach disk functions.You can try to use them.
And feel free to fix them if you need.

Yu
Thanks

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to