[libvirt] [PATCH] vz: allow to boot VM from cdrom

Dmitry Guryanov dguryanov at virtuozzo.com
Tue Nov 24 14:20:31 UTC 2015


On Fri, 2015-11-20 at 16:00 +0300, Mikhail Feoktistov wrote:

Could you add some detail to commit message, because this change is not trivial?

> ---
>  src/vz/vz_sdk.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index 750133d..9bdf7aa9a 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -2023,8 +2023,9 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom,
> virDomainDefPtr def)
>      }
>  
>      if (!IS_CT(def)) {
> -        if (def->os.nBootDevs != 1 ||
> -            def->os.bootDevs[0] != VIR_DOMAIN_BOOT_DISK ||
> +        if (def->os.nBootDevs == 0 ||
> +            (def->os.bootDevs[0] != VIR_DOMAIN_BOOT_DISK &&
> +            def->os.bootDevs[0] != VIR_DOMAIN_BOOT_CDROM) ||
>              def->os.init != NULL || def->os.initargv != NULL) {
>  
>              virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> @@ -3179,11 +3180,12 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom,
>  
>      if (disk->src->type == VIR_STORAGE_TYPE_FILE) {
>          if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
> -            virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_PLOOP) {
> +            (virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_PLOOP &&
> +             virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_NONE)) {
>  

Why do you need this change?

>              virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid format of "
> -                                                         "disk %s, vz driver
> supports only "
> -                                                         "images in ploop
> format."), disk->src->path);
> +                                                         "disk %s, it should
> be either not set or "
> +                                                         "ploop format."),
> disk->src->path);
>              goto cleanup;
>          }
>  
> @@ -3205,11 +3207,13 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom,
>      pret = PrlVmDev_SetEmulatedType(sdkdisk, emutype);
>      prlsdkCheckRetGoto(pret, cleanup);
>  
> -    pret = PrlVmDev_SetSysName(sdkdisk, disk->src->path);
> -    prlsdkCheckRetGoto(pret, cleanup);
> +    if (disk->src->path != NULL) {
> +        pret = PrlVmDev_SetSysName(sdkdisk, disk->src->path);
> +        prlsdkCheckRetGoto(pret, cleanup);
>  
> -    pret = PrlVmDev_SetFriendlyName(sdkdisk, disk->src->path);
> -    prlsdkCheckRetGoto(pret, cleanup);
> +        pret = PrlVmDev_SetFriendlyName(sdkdisk, disk->src->path);
> +        prlsdkCheckRetGoto(pret, cleanup);
> +    }

Could you, please, also add some comment about this code. I I thought we can
only add disks with existing images. But here you allow to add disk without
source path, how will it work?

>  
>      drive = &disk->info.addr.drive;
>      if (drive->controller > 0) {
-- 
Dmitry Guryanov




More information about the libvir-list mailing list