-
Notifications
You must be signed in to change notification settings - Fork 7
PR for review purposes only vSphere advanced capabilities #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,5 +75,11 @@ | |
| <version>${cs.jaxws.version}</version> | ||
| <type>pom</type> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.cloud.com.vmware</groupId> | ||
| <artifactId>pbm</artifactId> | ||
| <version>${cs.vmware.api.version}</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
|
Comment on lines
+78
to
+83
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is called from both the hypervisor plugin and from the base lib. That does not seem like proper isolation. |
||
| </dependencies> | ||
| </project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package com.cloud.hypervisor.vmware.mo; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. license needed |
||
|
|
||
|
|
||
| import com.cloud.hypervisor.vmware.util.VmwareContext; | ||
|
|
||
| import com.vmware.pbm.PbmProfile; | ||
| import com.vmware.pbm.PbmProfileId; | ||
| import com.vmware.pbm.PbmProfileResourceType; | ||
| import com.vmware.pbm.PbmProfileResourceTypeEnum; | ||
| import com.vmware.vim25.ManagedObjectReference; | ||
|
|
||
| import org.apache.log4j.Logger; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class PbmProfileManagerMO extends BaseMO { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does this class provide me? can we have that in javadoc? |
||
|
|
||
| private static final Logger s_logger = Logger.getLogger(PbmProfileManagerMO.class); | ||
|
|
||
| public PbmProfileManagerMO (VmwareContext context) { | ||
| super(context, context.getPbmServiceContent().getProfileManager()); | ||
| } | ||
|
|
||
| public PbmProfileManagerMO (VmwareContext context, ManagedObjectReference morProfileMgr) { | ||
| super(context, morProfileMgr); | ||
| } | ||
|
|
||
| public PbmProfileManagerMO (VmwareContext context, String morType, String morValue) { | ||
| super(context, morType, morValue); | ||
| } | ||
|
|
||
| public List<PbmProfileId> getProfileIds() throws Exception { | ||
| if (s_logger.isDebugEnabled()) { | ||
| s_logger.debug("Querying vCenter " + _context.getServerAddress() + " for profiles"); | ||
| } | ||
| List<PbmProfileId> profileIds = _context.getPbmService().pbmQueryProfile(_mor, getStorageResourceType(), null); | ||
| return profileIds; | ||
| } | ||
|
|
||
| public List<PbmProfile> getProfiles(PbmProfileResourceType pbmResourceType) throws Exception { | ||
| List<PbmProfileId> profileIds = getProfileIds(); | ||
| List<PbmProfile> profiles = _context.getPbmService().pbmRetrieveContent(_mor, profileIds); | ||
| return profiles; | ||
| } | ||
|
|
||
| private PbmProfileResourceType getStorageResourceType() { | ||
| PbmProfileResourceType resourceType = new PbmProfileResourceType(); | ||
| resourceType.setResourceType(PbmProfileResourceTypeEnum.STORAGE.value()); | ||
| return resourceType; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| package com.cloud.hypervisor.vmware.mo; | ||
|
|
||
| import com.vmware.vim25.ID; | ||
| import com.vmware.vim25.VStorageObject; | ||
| import org.apache.log4j.Logger; | ||
|
|
||
| import com.vmware.vim25.ManagedObjectReference; | ||
|
|
||
| import com.cloud.hypervisor.vmware.util.VmwareContext; | ||
|
|
||
| public class VirtualStorageObjectManager extends BaseMO { | ||
| @SuppressWarnings("unused") | ||
| private static final Logger s_logger = Logger.getLogger(VirtualStorageObjectManager.class); | ||
|
|
||
| public VirtualStorageObjectManager(VmwareContext context) { | ||
| super(context, context.getServiceContent().getVStorageObjectManager()); | ||
| } | ||
|
|
||
| public VirtualStorageObjectManager(VmwareContext context, ManagedObjectReference morDiskMgr) { | ||
| super(context, morDiskMgr); | ||
| } | ||
|
|
||
| public VirtualStorageObjectManager(VmwareContext context, String morType, String morValue) { | ||
| super(context, morType, morValue); | ||
| } | ||
|
|
||
| public VStorageObject registerVirtualDisk(DatastoreFile datastoreFile, String name, String dcName) throws Exception { | ||
| StringBuilder sb = new StringBuilder(); | ||
| //https://10.2.2.254/folder/i-2-4-VM/89e3756d9b7444dc92388eb36ddd026b.vmdk?dcPath=datacenter-21&dsName=c84e4af9b6ac33e887a25d9242650091 | ||
| sb.append("https://").append(_context.getServerAddress()).append("/folder/"); | ||
| sb.append(datastoreFile.getRelativePath()); | ||
| sb.append("?dcPath="); | ||
| sb.append(dcName); | ||
| sb.append("&dsName="); | ||
| sb.append(datastoreFile.getDatastoreName()); | ||
| return _context.getService().registerDisk(_mor, sb.toString(), name); | ||
| } | ||
|
|
||
| public VStorageObject retrieveVirtualDisk (ID id, ManagedObjectReference morDS) throws Exception { | ||
| return _context.getService().retrieveVStorageObject(_mor, id, morDS); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really not in mvn central? I understood Vmware made all their libs redist??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess not, i now see the same for the old API. still seems off, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a link like in the one above?