Showing posts with label Metaverse. Show all posts
Showing posts with label Metaverse. Show all posts

Tuesday, 4 July 2023

Using the metadata service to identify disks in your VSI with IBM Cloud VPC

IBM Cloud VPC, IBM Certification, IBM Guides, IBM Learning, IBM Tutorial and Materials, IBM Career, IBM Jobs, IBM Prep, IBM Preparation

A common use case in the cloud is attaching/removing volumes dynamically. Identifying the attached disk device in the operating system of the VSI is not always obvious.

In IBM Cloud Virtual Server for VPC, the disk that is attached to the VSI is identified by the volume attachment identifier. Every volume has a UUID, but the attachment between the volume and the VSI also has a UUID. The UUID of that volume attachment is what can be used to identify the backing disk in the VSI.

UI-based example


Listing the volume attachment identifiers is simple with the ibmcloud CLI:

Drews-MBP ~ % ibmcloud is in-vols 0727_fa4230b2-e167-4a09-8d7c-2822bdb016bf
Listing volume attachments of instance 0727_fa4230b2-e167-4a09-8d7c-2822bdb016bf under account Drew Thorstensen's Account as user thorst@us.ibm.com...
ID                                          Name                          Volume                             Status     Type   Device                                            Auto delete   
0727-7db66159-5910-4ddc-a5b4-51f9333a9c3a   secrecy-robust-anyone-agile   test-metadata-volume               attached   data   0727-7db66159-5910-4ddc-a5b4-51f9333a9c3a-4xjjc   false   
0727-4b98cbf2-4e57-4b3b-9bd2-83f2439da3bc   breath-manger-bird-axiom      test-metadata-boot-1649335137000   attached   boot   0727-4b98cbf2-4e57-4b3b-9bd2-83f2439da3bc-5jx6t   true     

This shows two volumes attached to the VSI: the boot and then a data volume. If we log in to the VSI, we can see the volume disks:

[root@test-metadata ~]# ls -la /dev/disk/by-id
total 0
drwxr-xr-x. 2 root root 200 Apr  7 12:58 .
drwxr-xr-x. 7 root root 140 Apr  7 12:51 ..
lrwxrwxrwx. 1 root root   9 Apr  7 12:52 virtio-0727-4b98cbf2-4e57-4 -> ../../vda
lrwxrwxrwx. 1 root root  10 Apr  7 12:52 virtio-0727-4b98cbf2-4e57-4-part1 -> ../../vda1
lrwxrwxrwx. 1 root root  10 Apr  7 12:52 virtio-0727-4b98cbf2-4e57-4-part2 -> ../../vda2
lrwxrwxrwx. 1 root root  10 Apr  7 12:52 virtio-0727-4b98cbf2-4e57-4-part3 -> ../../vda3
lrwxrwxrwx. 1 root root   9 Apr  7 12:58 virtio-0727-7db66159-5910-4 -> ../../vdd
lrwxrwxrwx. 1 root root  10 Apr  7 12:58 virtio-0727-7db66159-5910-4-part1 -> ../../vdd1
lrwxrwxrwx. 1 root root   9 Apr  7 12:52 virtio-cloud-init- -> ../../vdc
lrwxrwxrwx. 1 root root   9 Apr  7 12:52 virtio-cloud-init-0727_fa42 -> ../../vdb

If we want to find the data volume named test-metadata-volume, we see that it is the vdd disk. The first 20 characters of the volume attachment identifier are used for the disk id. The symbolic link shows us the name of the disk that it maps to, as well.

Simplifying with the metadata service


Most users are looking for a quicker way to identify the disk name, and these users will also likely be starting with the volume rather than the volume attachment. Fortunately, this is easy to do.

Recently, IBM Cloud VPC introduced the metadata service. This capability allows the end user to query data about itself and get identity tokens and more from the VSI. One of the use cases it can help with is helping simplify getting the disk name based off a volume name.

