Quantcast
Channel: VMware Communities : Discussion List - VMware {code}
Viewing all 2738 articles
Browse latest View live

How to find datastore of a VM from VM Name - VMWare.Vim.dll - C#

$
0
0

Hi,

Is there anyone that can tell me how to find vm details from the VM Name in C# ?

I tried using VMWare.Vim.dll but could not link existing datastore properties to an existing VM.

For VM, i could link the host of the VM with the following code but no more :

System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; };

VimClient vimClient = new VimClientImpl();

ServiceContent vimServiceContent = new ServiceContent();

string sViServer = "<VcenterIpAddress>";

string sUsername = "<VcenterAdminLogin>";

string sPassword = "<VcenterAdminPasswd>";

vimClient.Connect("https://" + sViServer + "/sdk");

vimClient.Login(sUsername, sPassword);

 

vimServiceContent = vimClient.ServiceContent;

NameValueCollection filter = new NameValueCollection();

IList<VMware.Vim.EntityViewBase> vmList = vimClient.FindEntityViews(typeof(VirtualMachine), null, filter, null);

foreach (VirtualMachine vm in vmList)

{

Console.WriteLine(vm.Name);

VMware.Vim.CustomFieldValue[]  VmValues = vm.Value;

foreach (VMware.Vim.CustomFieldValue VmValue in VmValues)

{

Console.WriteLine(VmValue.Key.ToString());

}

HostSystem host = (HostSystem)vimClient.GetView(vm.Runtime.Host, null);

Console.WriteLine(host.Name);

ManagedObjectReference[] DsList = vm.Datastore;

foreach (ManagedObjectReference Ds in DsList)

{

Console.WriteLine(Ds.Type);

Console.WriteLine(Ds.Value);

}

 

}

For Datastore, i have the following code but no link between the two parts of code :

IList<VMware.Vim.EntityViewBase> DatastoreList = vimClient.FindEntityViews(typeof(Datastore), null, filter, null);

foreach (Datastore Datastore in DatastoreList)

{

Console.WriteLine(Datastore.Name);

Console.WriteLine(Datastore.Value);

ManagedObjectReference[] Vms = Datastore.Vm;

foreach (ManagedObjectReference Vm in Vms)

{

Console.WriteLine(Vm.Type);

Console.WriteLine(Vm.Value);

}

DatastoreHostMount[] Hosts = Datastore.Host;

foreach (DatastoreHostMount host in Hosts)

{

Console.WriteLine(host.Key);

}

}

If no solution i'll use a powercli script, but i would like to have all in c#.

Could you help me plz ?

Fred

System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; };
VimClient vimClient = new VimClientImpl();
ServiceContent vimServiceContent = new ServiceContent();
string sViServer = "192.168.15.12";
string sUsername = "administrator@vsphere.local";
string sPassword = "Fr4eder2.";
vimClient.Connect("https://" + sViServer + "/sdk");
vimClient.Login(sUsername, sPassword);
 
vimServiceContent = vimClient.ServiceContent;
NameValueCollection filter = new NameValueCollection();
IList<VMware.Vim.EntityViewBase> vmList = vimClient.FindEntityViews(typeof(VirtualMachine), null, filter, null);
foreach (VirtualMachine vm in vmList)
{
Console.WriteLine(vm.Name);
VMware.Vim.CustomFieldValue[]  VmValues = vm.Value;
foreach (VMware.Vim.CustomFieldValue VmValue in VmValues)
{
Console.WriteLine(VmValue.Key.ToString());
}
HostSystem host = (HostSystem)vimClient.GetView(vm.Runtime.Host, null);
Console.WriteLine(host.Name);
ManagedObjectReference[] DsList = vm.Datastore;
foreach (ManagedObjectReference Ds in DsList)
{
Console.WriteLine(Ds.Type);
Console.WriteLine(Ds.Value);
}
 
}

PowerCLI Install on Windows 2012r2 always installs 11.0.0.10380590

$
0
0

No matter which install-module technique I choose, I always end up with version 11.0.0.10380590 when I use Get-PowerCLIVersion

 

I am using the commands detailed here,

PowerShell Gallery | VMware.PowerCLI 11.1.0.11289667

 

