[ https://issues.apache.org/jira/browse/CLOUDSTACK-10197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315163#comment-16315163 ]
ASF GitHub Bot commented on CLOUDSTACK-10197: --------------------------------------------- rhtyd closed pull request #2365: CLOUDSTACK-10197: Rename xentools iso for XenServer 7.0+ URL: https://github.com/apache/cloudstack/pull/2365 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java index 83a9c23617f..d23f7a86c35 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java @@ -536,7 +536,7 @@ private void createXsToolsISO() { id = _tmpltDao.getNextInSequence(Long.class, "id"); VMTemplateVO template = VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM, - null, "xen-pv-drv-iso", false, 1, false, HypervisorType.XenServer); + null, "XenServer Tools Installer ISO (xen-pv-drv-iso)", false, 1, false, HypervisorType.XenServer); _tmpltDao.persist(template); } else { id = tmplt.getId(); diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index f960b9f09b9..97d6118d335 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -2592,9 +2592,10 @@ public VDI getIsoVDIByURL(final Connection conn, final String vmName, final Stri String mountpoint = null; if (isoURL.startsWith("xs-tools")) { try { - final Set<VDI> vdis = VDI.getByNameLabel(conn, isoURL); + final String actualIsoURL = actualIsoTemplate(conn); + final Set<VDI> vdis = VDI.getByNameLabel(conn, actualIsoURL); if (vdis.isEmpty()) { - throw new CloudRuntimeException("Could not find ISO with URL: " + isoURL); + throw new CloudRuntimeException("Could not find ISO with URL: " + actualIsoURL); } return vdis.iterator().next(); @@ -2630,6 +2631,22 @@ public VDI getIsoVDIByURL(final Connection conn, final String vmName, final Stri } } + private String actualIsoTemplate(final Connection conn) throws BadServerResponse, XenAPIException, XmlRpcException { + final Host host = Host.getByUuid(conn, _host.getUuid()); + final Host.Record record = host.getRecord(conn); + final String xenBrand = record.softwareVersion.get("product_brand"); + final String xenVersion = record.softwareVersion.get("product_version"); + final String[] items = xenVersion.split("\\."); + + // guest-tools.iso for XenServer version 7.0+ + if (xenBrand.equals("XenServer") && Integer.parseInt(items[0]) >= 7) { + return "guest-tools.iso"; + } + + // xs-tools.iso for older XenServer versions + return "xs-tools.iso"; + } + public String getLabel() { final Connection conn = getConnection(); final String result = callHostPlugin(conn, "ovstunnel", "getLabel"); @@ -3882,9 +3899,10 @@ protected VDI mount(final Connection conn, final String vmName, final DiskTO vol final String templateName = iso.getName(); if (templateName.startsWith("xs-tools")) { try { - final Set<VDI> vdis = VDI.getByNameLabel(conn, templateName); + final String actualTemplateName = actualIsoTemplate(conn); + final Set<VDI> vdis = VDI.getByNameLabel(conn, actualTemplateName); if (vdis.isEmpty()) { - throw new CloudRuntimeException("Could not find ISO with URL: " + templateName); + throw new CloudRuntimeException("Could not find ISO with URL: " + actualTemplateName); } return vdis.iterator().next(); } catch (final XenAPIException e) { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > XenServer 7.1: Cannot mount xentool iso from cloudstack on VMs > --------------------------------------------------------------- > > Key: CLOUDSTACK-10197 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10197 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Affects Versions: 4.10.0.0 > Environment: XenServer 7.0+ > Reporter: Khosrow Moossavi > Fix For: Future > > > In XenServer 7.0+ xentools iso has been renamed from *xs-tools* to > *guest-tools* so CloudStack fails to attach it to any VM. > {code} > (acs-admin) > attach iso > virtualmachineid=d13eeff1-2d99-46a9-8fc5-3510df6e9f5e > id=e8a56540-0fc3-44de-9911-635d2d8f25c4 > errorcode = 530 > errortext = Failed to attach iso > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)