The steps to find the disk name within a VSI from a given volume are as follows:

◉ Deploy the VSI with metadata turned on
◉ Get an instance identity token
◉ Query the metadata service to list the volume attachments
◉ Find the volume attachment that has the volume specified
◉ Look up the disk name based off the volume attachment

Attached to this post is a script that can be used to retrieve the disk name for a given volume UUID (not the attachment UUID). The following is the sample output:

[root@test-metadata ~]# python3 scripts/find_disk.py -v 0727-7db66159-5910-4ddc-a5b4-51f9333a9c3a-4xjjc
vdd

In this case, the disk is named vdd within the VSI for volume 0727-7db66159-5910-4ddc-a5b4-51f9333a9c3a-4xjjc.

Code


The following code can be embedded into your instance or user data to help quickly identify disk names within the VSI given the volume UUID.  Be sure to remember that the metadata service must be running for this to work properly:

# ======================================================================
#    Copyright 2022 IBM Corp.
#
#    Licensed 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.
# ======================================================================

import argparse
import json
import os
import requests
import sys

def init_argparse():
    parser = argparse.ArgumentParser(
        description=("Finds a local disk by UUID")
    )
    parser.add_argument("-v", "--volume-uuid", required=True,
                        help=("The volume UUID."))

    return parser.parse_args()

def get_token():
    result = requests.put("http://169.254.169.254/instance_identity/v1/token?version=2021-10-12",
                          headers={'Metadata-Flavor': 'ibm'})
    return json.loads(result.text)['access_token']

def get_volume_attachments(access_token):
    result = requests.get("http://169.254.169.254/metadata/v1/instance/volume_attachments?version=2021-10-12",
                          headers={'Authorization': f"Bearer {access_token}"})
    return json.loads(result.text)['volume_attachments']

def get_disk_device(attachment_uuid):
    expected_path = f'/dev/disk/by-id/virtio-{attachment_uuid[:20]}'
    full_path = os.path.realpath(expected_path)
    return full_path.split('/')[-1]

def main():
    args = init_argparse()
    access_token = get_token()
    volume_attachments = get_volume_attachments(access_token)
    for volume_attachment in volume_attachments:
        if volume_attachment['device']['id'] == args.volume_uuid:
            print(get_disk_device(volume_attachment['id']))
            sys.exit(0)
    else:
        print(f"Unable to find disk by volume {args.volume_uuid}")
        sys.exit(1)

if __name__ == '__main__':
    main()

Source: ibm.com

Tuesday, 26 April 2022

The Metaverse of Intellectual Property

IBM, IBM Exam, IBM Exam Prep, IBM Exam Preparation, IBM Exam Certification, IBM Guides, IBM Career, IBM Exam Study

Intellectual property is a broad term. Generally speaking, it is understood to refer to creations of the mind. Of course this includes major Media where content such as written or spoken word, movies, characters, songs, graphics, streaming media, and more — are the exclusive creation of the owner, individual, or individuals, who created the content. Owners have the right (within reason) to do what they will with their content, including monetizing it. Any person or any thing that monetizes content without the expressed written permission of the owner is said to be violating intellectual property law. As such, violations may be subjected to severe economic penalties.

Of course, in today’s internet and it’s evolution, advances in blockchain technology, and all new forms of media, it’s meaning, and application of intellectual property have changed dramatically. The latest challenge to the area of intellectual property law is also quickly developing in the Metaverse and how it’s commonly understood.

Simply stated, the Metaverse is a rising set of new technology driven digital experiences that are taking place through devices driven by new cloud computing models, the internet and network connectivity. It is understood to be some form of virtual reality with a wide array of digital components. Individuals will be able to conduct meetings, to learn, play games, engage in social interactions, and more.