Why does this installer not honor what I tell it to and I then end up with 11.0.0.10380590?

One-click Poll: What type of plugin are you building?

Pull (or set?) UUID via REST API?

$
0
0

Is it possible to query the UUID of a VM via the REST API? 

I assume that it's a value in the BIOS, but I don't see an interface to query that. If there isn't a way, is it in the pipeline? 

Need Redistribution Information for vSphere GuestSDK 6.7

Secure a plugin's REST API and UI

$
0
0

I have come across an issue with our plugin's REST API endpoints and UI being accessible from outside of the VSPhere environment and am thinking there must be a way to secure them with perhaps some kind of web.xml or other configuration change since this must be a fairly common concern for all plugins.

To get more specific, our plugin deploys the server side jar file and presents various rest apis, for example https://myserver/my-war-name/rest/getStuff .  I can hit the getStuff endpoint outside of the vsphere environment from a browser window, both one that is logged into the vsphere sever/client and from another browser that isn't.  To clarify a bit more, from the SDK samples, it would be the ability to hit the /list endpoint in the ChassisController.java file.  I don't see any mechanism in the samples that  is securing those endpoints.

So the question is if there is a VSphere pattern/mechanism for better securing these REST endpoints (and access to other parts of our plugin such as the angular/clarity UI portions)?

deploy_ovf.py throws print "Cannot POST to non-disk filesCannot POST to non-disk files" when launched

$
0
0

Hi,

 

I am trying to deploy a vm using deploy_ovf.py and this script throws the following print on the console. The vm is created and launched successfully, however i am not sure if the print is a error/warning or something that should be worried about. Also i have kept other logs in the script, but looks like the print comes as and when _main is triggered. Any input here would be of great help.

 

The script is similar to the one in the following link, with slight modifications to add extra parameters.

 

https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/deploy_ovf.py 

Scanning all the A, B, C, Class Ip Adresses for the available VMware ESXi host in my office network around the globe.

$
0
0

Hi All,

 

I have been assinged with a task to get scan all the A, B, C, Class Ip Ranges and get the details of ESXi hosts IP Address, Hostname, CPU, License Number, Product: -

vSphere 6 Standard / vSphere 5 Hypervisor,  License Key, vCenter Server name etc., and create a excel file and share the information with the team.   This is like doing asset inventory in Excel file.

 

Do you guys know any tool or any scrip so that I can run it and get all the above information.  ???

 

Please help me,  thank in Advance.


Need help in Plugin Extension Version specification

$
0
0

Hi Team,

 

we want to adopt a new specification for version numbering of our plugin. We want to specify the version numbering as "A.B.C.D.E" for example “9.6.0.0000.1”, “9.6.1.0100.1”, “9.6.1.0101.1”, “9.6.1.0001.1”. where E=build version, then how does this version work for:

  1. Fresh plugin extension registration
  2. Upgrade plugin extension from previous release version TO next release version
  3. Upgrade plugin extension from nightly/dev build TO nightly/dev build
  4. Criteria of version string for plugin extension upgrade?

 

When I refer the exisitng vSphere plugin, I'm seeing two version numbers in the mob.

vsan_mob_info.png

When I see the VC packages, it seems the virgo server is taking the Version#1 as the criteria to download the plugin package to vCenter server.

vc_packages.JPG

 

 

1. In my obsevation, I 'm assuming that vSphere mob will blindly fetch the version for mob and downloads the same to "vc-packages" if the same version is not found in the directory.

vSphere doesn't do any comparision like 6.6.1.20000>6.6.1.19998. Please confirm on this?

2. What is the significance of Version#1 and Version#2? Which one is used for what?

 

Thanks,

Kumar T.

 

Add a network to a template with no network

$
0
0

Hello

 

We need to add two networks to vapps who are created from a template that has no network configured.

 

In the documentation i can see how to modify networks that exists in the template, and it is what we are doing in this stage of the project. But we need to start with a template with no network.

 

When i try to add the network i receive an error about the NIC not recognized (i have tried with everyone). Of course, the template has no network so, don't have any NIC in the hardware section.

 

Thank you very much

vSphere HTML Client - editing custom alarm seems to break the definition

$
0
0

Hi,

