Re: [PATCH v4 10/13] parallels: add function parallelsGetDiskBusName

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 04, 2012 at 05:43:10PM +0400, Dmitry Guryanov wrote:
> Add function for convertion bus from libvirt's numeric constant
> to a name, used in a parallels command-line tools.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov@xxxxxxxxxxxxx>
> ---
>  src/parallels/parallels_driver.c |   28 ++++++++++++++++++----------
>  1 files changed, 18 insertions(+), 10 deletions(-)
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index fe91968..967f545 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -76,6 +76,19 @@
>  
>  static int parallelsClose(virConnectPtr conn);
>  
> +const char * parallelsGetDiskBusName(int bus) {
> +    switch (bus) {
> +    case VIR_DOMAIN_DISK_BUS_IDE:
> +        return "ide";
> +    case VIR_DOMAIN_DISK_BUS_SATA:
> +        return "sata";
> +    case VIR_DOMAIN_DISK_BUS_SCSI:
> +        return "scsi";
> +    default:
> +        return NULL;
> +    }
> +}
> +
>  void
>  parallelsDriverLock(parallelsConnPtr driver)
>  {
> @@ -1529,17 +1542,12 @@ parallelsApplyDisksParams(parallelsDomObjPtr pdom,
>              strpos[15] = '\0';
>              snprintf(strpos, 15, "%d", newdisk->info.addr.drive.target);
>  
> -            switch (newdisk->bus) {
> -            case VIR_DOMAIN_DISK_BUS_IDE:
> -                strbus = "ide";
> -                break;
> -            case VIR_DOMAIN_DISK_BUS_SATA:
> -                strbus = "sata";
> -                break;
> -            case VIR_DOMAIN_DISK_BUS_SCSI:
> -                strbus = "scsi";
> -                break;
> +            if (!(strbus = parallelsGetDiskBusName(newdisk->bus))) {
> +                virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
> +                               _("Unsupported disk bus: %d", newdisk->bus));
> +                return -1;
>              }
> +
>              if (parallelsCmdRun(PRLCTL, "set", pdom->uuid,
>                                  "--device-set", prlname,
>                                  "--iface", strbus,

  yeah, but the function must be labelled static if it is not exported
  so adding:


diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index bbbc9d5..8274c88 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -76,7 +76,7 @@
 
 static int parallelsClose(virConnectPtr conn);
 
-const char * parallelsGetDiskBusName(int bus) {
+static const char * parallelsGetDiskBusName(int bus) {
     switch (bus) {
     case VIR_DOMAIN_DISK_BUS_IDE:
         return "ide";

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard@xxxxxxxxxx  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]