示例#1
0
        /// <summary>
        /// Renames the template.
        /// </summary>
        /// <returns><c>true</c>, if template was renamed, <c>false</c> otherwise.</returns>
        /// <param name="id">Identifier.</param>
        /// <param name="newName">New name.</param>
        public bool TemplateRename(int id, string newName)
        {
            bool result = false;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateRename(this.SessionSHA, id, newName);

            result = (bool)openNebulaReturnArr.GetValue(0);
            return(result);
        }
示例#2
0
        /// <summary>
        /// Clones the template.
        /// </summary>
        /// <returns><c>true</c>, if template was cloned, <c>false</c> otherwise.</returns>
        /// <param name="id">Identifier of the template to clone.</param>
        /// <param name="name">Name of the new template.</param>
        public int TemplateClone(int id, string name)
        {
            int result = 0;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateClone(this.SessionSHA, id, name);

            result = (int)openNebulaReturnArr.GetValue(1);
            return(result);
        }
示例#3
0
        /// <summary>
        /// Allocates the template.
        /// </summary>
        /// <returns>The template ID.</returns>
        /// <param name="content">Content.</param>
        public int TemplateAllocate(string content)
        {
            int result = 0;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateAllocate(this.SessionSHA, content);

            result = (int)openNebulaReturnArr.GetValue(1);
            return(result);
        }
示例#4
0
        /// <summary>
        /// Gets the template list info.
        /// </summary>
        /// <returns>The template list info.</returns>
        /// <param name="templateFilterFlag">Template filter flag.</param>
        /// <param name="rangeStartId">Range start identifier.</param>
        /// <param name="rangeEndId">Range end identifier.</param>
        public VMTEMPLATE_POOL TemplateGetPoolInfo(int templateFilterFlag, int rangeStartId, int rangeEndId)
        {
            VMTEMPLATE_POOL          result = null;
            XmlRpcTemplateManagement xrum   = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr       = xrum.oneTemplatePoolInfo(this.SessionSHA, templateFilterFlag, rangeStartId, rangeEndId);

            result = (VMTEMPLATE_POOL)Deserialize(typeof(VMTEMPLATE_POOL), openNebulaReturnArr.GetValue(1).ToString());
            return(result);
        }
示例#5
0
        /// <summary>
        /// Gets the template info.
        /// </summary>
        /// <returns><c>true</c>, if template info was gotten, <c>false</c> otherwise.</returns>
        /// <param name="id">Identifier.</param>
        public VMTEMPLATE TemplateGetInfo(int id)
        {
            VMTEMPLATE result             = null;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateInfo(this.SessionSHA, id);

            result = (VMTEMPLATE)Deserialize(typeof(VMTEMPLATE), openNebulaReturnArr.GetValue(1).ToString());
            return(result);
        }
示例#6
0
        /// <summary>
        /// Changes the template owner.
        /// </summary>
        /// <returns><c>true</c>, if template owner was changed, <c>false</c> otherwise.</returns>
        /// <param name="id">Identifier.</param>
        /// <param name="usrId">Usr identifier.</param>
        /// <param name="grpId">Group identifier.</param>
        public bool TemplateChangeOwner(int id, int usrId, int grpId)
        {
            bool result = false;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateChangeOwner(this.SessionSHA, id, usrId, grpId);

            result = (bool)openNebulaReturnArr.GetValue(0);
            return(result);
        }
示例#7
0
        /// <summary>
        /// Change permissions of the template
        /// </summary>
        /// <returns><c>true</c>, if chmod was templated, <c>false</c> otherwise.</returns>
        /// <param name="id">Identifier.</param>
        /// <param name="userUse">User use.</param>
        /// <param name="userManage">User manage.</param>
        /// <param name="userAdmin">User admin.</param>
        /// <param name="groupUse">Group use.</param>
        /// <param name="groupManage">Group manage.</param>
        /// <param name="groupAdmin">Group admin.</param>
        /// <param name="otherUse">Other use.</param>
        /// <param name="otherManage">Other manage.</param>
        /// <param name="otherAdmin">Other admin.</param>
        public bool TemplateChmod(int id, int userUse, int userManage, int userAdmin, int groupUse, int groupManage, int groupAdmin, int otherUse, int otherManage, int otherAdmin)
        {
            bool result = false;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateChangeMod(this.SessionSHA, id, userUse, userManage, userAdmin, groupUse, groupManage, groupAdmin, otherUse, otherManage, otherAdmin);

            result = (bool)openNebulaReturnArr.GetValue(0);
            return(result);
        }
示例#8
0
        /// <summary>
        /// Instanciates a VM from the template
        /// </summary>
        /// <returns>ID of the instanciated VM.</returns>
        /// <param name="id">Identifier.</param>
        /// <param name="vmName">Vm name.</param>
        /// <param name="onHold">If set to <c>true</c> VM is created on hold else pending.</param>
        /// <param name="extraTemplateAttributes">Extra template attributes.</param>
        public int TemplateInstanciateVM(int id, string vmName, bool onHold, string extraTemplateAttributes)
        {
            int result = 0;
            XmlRpcTemplateManagement xrum = (XmlRpcTemplateManagement)GetProxy(typeof(XmlRpcTemplateManagement));
            Array openNebulaReturnArr     = xrum.oneTemplateInstantiate(this.SessionSHA, id, vmName, onHold, extraTemplateAttributes);

            if ((bool)openNebulaReturnArr.GetValue(0) == false)
            {
                throw new Exception((string)openNebulaReturnArr.GetValue(1));
            }
            result = (int)openNebulaReturnArr.GetValue(1);
            return(result);
        }