Of course, while the Metaverse is still evolving, there is no question that it will allow individuals to create their own spaces for interactions. It will also certainly allow individuals to create content, or use content, that will be protected by intellectual property law. As you can imagine, the Metaverse presents content creators and owners with a wide array of potential challenges when it comes to tracking their Intellectual Property. These challenges will have massive implications for media companies and the future of content creation broadly.

How You Can Protect Intellectual Property in a Digital Age

While the Metaverse may be the next frontier of experience and technology, there is good news for individuals who have business models based around content creation: This has been done before. Intellectual property can clearly be protected and is protected even in a digital age in which theft of digital assets occurs with staggering regularity.

Some common strategies that have been used to protect intellectual property includes:

1. Copywriting particularly sensitive or important materials.

2. Relying on appropriate contract clauses to ensure that there is no dispute about the ownership of content.

3. Deploying AI technology to identify violations and theft of digital intellectual property.

4. Increasing staff resources to identify and enforce IP law.

There’s even more good news evolving with use of blockchain. The blockchain is often misunderstood as being exclusively the realm of cryptocurrency. In truth, the blockchain can be used in conjunction with smart contracts. Smart contracts allow for digital property (such as NFTs) to be exchanged and tracked. They ensure that there is never a question over ownership and that commerce will be supported when digital assets are shared under certain and proper conditions.

It’s likely that the blockchain and smart contracts will evolve to be an extremely helpful and essential technology when it comes to the protection of intellectual property. The fundamental characteristics of blockchain absolutely  align to support what is required for IP protection. As a distributed system, it simply cannot be altered without the consent of both parties. Hacking the blockchain is virtually impossible. The blockchain, by design, can be used to ensure that there is no question about the ownership or rights of intellectual property.

Intellectual Property and The Metaverse

The Digital Millennium Copyright Act — passed by the United States in 1998 — was a vitally necessary update to copyright law that has proven to be a bedrock tool when it comes to protecting intellectual property in a digital environment. It allows for DMCA “take-down” notices to be sent by digital companies. These notices provide an enforcement mechanism for when one person has been accused of violating the intellectual property rights of another. As such, they are a nearly invaluable tool that can help to protect another person or business’s assets.

Many questions remain about the Metaverse, but this much seems clear: As a digital space, assets that were used or created in or copied into the Metaverse should be protected by the DMCA. Enforcement will unquestionably be a challenge, and a slew of new questions will absolutely arise. However, at least in theory, individuals who create intellectual property for or in the Metaverse should have their assets protected, but if you can’t find or experience it, how can you protect it?

The Role of Artificial Intelligence 

Artificial Intelligence has long been deployed by media companies and big tech, including Google, Netflix, Microsoft, Amazon and IBM. AI can help to enforce Intellectual Property law by identifying potential violations. Today it’s clear that there are companies that have entire business models dedicated to such technology and capabilities.

However, a key question remains: How can AI be deployed in the Metaverse to enforce the protection of Intellectual Property? How can it be used along with the blockchain?

IBM, IBM Exam, IBM Exam Prep, IBM Exam Preparation, IBM Exam Certification, IBM Guides, IBM Career, IBM Exam Study
Companies like IBM have used AI for everything from customer care, advanced cloud and network orchestration, and cybersecurity. However, AI can be targeted to find intellectual property violations. For example, an AI algorithm can be set to scan for the unauthorized use of video, images or other digital assets. When found, legal notices can be sent to the appropriate parties, demanding the assets be taken down. The same AI can then be used to determine what sort of monetization the violator of the property has engaged in, thus allowing for the content creator to be informed and empowered to take action or compensated.

All of this begs a fundamental question: Is your content safe in the Metaverse? How can you track your content? How can you protect your creations and business models, and what sort of legal protections will be in place to do so? Many of these questions remain currently unanswered as the Metaverse continues to be built. However, there is good news: Even in a digital economy, intellectual property has survived as business models have changed. It is reasonable to figure that the same protections that have allowed intellectual property law to continue — including the use of AI — will survive into the Metaverse.

Source: ibm.com