our QA found a new problem which deals in the changing of the plug-ins custom alarms.

 

During the plug-in installation we define a number of custom events and alarms.  The alarms are not activated.  When the customer decides to edit one of these alarms, an error occurs.

It can be reproduced as follows:

1) Have a custom alarm defined (during installation)

2) In the HTML Client (6.7) - select a vcenter in the navigation tree.  Navigate to Configure-> Alarm definitions

3) Select the custom alarm , and click on Edit..  Continue through the wizard - nothing needs to be changed to reproduce this.

4) Save the definition.

 

The following error occurs:

Cannot construct instance of "com.vmware.vise.util.serialization.mixin.TypeNameImplMixin$TypeNameImplBuilder",

problem: null

at [Source: (String) " {

"_type": "com.vmware.vim.binding.vim.alarm.AlarmInfo",

"name": "Acme Test Alarm",

"key": "",

"description" : "this is a test alarm",

"entity" : {

"type" : "Folder",

"value" : "group-d1",

"serverGuid": "aa98acd4-8b59-489b-a5c4-b335690a303a",

"_type" : "com.vmware.vim.binding.vmodl.ManagedObjectReference"

},

"enabled" : true,

"expression" : {

"_type" : "com.vmware.vim.binding.vim.alarm.OrAlarmEx.......

}

 

So it seems that that the "key" value of the alarm gets lost somewhere - this is similar to the problems we encountered when editing custom roles (earlier discussion).

Could this be confirmed?

 

Cathy

How to get Snapshot space using vi java api??

$
0
0

Hi,

 

I am in trouble to get the Vm snapshot space regarding to the specific cluster. I didn't find any property or method in the vi java api. So please tell me how to get snapshot space??? or refer me any sample code related to the VM snapshot Space.

 

Thanks in advance.

Sending alerts via Sendgrid

$
0
0

We have just migrated our environment to Office 365 and now use a Sendgrid account to send emails.

I need to reconfigure my mail settings in VSphere 6.5 but can not find the part to enter our sendgrid login and password.

 

Has anyone done this before?

 

Thanks

Provisioning virtual NVDIMM with Perl SDK

$
0
0

Hi everyone!

I am trying to provision a virtual NVDIMM device using the Perl SDK. Specifically how the default storage policy for the PMEM datastore backing the device is determined / used.

I actually have been able to provision the virtual NVDIMM using a storage policy ID I  have determined with a REST call against the vSphere RESTful API service. But that requires a vCenter server and I was hoping to run this script against standalone hosts as well.

I was hoping some folks here might have some examples of provisioning a virtual NVDIMM device using the Perl SDK

Thanks!

Hiding the left panel in the HTML5 plugin

$
0
0

Hi,

 

 

We are developing a new HTML5 based plugin. We would like to know how to remove the left panel that is created by default for the HTML5 based plugins.

 

Our plugins shortcut is placed in the shortcuts as well as in the menu. Once we launch the plugin using the menu or shortcut we are looking to launch the plugin in the full page (without left panel).

The left panel that we get by default is not useful for us because we have only one item in that panel.  Having only one item in the left panel looks odd. Removing it completely would be useful for us and the plugin page would look much better.

 

Since our plugin is sitting inside the center-panel as an iframe. We don’t have much control over the left-panel which is outside the iframe.

 

 

We started building the plugin from the seed plugin version:1.0.0 Clarity version:1.0

 

Attaching the image for reference.

 

If removing is not possible to remove then at least we would like to host our plugin in some other page( with some changes in plugin.xml) like “default object navigator of VMware”? So we don’t get to host a left pane which has only one item.

 

 

Thanks,


VixMntapi Support for GPT partitions.

$
0
0

Hi,

I am trying to get the transport mode(SAN, HOTADD, NDB, etc) for each disk in the VM. Before I do so, I need to check if I can eliminate any of the transport modes before opening the disk. I was able to crack the logic to confirm that the mode for HOTADD by checking if it is a Virtual Machine and by checking if the disk is SCSI, but I am not able to crack the same for SAN. So I figured if I can get if the datastore is ISCSI/physical datastore, I can find a way to confirm that the mode is SAN mode.
I need to know if there is a way that we can find out the datastore is ISCSI(Physical Datastore).
I have searched all over but couldn't find a trace.

Any help will be much appreciated.

Thanks,
Manish Shenoy B

How to Filter Property Constraint in HTML5 Plugin Implementation

$
0
0

Hi Folks,

 

I am trying to filter extension by Property Value using the "com.vmware.data.query.PropertyConstraint" <nestedConstraint> tag in "plugin.xml",

 

where a PropertyProviderAdapter is being implemented which returns the Property Value as boolean and matches the Property Name as String,

 

based on that the extension needs to be rendered, but in HTML5 these doesn't seem to work, please suggest any plausible ways to implement the

 

extension filter in HTML5 plugin.

 

Here is an sample example.

 

<extension id="com.vmware.samples.actions.vmActionSet">

           <extendedPoint>vise.actions.sets</extendedPoint>

                <object>

                     <actions>

                          <com.vmware.actionsfw.ActionSpec>

                               <uid>com.vmware.samples.actions.myVmAction1</uid>

                               <label>#{action1.label}</label>

                               <command className="com.vmware.samples.actions.VmActionCommand"/>

                          </com.vmware.actionsfw.ActionSpec>

                     </actions>

                </object>

           <metadata>

                     <objectType>Datastore</objectType>

                          <propertyConditions>

                               <com.vmware.data.query.CompositeConstraint>

                               <nestedConstraints>

                             

                                  <com.vmware.data.query.PropertyConstraint>

                                         <propertyName>summary.type</propertyName>

                                         <comparator>EQUALS</comparator>

                                 <comparableValue>

                                         <String>VMFS</String>

                                   </comparableValue>

                               </com.vmware.data.query.PropertyConstraint>

 

                               <com.vmware.data.query.PropertyConstraint>

                                    <propertyName>sampleDatastore</propertyName>

                                               <comparator>EQUALS</comparator>

                                         <comparableValue>

                                              <String>true</String>

                                         </comparableValue>

                               </com.vmware.data.query.PropertyConstraint>

 

                     </nestedConstraints>

                <conjoiner>AND</conjoiner>

           </com.vmware.data.query.CompositeConstraint>

      </propertyConditions>

   </metadata>

</extension>

 

Here sampleDatastore Returning true but filter is not working. Please provide some guidance.

 

Thanks in advance :-)

 

 

 

