<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="PT-BR" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi everyone,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I wrote some code to run a VM on a IBM POWER host, but I stumbled in some issues that will need a little bit of refactoring in the current code and I would like some feedback.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The first issue is that KVM on POWER requires a special SCSI interface (called SPAPR), which is not available in x86-64. Currently I’m solving this problem by using (in the VmInfoBuilder class):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">if (vm.getArchitecture().equals(ArchitectureType.ppc64)) {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Map<String, Object> struct = new HashMap<String, Object>();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> struct.put(VdsProperties.Type, VmDeviceType.CONTROLLER.getName());<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> struct.put(VdsProperties.Device, VdsProperties.Scsi);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Create a controller in the index 1, the VirtIO_SCSI interface is in index 0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> struct.put(VdsProperties.Index, "1");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Map<String, String> spaprAddress = new HashMap<String, String>();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> spaprAddress.put("type", "spapr-vio");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> struct.put(VdsProperties.Address, spaprAddress);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> devices.add(struct);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">But this is a poor solution, because this class would be polluted by architectural differences. Another thing to notice is that since in IBM POWER there are two SCSI controllers, all the SCSI devices must have their SCSI
address explicitly defined (it was not needed before, since there was just one controller before). It was proposed that a “strategy” class could solve the problem, but I would like to have some feedback on which package it should be, since it will also be
used in the bll package to validate other stuff.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The second issue is that the CD-ROM interface is SCSI on POWER guests (and must be attached to the SPAPR interface) and IDE on the x86_64, this information could be retrieved from the osinfo (by creating a property there)
or It could be hard-coded in the strategy class.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Which would be the best way to handle this difference?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The third and final issue is that when the VNC protocol is used in a VM, by default a Cirrus Logic VGA device is created. This device is not supported on POWER guests, but the standard VGA device is. I made a workaround,
but the issue is where to put this association between the device type and the display protocol.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Should it also be a property in the osinfo? Or it should be handled in the strategy class?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>