mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
machined: add GetMachineSSHInfo method
Also adds three properties: - VsockCid: the VSOCK CID of the VM - SshAddress: the address of the VM in a format SSH can connect to - SshPrivateKeyPath: the path to the SSH private key to use to connect to the VM. GetMachineSSHInfo is essentially a convenience method to query both the SshAddress and SshPrivateKeyPath properties at once.
This commit is contained in:
committed by
Luca Boccassi
parent
885317f1ab
commit
1f815bf164
@@ -89,6 +89,9 @@ node /org/freedesktop/machine1 {
|
||||
in i signal);
|
||||
GetMachineAddresses(in s name,
|
||||
out a(iay) addresses);
|
||||
GetMachineSSHInfo(in s name,
|
||||
out s ssh_address,
|
||||
out s ssh_private_key_path);
|
||||
GetMachineOSRelease(in s name,
|
||||
out a{ss} fields);
|
||||
@org.freedesktop.systemd1.Privileged("true")
|
||||
@@ -230,6 +233,8 @@ node /org/freedesktop/machine1 {
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineAddresses()"/>
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineSSHInfo()"/>
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetMachineOSRelease()"/>
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="OpenMachinePTY()"/>
|
||||
@@ -378,6 +383,10 @@ node /org/freedesktop/machine1 {
|
||||
<constant>AF_INET6</constant>) and a byte array containing the addresses. This is only supported for
|
||||
containers that make use of network namespacing.</para>
|
||||
|
||||
<para><function>GetMachineSSHInfo()</function> retrieves the SSH information of a machine. This method
|
||||
returns two strings, the SSH address which can be used to tell SSH where to connect, and the path
|
||||
to the SSH private key required for the connection to succeed.</para>
|
||||
|
||||
<para><function>GetMachineOSRelease()</function> retrieves the OS release information of a
|
||||
container. This method returns an array of key value pairs read from the
|
||||
<citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> file in
|
||||
@@ -459,6 +468,8 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
Kill(in s who,
|
||||
in i signal);
|
||||
GetAddresses(out a(iay) addresses);
|
||||
GetSSHInfo(out s ssh_address,
|
||||
out s ssh_private_key_path);
|
||||
GetOSRelease(out a{ss} fields);
|
||||
GetUIDShift(out u shift);
|
||||
OpenPTY(out h pty,
|
||||
@@ -507,6 +518,12 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
readonly s RootDirectory = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly ai NetworkInterfaces = [...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly u VSockCID = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly s SSHAddress = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly s SSHPrivateKeyPath = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly s State = '...';
|
||||
};
|
||||
@@ -548,6 +565,8 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetAddresses()"/>
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetSSHInfo()"/>
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetOSRelease()"/>
|
||||
|
||||
<variablelist class="dbus-method" generated="True" extra-ref="GetUIDShift()"/>
|
||||
@@ -590,6 +609,12 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="NetworkInterfaces"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="VSockCID"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="SSHAddress"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="SSHPrivateKeyPath"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="State"/>
|
||||
|
||||
<!--End of Autogenerated section-->
|
||||
@@ -601,9 +626,9 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
take the same arguments as <function>TerminateMachine()</function> and
|
||||
<function>KillMachine()</function> on the Manager interface, respectively.</para>
|
||||
|
||||
<para><function>GetAddresses()</function> and <function>GetOSRelease()</function> get the IP address and OS
|
||||
release information from the machine. These methods take the same arguments as
|
||||
<function>GetMachineAddresses()</function> and <function>GetMachineOSRelease()</function> of the
|
||||
<para><function>GetAddresses()</function>, <function>GetSSHInfo()</function> and <function>GetOSRelease()</function> get the IP address,
|
||||
SSH connection and OS release information from the machine. These methods take the same arguments as
|
||||
<function>GetMachineAddresses()</function>, <function>GetMachineSSHInfo()</function> and <function>GetMachineOSRelease()</function> of the
|
||||
Manager interface, respectively.</para>
|
||||
</refsect2>
|
||||
|
||||
@@ -636,6 +661,15 @@ node /org/freedesktop/machine1/machine/rawhide {
|
||||
towards the container, the VM or the host. For details about this information see the description of
|
||||
<function>CreateMachineWithNetwork()</function> above.</para>
|
||||
|
||||
<para><varname>VSockCID</varname> is the VSOCK CID of the VM if it is known, or
|
||||
<constant>VMADDR_CID_ANY</constant> otherwise.</para>
|
||||
|
||||
<para><varname>SSHAddress</varname> is the address of the VM in a format <command>ssh</command> can understand
|
||||
if it is known or the empty string.</para>
|
||||
|
||||
<para><varname>SSHPrivateKeyPath</varname> is the path to the SSH private key of the VM if it is known
|
||||
or the empty string.</para>
|
||||
|
||||
<para><varname>State</varname> is the state of the machine and is one of <literal>opening</literal>,
|
||||
<literal>running</literal>, or <literal>closing</literal>. Note that the state machine is not considered
|
||||
part of the API and states might be removed or added without this being considered API breakage.
|
||||
@@ -675,11 +709,14 @@ $ gdbus introspect --system \
|
||||
<title>The Manager Object</title>
|
||||
<para><function>CopyFromMachineWithFlags()</function> and
|
||||
<function>CopyToMachineWithFlags()</function> were added in version 252.</para>
|
||||
<para><function>GetMachineSSHInfo()</function> was added in version 256.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Machine Objects</title>
|
||||
<para><function>CopyFromWithFlags()</function> and
|
||||
<function>CopyToWithFlags()</function> were added in version 252.</para>
|
||||
<para><function>GetSSHInfo()</function>, <varname>VSockCID</varname>, <varname>SSHAddress</varname>
|
||||
and <varname>SSHPrivateKeyPath</varname> were added in version 256.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
Reference in New Issue
Block a user