anonymous login not available

$
0
0

I noticed when I try to login from a 64 bit Windows 10 pc , that there is no option for "anonymous login", on my VMware Horizon client for Windows. Please let me know what I am missing from my configuration.

 

I also noticed when I tried to login remotely I get another error on my Horizon 7 client:

"Incorrect Authentication Type Requested"

 

What am I missing from my configuration ?

 

Thanks

 

Ed

Create a list of objects on left side in plugin main page.

$
0
0

Hi,

I am working on creating a plugin and as per our requirement we need to add a list to the left side view and this list should have list of our custom objects.

I tried using the vsphere.core.inventorylist.objectCollectionTemplate and vsphere.core.inventory.objectViewTemplate extensions. Using these i am able to see a link on the left side but on click it is navigating to entire new page and in the new page i am seeing the full page list on left side.

PFA for my plugin main page where i have two links for different views. Below these links i need to also have a list. Is this possible.

I am using html-client-sdk-6.5.0.10000-6311399, local server: vSphere Client version 6.5.0.10000, and vSphere Client Fling version 3.15.0.5702473.

Restricting Flex w/ HTML Bridge content to Flex Server

$
0
0

Hi,

I was looking into how we might restrict our Flex plugin (with HTML bridge content) to deploy only to the Flex server instance.  Removing the type="HTML" also seems to disable the bridge content.  I could find any documentation or forum post on this.

We would like to restrict a separte Flex/HTML plugin to the 6.0 and 6.5 Flex server instance while allowing a HTML only plugin to deploy to the HTML server instance.  Our Java and HTML content are currently shared between the two, but we where hoping to accomplish this separation of plugins such that we could "deprecate" our Flex plugin and move the Java/HTML beyond the Flex server.

We have stopped development on the Flex client side, but need to provide both instances until our HTML plugin has feature parity.

Any help would appreciated.

-Bryant Martin

Viewing all 2738 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>